diff options
author | Alexander Kabui | 2021-10-05 17:14:23 +0300 |
---|---|---|
committer | BonfaceKilz | 2021-10-25 14:16:21 +0300 |
commit | c6bce638cfac9df0a4f3f380971fde65b1947ad7 (patch) | |
tree | 4c72ccb24b4711143a414bd0c7c85a76c153c16b /gn3/computations | |
parent | 84f5c8a4384f29dfcb187ac5eed43551860b182b (diff) | |
download | genenetwork3-c6bce638cfac9df0a4f3f380971fde65b1947ad7.tar.gz |
add socket obj and emit process
Diffstat (limited to 'gn3/computations')
-rw-r--r-- | gn3/computations/wgcna.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/gn3/computations/wgcna.py b/gn3/computations/wgcna.py index 4dd0985..94e2a40 100644 --- a/gn3/computations/wgcna.py +++ b/gn3/computations/wgcna.py @@ -28,12 +28,18 @@ def stream_cmd_output(socket, cmd: str): """function to stream in realtime""" # xtodo syncing and closing /edge cases + socket.emit("output", {"data", f"calling you script {cmd}"}) + results = subprocess.Popen( cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True) for line in iter(results.stdout.readline, b""): line = line.decode("utf-8").rstrip() - # xtodo emit the data + socket.emit("output", + {"data": line}) + # close above make sure the process is closed + + socket.emit("output", {"data": "parsing the output results"}) def process_image(image_loc: str) -> bytes: @@ -62,8 +68,6 @@ def call_wgcna_script(rscript_path: str, request_data: dict): run_cmd_results = run_cmd(cmd) - print(run_cmd_results["output"]) - with open(generated_file, "r") as outputfile: output_file_data = json.load(outputfile) |