File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change 33import os
44from csv import DictReader
55from io import TextIOWrapper
6- from clients import s3_client
6+ from clients import s3_client , logger
77
88
99def get_environment () -> str :
@@ -28,3 +28,19 @@ def get_csv_content_dict_reader(file_key: str) -> DictReader:
2828def create_diagnostics_dictionary (error_type , status_code , error_message ) -> dict :
2929 """Returns a dictionary containing the error_type, statusCode, and error_message"""
3030 return {"error_type" : error_type , "statusCode" : status_code , "error_message" : error_message }
31+
32+
33+ def invoke_filename_lambda (file_key : str , message_id : str ) -> None :
34+ """Invokes the filenameprocessor lambda with the given file key and message id"""
35+ try :
36+ lambda_payload = {
37+ "Records" : [
38+ {"s3" : {"bucket" : {"name" : SOURCE_BUCKET_NAME }, "object" : {"key" : file_key }}, "message_id" : message_id }
39+ ]
40+ }
41+ lambda_client .invoke (
42+ FunctionName = FILE_NAME_PROC_LAMBDA_NAME , InvocationType = "Event" , Payload = json .dumps (lambda_payload )
43+ )
44+ except Exception as error :
45+ logger .error ("Error invoking filename lambda: %s" , error )
46+ raise
You can’t perform that action at this time.
0 commit comments