diff --git a/lambdas/aggregation/src/lambda_function.py b/lambdas/aggregation/src/lambda_function.py index 6549507..2e0ab30 100644 --- a/lambdas/aggregation/src/lambda_function.py +++ b/lambdas/aggregation/src/lambda_function.py @@ -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"]) @@ -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)} diff --git a/lambdas/preprocessing/src/lambda_function.py b/lambdas/preprocessing/src/lambda_function.py index 4fd02af..2b78575 100644 --- a/lambdas/preprocessing/src/lambda_function.py +++ b/lambdas/preprocessing/src/lambda_function.py @@ -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"]) @@ -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": {}} diff --git a/step_functions/process_list.json.tmpl b/step_functions/process_list.json.tmpl index acdd4c2..7d49947 100644 --- a/step_functions/process_list.json.tmpl +++ b/step_functions/process_list.json.tmpl @@ -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"