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.
The terminal emulator is implemented using the `xterm.js` library and logs results from the GN3 API.
See:
This is the main endpoint for streaming:
See reference:
#### 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)