From 0a6edab9f6c9e5cecb73dcd5427ea604c3395dfc Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Thu, 8 Jan 2026 13:39:23 -0600 Subject: Handle the case where the job was manually stopped. --- uploader/background_jobs.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'uploader/background_jobs.py') 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", -- cgit 1.4.1