问题描述
对于错误处理,我将在一个大型并行步骤中包装一系列Lambda函数,例如Step Functions : apply try-catch to a block of states | theburningmonk.com,以便对整个工作流进行错误处理。但是,第一步是另一个并行步骤,如果某项操作失败,则不清楚哪个lambda失败。因此,如果嵌套并行步骤中的lambda失败,则执行图如下所示:
基本上,如果大并行步骤失败,它将触发NotifyError。但是由于错误处理,它不会显示错误-失败的步骤只是停留在“ inProgress”,将错误信息传递给NotifyError步骤。问题是,嵌套的并行步骤仅停留在“进行中”状态,并且图形继续执行到“ NotifyError”步骤,该步骤成功执行。现在,此NotifyError步骤从失败的lambda函数接收错误消息作为输入,但没有说明它是哪个函数。我收到这样的消息:
{
"Error": "NameError","Cause": "{\"errorMessage\": \"name 'throw_error' is not defined\",\"errorType\": \"NameError\",\"stackTrace\": [[\"/var/task/lambda_function.py\",26,\"lambda_handler\",\"throw_error\"]]}"
}
如何包含哪个嵌套步骤引发了错误?没有错误处理,失败的lambda将变为红色,并输出错误。但是通过这种方式,失败步骤中的所有嵌套lambda都会卡在“ inProgress”中,而没有任何输出信息。
{
"StartAt": "Try","States": {
"Try": {
"Type": "Parallel","Branches": [
{
"Comment": "Parallel Example.","StartAt": "LookupCustomerInfo","States": {
"LookupCustomerInfo": {
"Type": "Parallel","Next": "Segmentation","Branches": [
{
"StartAt": "Proc1","States": {
"Proc1": {
"Type": "Task","Resource": "arn:[REMOVED]","End": true
}
}
},{
"StartAt": "Proc2","States": {
"Proc2": {
"Type": "Task",{
"StartAt": "Proc3","States": {
"Proc3": {
"Type": "Task","End": true
}
}
}
]
},"Segmentation": {
"Type": "Task","Next": "StartBatchJobs"
},"StartBatchJobs": {
"Type": "Task","Resource": "arn:aws:[REMOVED]","Next": "WaitForBatchJobs"
},"WaitForBatchJobs": {
"Type": "Wait","Seconds": 600,"Next": "CompileOutput"
},"CompileOutput": {
"Type": "Task","End": true
}
}
}
],"Catch": [
{
"ErrorEquals": [ "States.ALL" ],"Next": "NotifyError"
}
],"Next": "SendSummary"
},"SendSummary": {
"Type": "Task","End": true
},"NotifyError": {
"Type": "Task","End": true
}
}}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)