aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Kabui2021-10-05 17:14:23 +0300
committerBonfaceKilz2021-10-25 14:16:21 +0300
commitc6bce638cfac9df0a4f3f380971fde65b1947ad7 (patch)
tree4c72ccb24b4711143a414bd0c7c85a76c153c16b
parent84f5c8a4384f29dfcb187ac5eed43551860b182b (diff)
downloadgenenetwork3-c6bce638cfac9df0a4f3f380971fde65b1947ad7.tar.gz
add socket obj and emit process
-rw-r--r--gn3/computations/wgcna.py10
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)