From f73605a67d3521e9a5cea86bdd5a947cf574f061 Mon Sep 17 00:00:00 2001 From: Alexander_Kabui Date: Thu, 9 Jan 2025 10:43:21 +0300 Subject: refactor: enhance docstring for streaming endpoint. --- gn3/api/streaming.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'gn3/api/streaming.py') diff --git a/gn3/api/streaming.py b/gn3/api/streaming.py index 213d97f..355d903 100644 --- a/gn3/api/streaming.py +++ b/gn3/api/streaming.py @@ -10,13 +10,15 @@ streaming = Blueprint("stream", __name__) @streaming.route("/", methods=["GET"]) def stream(identifier): - """ This endpoints streams stdout from a file expects - the indetifier to be the file """ + """ This endpoint streams stdout from a file. + It expects the indetifier to be the filename + in the TMPDIR created at the main computation + endpoint see example api/rqtl.""" output_file = os.path.join(current_app.config.get("TMPDIR"), f"{identifier}.txt") seek_position = int(request.args.get("peak", 0)) with open(output_file, encoding="utf-8") as file_handler: - # read to the last position default to 0 + # read from the last read position default to 0 file_handler.seek(seek_position) results = {"data": file_handler.readlines(), "run_id": identifier, -- cgit 1.4.1