about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2026-01-08 13:39:23 -0600
committerFrederick Muriuki Muriithi2026-01-08 14:07:20 -0600
commit0a6edab9f6c9e5cecb73dcd5427ea604c3395dfc (patch)
tree58c020337813590c586fe7127288edac7d172550
parent4347128187a23cfe75a01fa37b93fecc144296b4 (diff)
downloadgn-uploader-0a6edab9f6c9e5cecb73dcd5427ea604c3395dfc.tar.gz
Handle the case where the job was manually stopped.
-rw-r--r--uploader/background_jobs.py6
-rw-r--r--uploader/templates/background-jobs/list-jobs.html2
2 files changed, 5 insertions, 3 deletions
diff --git a/uploader/background_jobs.py b/uploader/background_jobs.py
index cc1f58b..c07e2f1 100644
--- a/uploader/background_jobs.py
+++ b/uploader/background_jobs.py
@@ -102,7 +102,7 @@ def job_status(job_id: uuid.UUID):
             status = job["metadata"]["status"]
 
             register_job_handlers(job)
-            if status == "error":
+            if status in ("error", "stopped"):
                 return error_handler(job)
 
             if status == "completed":
@@ -155,7 +155,7 @@ def job_summary(job_id: uuid.UUID):
             job = jobs.job(conn, job_id, fulldetails=True)
             status = job["metadata"]["status"]
 
-            if status in ("completed", "error"):
+            if status in ("completed", "error", "stopped"):
                 return render_template("background-jobs/job-summary.html",
                                        job=job,
                                        display_datetime=make_datetime_formatter())
@@ -173,11 +173,11 @@ def delete_single(job_id: uuid.UUID):
         try:
             job = jobs.job(conn, job_id, fulldetails=True)
             status = job["metadata"]["status"]
-            if status not in ("completed", "error"):
                 flash("We cannot delete a running job.", "alert alert-error")
                 # redirect below might be wrong in some cases. Redirect
                 # appropriately.
                 return redirect(url_for("background-jobs.list_jobs"))
+            if status not in ("completed", "error", "stopped"):
 
             if request.method == "GET":
                 return render_template("background-jobs/delete-job.html",
diff --git a/uploader/templates/background-jobs/list-jobs.html b/uploader/templates/background-jobs/list-jobs.html
index 3e87a31..c16b850 100644
--- a/uploader/templates/background-jobs/list-jobs.html
+++ b/uploader/templates/background-jobs/list-jobs.html
@@ -36,6 +36,8 @@
               class="fw-bold text-capitalize text-success"
               {%elif job.metadata.status == "error"%}
               class="fw-bold text-capitalize text-danger"
+              {%elif job.metadata.status == "stopped"%}
+              class="fw-bold text-capitalize text-warning"
               {%else%}
               class="fw-bold text-capitalize text-info"
               {%endif%}>