diff options
author | Frederick Muriuki Muriithi | 2024-01-23 12:33:08 +0300 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2024-01-23 12:33:08 +0300 |
commit | 7976230ffcb1de4f744895ee252298dea9a15f4c (patch) | |
tree | 93767bf918847c7707cf369c6f3fbc1b2a562590 /qc_app/upload/rqtl2.py | |
parent | 1822e893586e13334cc66d59efbe03c1ffb48b66 (diff) | |
download | gn-uploader-7976230ffcb1de4f744895ee252298dea9a15f4c.tar.gz |
Update scripts to use redis prefix.
Diffstat (limited to 'qc_app/upload/rqtl2.py')
-rw-r--r-- | qc_app/upload/rqtl2.py | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/qc_app/upload/rqtl2.py b/qc_app/upload/rqtl2.py index 7805114..eea49e1 100644 --- a/qc_app/upload/rqtl2.py +++ b/qc_app/upload/rqtl2.py @@ -552,11 +552,13 @@ def confirm_bundle_details(species_id: int, population_id: int): _job = jobs.launch_job( jobs.initialise_job( rconn, + jobs.jobsnamespace(), jobid, [ sys.executable, "-m", "scripts.process_rqtl2_bundle", - app.config["SQL_URI"], app.config["REDIS_URL"], jobid, - "--redisexpiry", str(redis_ttl_seconds)], + app.config["SQL_URI"], app.config["REDIS_URL"], + jobs.jobsnamespace(), jobid, "--redisexpiry", + str(redis_ttl_seconds)], "R/qtl2 Bundle Upload", redis_ttl_seconds, { @@ -588,21 +590,22 @@ def confirm_bundle_details(species_id: int, population_id: int): def rqtl2_processing_status(jobid: UUID): """Retrieve the status of the job processing the uploaded R/qtl2 bundle.""" with Redis.from_url(app.config["REDIS_URL"], decode_responses=True) as rconn: - thejob = jobs.job(rconn, jobid) - if not bool(thejob): - return render_template("rqtl2/no-such-job.html", jobid=jobid) + try: + thejob = jobs.job(rconn, jobs.jobsnamespace(), jobid) - messagelistname = thejob.get("log-messagelist") - logmessages = (rconn.lrange(messagelistname, 0, -1) - if bool(messagelistname) else []) + messagelistname = thejob.get("log-messagelist") + logmessages = (rconn.lrange(messagelistname, 0, -1) + if bool(messagelistname) else []) - if thejob["status"] == "error": - return render_template( - "rqtl2/rqtl2-job-error.html", job=thejob, messages=logmessages) - if thejob["status"] == "success": - return render_template("rqtl2/rqtl2-job-results.html", - job=thejob, - messages=logmessages) + if thejob["status"] == "error": + return render_template( + "rqtl2/rqtl2-job-error.html", job=thejob, messages=logmessages) + if thejob["status"] == "success": + return render_template("rqtl2/rqtl2-job-results.html", + job=thejob, + messages=logmessages) - return render_template( - "rqtl2/rqtl2-job-status.html", job=thejob, messages=logmessages) + return render_template( + "rqtl2/rqtl2-job-status.html", job=thejob, messages=logmessages) + except jobs.JobNotFound as _exc: + return render_template("rqtl2/no-such-job.html", jobid=jobid) |