gpt4 book ai didi

amazon-web-services - Retry and Catch on AWS Step Function 任务

转载 作者:行者123 更新时间:2023-12-04 17:23:23 24 4
gpt4 key购买 nike

对于 StepFunctions,我们能否让 RetryCatch 一起处理耗尽的情况?

这是我的用例

  1. 工作失败
  2. 重试
  3. 重试失败,转到 Catch
  4. 捕获所有错误,移至下一个作业,并更新数据库表以将此作业标记为失败(另一项任务)
  5. 或者在第一次运行或重试成功后,转到下一个作业
    "ExecuteMyJob": {
"Type": "Task",
"Resource": "arn:aws:states:::glue:startJobRun.sync",
"Parameters": {
"JobName.$": "$.jobName",
"Arguments.$": "$.jobArguments"
},
"Retry" : [{
"ErrorEquals": [ "States.TaskFailed", "States.Runtime" ],
"MaxAttempts": 3,
"IntervalSeconds": 60,
"BackoffRate": 2
}],
"Catch": [{
"ErrorEquals": [ "States.ALL" ],
"Next": "MarkJobFailOnDbTable"
}],
"Next": "NextJobOnPreviousSuccess"
}

最佳答案

Step Functions 让您可以同时使用 RetryCatch:

https://docs.aws.amazon.com/step-functions/latest/dg/concepts-error-handling.html

该链接中的复杂重试场景示例与您的示例类似:

"X": {
"Type": "Task",
"Resource": "arn:aws:states:us-east-1:123456789012:task:X",
"Next": "Y",
"Retry": [ {
"ErrorEquals": [ "ErrorA", "ErrorB" ],
"IntervalSeconds": 1,
"BackoffRate": 2.0,
"MaxAttempts": 2
}, {
"ErrorEquals": [ "ErrorC" ],
"IntervalSeconds": 5
} ],
"Catch": [ {
"ErrorEquals": [ "States.ALL" ],
"Next": "Z"
} ]
}

关于amazon-web-services - Retry and Catch on AWS Step Function 任务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64937513/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com