Skip to content

Commit

Permalink
Deal with error from preproc lambda.
Browse files Browse the repository at this point in the history
  • Loading branch information
danscales committed Aug 12, 2024
1 parent 3673f7f commit b5b8487
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 9 deletions.
3 changes: 0 additions & 3 deletions lambdas/aggregation/src/lambda_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from aws_xray_sdk.core import patch, xray_recorder

from raster_analysis.boto import s3_client
from raster_analysis.exceptions import QueryParseException
from raster_analysis.globals import LOGGER

patch(["boto3"])
Expand Down Expand Up @@ -95,8 +94,6 @@ def handler(event, context):
"failed_geometries_link": failed_geometries_link,
},
}
except QueryParseException as e:
return {"status": "failed", "message": str(e)}
except Exception as e:
LOGGER.exception(e)
return {"status": "error", "message": str(e)}
3 changes: 0 additions & 3 deletions lambdas/preprocessing/src/lambda_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from shapely.wkb import dumps as wkb_dumps

from raster_analysis.boto import s3_client
from raster_analysis.exceptions import QueryParseException
from raster_analysis.globals import LOGGER, S3_PIPELINE_BUCKET

patch(["boto3"])
Expand Down Expand Up @@ -59,8 +58,6 @@ def handler(event, context):
"geometries": {"bucket": S3_PIPELINE_BUCKET, "key": geom_prefix},
"output": {"bucket": S3_PIPELINE_BUCKET, "prefix": output_prefix},
}
except QueryParseException as e:
return {"status": "failed", "message": str(e), "geometries": {}, "output": {}}
except Exception as e:
LOGGER.exception(e)
return {"status": "error", "message": str(e), "geometries": {}, "output": {}}
Expand Down
27 changes: 24 additions & 3 deletions step_functions/process_list.json.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,30 @@
"Payload.$": "$",
"FunctionName": "${lambda_preprocessing_name}"
},
"ResultSelector": {
"geometries.$": "$.Payload.geometries",
"output.$": "$.Payload.output"
"ResultPath": "$.PreprocOutput",
"Next": "Check status"
},
"Check status": {
"Type": "Choice",
"Choices": [
{
"Variable": "$.PreprocOutput.status",
"StringEquals": "error",
"Next": "Error state"
}
],
"Default": "Copy results"
},
"Error state": {
"Type": "Pass",
"OutputPath": "$.PreprocOutput",
"End": true
},
"Copy results": {
"Type": "Pass",
"Result": {
"geometries.$": "$.PreprocOutput.geometries",
"output.$", "$.PreprocOutput.output"
},
"ResultPath": "$.files",
"Next": "Process List"
Expand Down

0 comments on commit b5b8487

Please sign in to comment.