英文:
How to catch error in AWS distributed map state
问题
我在使用StepFunctions时遇到了一些问题...是否有办法捕获类似于States.ExceedToleratedFailureThreshold的DistributedMaps中的错误?我有类似以下的东西,但不知何故Catch未应用,当至少有一个Lambda失败时,执行就失败了:
{
"Next": "ReleaseSlot",
"Type": "Map",
"ItemReader": {
"ReaderConfig": {
"InputType": "CSV",
"CSVHeaderLocation": "FIRST_ROW"
},
"Resource": "arn:aws:states:::s3:getObject",
"Parameters": {
"Bucket": "<BUCKET>",
"Key.$": "$.filename"
}
},
"ItemBatcher": {
"MaxItemsPerBatch": 1000,
"BatchInput": {
"data.$": "$"
}
},
"ItemProcessor": {
"StartAt": "BatchImporter",
"States": {
"BatchImporter": {
"Type": "Task",
"Resource": "arn:aws:states:::lambda:invoke",
"Parameters": {
"FunctionName": "<FUNCTION_ARN>",
"Payload": {
"body": "$"
}
},
"ResultPath": null,
"OutputPath": null,
"End": true
}
},
"ProcessorConfig": {
"Mode": "DISTRIBUTED",
"ExecutionType": "STANDARD"
}
},
"MaxConcurrency": 16,
"ToleratedFailurePercentage": 0,
"Catch": [
{
"ErrorEquals": [
"States.All"
],
"Next": "ReleaseSlot"
}
]
}
我想捕获这个错误,因为如果它发生了,分布式映射将无法运行“ReleaseSlot”状态,这会导致状态不一致。
英文:
I'm facing some issues with StepFunctions... Is there a way to Catch errors like States.ExceedToleratedFailureThreshold in DistributedMaps? I have something like this but somehow the Catch isn't applied and the execution just fails when at least one Lambda is failing:
{
"Next": "ReleaseSlot",
"Type": "Map",
"ItemReader": {
"ReaderConfig": {
"InputType": "CSV",
"CSVHeaderLocation": "FIRST_ROW"
},
"Resource": "arn:aws:states:::s3:getObject",
"Parameters": {
"Bucket": "<BUCKET>",
"Key.$": "$.filename"
}
},
"ItemBatcher": {
"MaxItemsPerBatch": 1000,
"BatchInput": {
"data.$": "$"
}
},
"ItemProcessor": {
"StartAt": "BatchImporter",
"States": {
"BatchImporter": {
"Type": "Task",
"Resource": "arn:aws:states:::lambda:invoke",
"Parameters": {
"FunctionName": "<FUNCTION_ARN>",
"Payload": {
"body": "$"
}
},
"ResultPath": null,
"OutputPath": null,
"End": true
}
},
"ProcessorConfig": {
"Mode": "DISTRIBUTED",
"ExecutionType": "STANDARD"
}
},
"MaxConcurrency": 16,
"ToleratedFailurePercentage": 0,
"Catch": [
{
"ErrorEquals": [
"States.All"
],
"Next": "ReleaseSlot"
}
]
}
I wanted to catch this error, as if it occurred then distributed map failed to run "ReleaseSlot" state, which leads to inconsistent state.
答案1
得分: 1
错误名称中的外壳不正确。您需要使用States.ALL(大写的ALL)。
英文:
The casing in your Error name is incorrect. You need to use States.ALL (capitalized ALL).
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论