blob: 4f81eea5493dc631cb915538902558e37b56bfae (
about) (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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)
```
|