mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
add logging
This commit is contained in:
parent
3fa51e3c3a
commit
9b6f99929e
1 changed files with 9 additions and 0 deletions
|
|
@ -17,20 +17,29 @@ def handler(event: Mapping[str, Any], context: Any) -> None:
|
|||
for record in event.get("Records", []):
|
||||
try:
|
||||
body_dict = json.loads(record["body"])
|
||||
logger.info("Validating request body")
|
||||
payload = ConditionTriggerRequest.model_validate(body_dict)
|
||||
|
||||
logger.info("Successfully validated request body")
|
||||
|
||||
if payload.uprn_lookup_file_bucket and payload.uprn_lookup_file_key:
|
||||
logger.info("Getting UPRN lookup file from s3")
|
||||
uprn_lookup = UprnLookupS3(
|
||||
bucket=payload.uprn_lookup_file_bucket,
|
||||
key=payload.uprn_lookup_file_key,
|
||||
) # TODO: replace with postgres implementation
|
||||
logger.info("Successfully got UPRN lookup file from s3")
|
||||
else:
|
||||
uprn_lookup = None
|
||||
|
||||
logger.info("Getting conditions data from s3")
|
||||
file_bytes: BytesIO = read_io_from_s3(
|
||||
bucket_name=payload.trigger_file_bucket,
|
||||
file_key=payload.trigger_file_key,
|
||||
)
|
||||
logger.info(
|
||||
"Successfully got conditions data from s3. Moving on to process file..."
|
||||
)
|
||||
|
||||
process_file(
|
||||
file_stream=file_bytes,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue