aboutsummaryrefslogtreecommitdiff
path: root/qc_app/parse.py
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2022-05-20 09:25:28 +0300
committerFrederick Muriuki Muriithi2022-05-20 09:25:28 +0300
commitc9e231c5fcbc01d00ee5cdd4458ece8fcaf6d39c (patch)
tree7fe23bfe5dd4368952d6148181a1e1b125184f51 /qc_app/parse.py
parent2abe10ea8ac059d7cab83895bb5d2ec6d4a6ce1c (diff)
downloadgn-uploader-c9e231c5fcbc01d00ee5cdd4458ece8fcaf6d39c.tar.gz
Handle errors
Implement code to handle errors in the processing of files.
Diffstat (limited to 'qc_app/parse.py')
-rw-r--r--qc_app/parse.py16
1 files changed, 6 insertions, 10 deletions
diff --git a/qc_app/parse.py b/qc_app/parse.py
index d2fa030..c97f078 100644
--- a/qc_app/parse.py
+++ b/qc_app/parse.py
@@ -109,21 +109,17 @@ def results(job_id: str):
def fail(job_id: str):
"""Handle parsing failure"""
with Redis.from_url(app.config["REDIS_URL"], decode_responses=True) as rconn:
- old_job = jobs.job(rconn, job_id)
+ job = jobs.job(rconn, job_id)
- if old_job:
+ if job:
error_filename = jobs.error_filename(
job_id, f"{app.config['UPLOAD_FOLDER']}/job_errors")
if os.path.exists(error_filename):
stat = os.stat(error_filename)
if stat.st_size > 0:
- with open(error_filename) as errorfile:
- return errorfile.read()
-
- # job_id = old_job["job_id"]
- progress = old_job["progress"]
- status = old_job["status"]
- results = old_job["results"]
- filename = old_job["filename"]
+ return render_template(
+ "worker_failure.html", job_id=job_id)
+
+ return render_template("parse_failure.html", job=job)
return render_template("no_such_job.html", job_id=job_id)