88from app .aws .s3 import remove_csv_object
99from app .celery .process_ses_receipts_tasks import check_and_queue_callback_task
1010from app .config import QueueNames
11- from app .cronitor import cronitor
1211from app .dao .fact_processing_time_dao import insert_update_processing_time
1312from app .dao .inbound_sms_dao import delete_inbound_sms_older_than_retention
1413from app .dao .jobs_dao import (
3029from app .utils import get_midnight_in_utc , utc_now
3130
3231
33- @notify_celery .task (name = "remove_sms_email_jobs" )
34- @cronitor ("remove_sms_email_jobs" )
32+ @notify_celery .task (name = "remove-sms-email-jobs" )
3533def remove_sms_email_csv_files ():
3634 _remove_csv_files ([NotificationType .EMAIL , NotificationType .SMS ])
3735
@@ -51,6 +49,7 @@ def cleanup_unfinished_jobs():
5149 for job in jobs :
5250 # The query already checks that the processing_finished time is null, so here we are saying
5351 # if it started more than 4 hours ago, that's too long
52+ acceptable_finish_time = None
5453 try :
5554 if job .processing_started is not None :
5655 acceptable_finish_time = job .processing_started + timedelta (minutes = 5 )
@@ -59,7 +58,7 @@ def cleanup_unfinished_jobs():
5958 f"Job ID { job .id } processing_started is { job .processing_started } ." ,
6059 )
6160 raise
62- if now > acceptable_finish_time :
61+ if acceptable_finish_time and now > acceptable_finish_time :
6362 remove_csv_object (job .original_file_name )
6463 dao_archive_job (job )
6564
@@ -74,14 +73,12 @@ def delete_notifications_older_than_retention():
7473 )
7574
7675
77- @notify_celery .task (name = "delete-sms-notifications" )
78- @cronitor ("delete-sms-notifications" )
76+ @notify_celery .task (name = "delete-sms-notifications-older-than-retention" )
7977def delete_sms_notifications_older_than_retention ():
8078 _delete_notifications_older_than_retention_by_type (NotificationType .SMS )
8179
8280
83- @notify_celery .task (name = "delete-email-notifications" )
84- @cronitor ("delete-email-notifications" )
81+ @notify_celery .task (name = "delete-email-notifications-older-than-retention" )
8582def delete_email_notifications_older_than_retention ():
8683 _delete_notifications_older_than_retention_by_type (NotificationType .EMAIL )
8784
@@ -161,7 +158,6 @@ def delete_notifications_for_service_and_type(
161158
162159
163160@notify_celery .task (name = "timeout-sending-notifications" )
164- @cronitor ("timeout-sending-notifications" )
165161def timeout_notifications ():
166162 notifications = ["dummy value so len() > 0" ]
167163
@@ -183,7 +179,6 @@ def timeout_notifications():
183179
184180
185181@notify_celery .task (name = "delete-inbound-sms" )
186- @cronitor ("delete-inbound-sms" )
187182def delete_inbound_sms ():
188183 try :
189184 start = utc_now ()
@@ -199,7 +194,6 @@ def delete_inbound_sms():
199194
200195
201196@notify_celery .task (name = "save-daily-notification-processing-time" )
202- @cronitor ("save-daily-notification-processing-time" )
203197def save_daily_notification_processing_time (local_date = None ):
204198 # local_date is a string in the format of "YYYY-MM-DD"
205199 if local_date is None :
0 commit comments