@@ -33,14 +33,15 @@ def apply_filter(self, batch_file_created_event: BatchFileCreatedEvent) -> None:
3333 vaccine_type = batch_file_created_event ["vaccine_type" ]
3434
3535 # debug
36- print ("SAW ----------- DEBUG -------------" )
36+ print ("SAW ----------- apply_filter DEBUG -------------" )
3737 print (f"filename: { filename } " )
3838 print (f"message_id: { message_id } " )
3939 print (f"supplier: { supplier } " )
4040 print (f"vaccine_type: { vaccine_type } " )
41- print ("SAW ----------- END DEBUG -------------" )
4241
42+ print ("apply_filter...checking for duplicate file..." )
4343 if self ._is_duplicate_file (filename ):
44+ print ("apply_filter...duplicate file found" )
4445 # Mark as processed and return without error so next event will be picked up from queue
4546 logger .error ("A duplicate file has already been processed. Filename: %s" , filename )
4647 self ._batch_audit_repository .update_status (
@@ -51,22 +52,28 @@ def apply_filter(self, batch_file_created_event: BatchFileCreatedEvent) -> None:
5152 self ._batch_file_repo .move_source_file_to_archive (filename )
5253 return
5354
55+ print ("apply_filter...check for event already processing for supplier and vacc type..." )
5456 if self ._batch_audit_repository .is_event_processing_or_failed_for_supplier_and_vacc_type (
5557 supplier ,
5658 vaccine_type
5759 ):
60+ print ("apply_filter...event already processing for supplier and vacc type found" )
5861 # Raise error so event is returned to queue and retried again later
5962 logger .info ("Batch event already processing for supplier and vacc type. Filename: %s" , filename )
6063 raise EventAlreadyProcessingForSupplierAndVaccTypeError (f"Batch event already processing for supplier: "
6164 f"{ supplier } and vacc type: { vaccine_type } " )
6265
66+ print ("apply_filter...forwarding file for processing..." )
6367 self ._queue_client .send_message (
6468 QueueUrl = QUEUE_URL ,
6569 MessageBody = json .dumps (batch_file_created_event ),
6670 MessageGroupId = f"{ supplier } _{ vaccine_type } "
6771 )
72+ print ("apply_filter...updating status to processing..." )
6873 self ._batch_audit_repository .update_status (message_id , FileStatus .PROCESSING )
6974
75+ print ("apply_filter...sending log to firehose..." )
7076 successful_log_message = f"File forwarded for processing by ECS. Filename: { filename } "
7177 logger .info (successful_log_message )
7278 send_log_to_firehose ({** batch_file_created_event , "message" : successful_log_message })
79+ print ("apply_filter...done" )
0 commit comments