From 17b078982f2f1cfa983f764da97c60bfc1e9b1d2 Mon Sep 17 00:00:00 2001 From: Cliff Hill Date: Fri, 26 Jul 2024 09:46:37 -0400 Subject: [PATCH 1/2] Logging where the error is at. Signed-off-by: Cliff Hill --- app/celery/nightly_tasks.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/celery/nightly_tasks.py b/app/celery/nightly_tasks.py index dd063be64..c5b862dff 100644 --- a/app/celery/nightly_tasks.py +++ b/app/celery/nightly_tasks.py @@ -51,7 +51,11 @@ def cleanup_unfinished_jobs(): for job in jobs: # The query already checks that the processing_finished time is null, so here we are saying # if it started more than 4 hours ago, that's too long - acceptable_finish_time = job.processing_started + timedelta(minutes=5) + try: + acceptable_finish_time = job.processing_started + timedelta(minutes=5) + except TypeError as e: + current_app.logger.error(f"Job ID {job.id} processing_started is {job.processing_started}.") + raise if now > acceptable_finish_time: remove_csv_object(job.original_file_name) dao_archive_job(job) From fef3173876ee0f43d38f82c779ee9d1c90f8b38d Mon Sep 17 00:00:00 2001 From: Cliff Hill Date: Fri, 26 Jul 2024 12:42:36 -0400 Subject: [PATCH 2/2] Minor fix. Signed-off-by: Cliff Hill --- app/celery/nightly_tasks.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/celery/nightly_tasks.py b/app/celery/nightly_tasks.py index c5b862dff..4ff56d44b 100644 --- a/app/celery/nightly_tasks.py +++ b/app/celery/nightly_tasks.py @@ -53,8 +53,10 @@ def cleanup_unfinished_jobs(): # if it started more than 4 hours ago, that's too long try: acceptable_finish_time = job.processing_started + timedelta(minutes=5) - except TypeError as e: - current_app.logger.error(f"Job ID {job.id} processing_started is {job.processing_started}.") + except TypeError: + current_app.logger.error( + f"Job ID {job.id} processing_started is {job.processing_started}." + ) raise if now > acceptable_finish_time: remove_csv_object(job.original_file_name)