Skip to content

Commit 40e80f8

Browse files
committed
debug
1 parent be40a91 commit 40e80f8

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

batch_processor_filter/src/batch_processor_filter_service.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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")

e2e_batch/test_e2e_batch.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@ class TestE2EBatch(unittest.TestCase):
3636
def setUp(self):
3737
self.seed_datas = [
3838
TestData("V0V8L", ActionSet.CREATE),
39-
TestData("8HK48", ActionSet.UPDATE),
40-
TestData("8HA94", ActionSet.DELETE),
39+
# TestData("8HK48", ActionSet.UPDATE),
40+
# TestData("8HA94", ActionSet.DELETE),
4141
# TestData("Reinstate", "X26", [NEW, DELETE, UPDATE]),
4242
# TestData("Update no Create", "YGM41", [UPDATE], expected=BusRowResult.FATAL_ERROR,
4343
# operation_outcome=OpMsgs.IMM_NOT_EXIST),
4444
# TestData("Delete no Create", "YGJ", [DELETE], expected=BusRowResult.FATAL_ERROR,
4545
# operation_outcome=OpMsgs.IMM_NOT_EXIST),
46-
TestData("YGA", ActionSet.CREATE, inject_char=True, name="Create with 1252 char"),
46+
# TestData("YGA", ActionSet.CREATE, inject_char=True, name="Create with 1252 char"),
4747
]
4848

4949
def tearDown(self):

e2e_batch/utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -580,6 +580,7 @@ def generate_csv_files(seed_data_list: list[TestData]) -> list[TestData]:
580580
"""Generate CSV files based on a list of TestData instances."""
581581
for seed_data in seed_data_list:
582582
file_name = (generate_csv_file(seed_data, actions=seed_data.action_sequence.actions))
583+
logger.info(f"Test file: {file_name}")
583584
seed_data.file_name = file_name
584585
return seed_data_list
585586

0 commit comments

Comments
 (0)