From a408abf9539de083c0d58b002c647ab67c2c622d Mon Sep 17 00:00:00 2001 From: Alexander_Kabui Date: Fri, 22 Nov 2024 12:37:49 +0300 Subject: feat: return pointer position from where the file was last read. --- gn3/api/rqtl2.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'gn3/api/rqtl2.py') diff --git a/gn3/api/rqtl2.py b/gn3/api/rqtl2.py index 03cf340..cc857da 100644 --- a/gn3/api/rqtl2.py +++ b/gn3/api/rqtl2.py @@ -6,6 +6,7 @@ import os from flask import current_app from flask import jsonify from flask import Blueprint +from flask import request rqtl2 = Blueprint("rqtl2", __name__) @@ -42,9 +43,11 @@ def compute(): def stream(indetifier): """ This endpoints streams stdout from a file expects the indetifier to be the file """ + # add seek position to this 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()}) + # rethink how we do the read should this be stream / yield/peak ???? + return jsonify({"data": file_handler.readlines(), + "pointer": file_handler.tell()}) -- cgit 1.4.1