diff options
author | Alexander_Kabui | 2025-01-10 14:34:10 +0300 |
---|---|---|
committer | Alexander_Kabui | 2025-01-10 14:34:10 +0300 |
commit | 0d7a96387424e6a85af3e33481d84f4988323ceb (patch) | |
tree | 4bde1d9824adc2c9acf2aba98b8388f3b1b15672 /topics | |
parent | 9e3de294075c6ad645576b76b7d142309b1bc04c (diff) | |
download | gn-gemtext-0d7a96387424e6a85af3e33481d84f4988323ceb.tar.gz |
feat: Add new topic: genenetwork streaming functionality.
Diffstat (limited to 'topics')
-rw-r--r-- | topics/genenetwork/genenetwork-streaming-functionality.gmi | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/topics/genenetwork/genenetwork-streaming-functionality.gmi b/topics/genenetwork/genenetwork-streaming-functionality.gmi new file mode 100644 index 0000000..4f81eea --- /dev/null +++ b/topics/genenetwork/genenetwork-streaming-functionality.gmi @@ -0,0 +1,43 @@ +# Genenetwork Streaming Functionality + +## Tags +* type: documentation +* Keywords: documentation, docs, genenetwork, streaming + +### Introduction +Genenetwork implements streaming functionality that logs results from a running external process to a terminal emulator. + +The streaming functionality can be divided into several sections. + +### Streaming UI +The terminal emulator is implemented using the `xterm.js` library and +logs results from the GN3 API. + +See: +=> https://github.com/xtermjs/xterm.js + +### Streaming API +This is the main endpoint for streaming: + +See reference: +=> https://github.com/genenetwork/genenetwork3/gn3/api/streaming.py + +### How to Integrate + +#### Import the `enable_streaming` Decorator + +``` +from gn3.computations.streaming import enable_streaming +``` + +#### Apply the Decorator to Your Endpoint that Runs an External Process + +Note: To run the external process, use the `run_process` function, +which captures the `stdout` in a file identified by the `run_id`. + +``` +@app.route('/your-endpoint') +@enable_streaming +def your_endpoint(streaming_output_file): + run_process(command, streaming_output_file, run_id) +``` |