Skip to content

Commit ea9dfa7

Browse files
authored
Merge branch 'master' into VED-294-fix-potential-delta-duplication
2 parents e8e0192 + 7306775 commit ea9dfa7

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

recordprocessor/src/file_level_validation.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def move_file(bucket_name: str, source_file_key: str, destination_file_key: str)
6565

6666

6767
@file_level_validation_logging_decorator
68-
def file_level_validation(incoming_message_body: dict) -> None:
68+
def file_level_validation(incoming_message_body: dict) -> dict:
6969
"""
7070
Validates that the csv headers are correct and that the supplier has permission to perform at least one of
7171
the requested operations. Uploades the inf ack file and moves the source file to the processing folder.
@@ -114,7 +114,10 @@ def file_level_validation(incoming_message_body: dict) -> None:
114114
created_at_formatted_string = created_at_formatted_string or "Unable to ascertain created_at_formatted_string"
115115
make_and_upload_ack_file(message_id, file_key, False, False, created_at_formatted_string)
116116

117-
move_file(SOURCE_BUCKET_NAME, file_key, f"archive/{file_key}")
117+
try:
118+
move_file(SOURCE_BUCKET_NAME, file_key, f"archive/{file_key}")
119+
except Exception as move_file_error:
120+
logger.error("Failed to move file to archive: %s", move_file_error)
118121

119122
# Update the audit table and invoke the filename lambda with next file in the queue (if one exists)
120123
change_audit_table_status_to_processed(file_key, message_id)

recordprocessor/src/utils_for_recordprocessor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def get_environment() -> str:
1616
return _env if _env in ["internal-dev", "int", "ref", "sandbox", "prod"] else "internal-dev"
1717

1818

19-
def get_csv_content_dict_reader(file_key: str) -> DictReader:
19+
def get_csv_content_dict_reader(file_key: str) -> (DictReader, str):
2020
"""Returns the requested file contents from the source bucket in the form of a DictReader"""
2121
response = s3_client.get_object(Bucket=os.getenv("SOURCE_BUCKET_NAME"), Key=file_key)
2222
csv_data = response["Body"].read().decode("utf-8")

0 commit comments

Comments
 (0)