aboutsummaryrefslogtreecommitdiff
path: root/qc_app
diff options
context:
space:
mode:
Diffstat (limited to 'qc_app')
-rw-r--r--qc_app/parse.py16
-rw-r--r--qc_app/templates/parse_failure.html26
-rw-r--r--qc_app/templates/worker_failure.html24
3 files changed, 56 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)
diff --git a/qc_app/templates/parse_failure.html b/qc_app/templates/parse_failure.html
new file mode 100644
index 0000000..31f6be8
--- /dev/null
+++ b/qc_app/templates/parse_failure.html
@@ -0,0 +1,26 @@
+{%extends "base.html"%}
+
+{%block title%}Worker Failure{%endblock%}
+
+{%block contents%}
+<h1 class="heading">Worker Failure</h1>
+
+<p>
+ There was an error while parsing your file.
+</p>
+
+<p>
+ Please notify the developers of this issue when you encounter it,
+ providing the information below.
+</p>
+
+<h4>Debugging Information</h4>
+
+<ul>
+ <li><strong>job id</strong>: {{job["job_id"]}}</li>
+ <li><strong>filename</strong>: {{job["filename"]}}</li>
+ <li><strong>line number</strong>: {{job["line_number"]}}</li>
+ <li><strong>Progress</strong>: {{job["percent"]}} %</li>
+</ul>
+
+{%endblock%}
diff --git a/qc_app/templates/worker_failure.html b/qc_app/templates/worker_failure.html
new file mode 100644
index 0000000..b65b140
--- /dev/null
+++ b/qc_app/templates/worker_failure.html
@@ -0,0 +1,24 @@
+{%extends "base.html"%}
+
+{%block title%}Worker Failure{%endblock%}
+
+{%block contents%}
+<h1 class="heading">Worker Failure</h1>
+
+<p>
+ There was a critical failure launching the job to parse your file.
+ This is our fault and (probably) has nothing to do with the file you uploaded.
+</p>
+
+<p>
+ Please notify the developers of this issue when you encounter it,
+ providing the link to this page, or the information below.
+</p>
+
+<h4>Debugging Information</h4>
+
+<ul>
+ <li><strong>job id</strong>: {{job_id}}</li>
+</ul>
+
+{%endblock%}