diff options
| -rw-r--r-- | gn3/api/rqtl2.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/gn3/api/rqtl2.py b/gn3/api/rqtl2.py index e746918..03cf340 100644 --- a/gn3/api/rqtl2.py +++ b/gn3/api/rqtl2.py @@ -36,3 +36,15 @@ def compute(): return jsonify({"msg": "success", "results": "file_here"}) else: return jsonify({"msg": "fail", "error": "Process failed"}) + + +@rqtl2.route("/stream/<indetifier>", methods=["GET"]) +def stream(indetifier): + """ This endpoints streams stdout from a file expects + the indetifier to be the file """ + output_file = os.path.join(current_app.config.get("TMPDIR"), + f"{indetifier}.txt") + # raise error if file does not exist + with open(output_file) as file_handler: + # rethink how we do the read should this be stream / yield ???? + return jsonify({"data": file_handler.readlines()}) |
