简体   繁体   English

MaxConcurrency 属性如何适用于 AWS Step Functions 中的 Map 任务?

[英]How does the MaxConcurrency attribute work for the Map Task in AWS Step Functions?

Update: Creating a step function from the Map State step template and running that also throws an error.更新:Map State步骤模板创建步骤 function 并运行也会引发错误。 This is strong evidence that the MaxConcurrency attribute together with the Parameters value is not working.这是MaxConcurrency属性和Parameters值不起作用的有力证据。

I am not able to use the MaxConcurrency attribute successfully in the step function definition.我无法在步骤 function 定义中成功使用MaxConcurrency属性。

This can be demonstrated by using the example provided in the documentation for the Map Task (new as of 18 sept 2019):这可以通过使用 Map 任务文档中提供的示例(自 2019 年 9 月 18 日起新增)来演示:

{
  "StartAt": "ExampleMapState",
  "States": {
    "ExampleMapState": {
      "Type": "Map",
      "MaxConcurrency": 2,
      "Parameters": {
        "ContextIndex.$": "$$.Map.Item.Index",
        "ContextValue.$": "$$.Map.Item.Value"
      },
      "Iterator": {
         "StartAt": "TestPass",
         "States": {
           "TestPass": {
             "Type": "Pass",    
             "End": true
           }
         }
      },
      "End": true
    }
  }
}

By executing the step function with the following input:通过使用以下输入执行步骤 function:

[
  {
    "who": "bob"
  },
  {
    "who": "meg"
  },
  {
    "who": "joe"
  }
]

We can observe in the Execution event history that we get:我们可以在我们得到的Execution 事件历史记录中观察到:

  • ExecutionStarted
  • MapStateEntered
  • MapStateStarted
  • MapIterationStarted (index 0) MapIterationStarted (索引 0)
  • MapIterationStarted (index 1) MapIterationStarted (索引 1)
  • PassStateEntered (index 0) PassStateEntered (索引 0)
  • PassStateExited (index 0) PassStateExited (索引 0)
  • MapIterationSucceeded (index 0) MapIterationSucceeded (索引 0)
  • ExecutionFailed

The step function fails.步骤 function 失败。 The ExecutionFailed step has the following output (execution id omitted): ExecutionFailed步骤具有以下 output(省略执行 ID):

{
  "error": "States.Runtime",
  "cause": "Internal Error (omitted)"
}

Trying to catch the error with a Catch step has no effect.尝试使用 Catch 步骤捕获错误无效。

What am I doing wrong here?我在这里做错了什么? Is this a bug?这是一个错误吗?

Response to a private ticket submitted to AWS this morning;对今天早上提交给 AWS 的私人票据的回应;

Thank you for contacting AWS Premium Support.感谢您联系 AWS 高级支持。 My name is Akanksha and I will be assisting you with this case.我的名字是 Akanksha,我将协助您处理此案。

I understand that you have been working with the new Map state feature of step functions and have noticed that when we use Parameters along with MaxConcurrency set to lower value than the number of iterations (with only first iteration successful) it fails with 'States.Runtime' and looks like a bug with the functionality.我了解您一直在使用新的 Map state 功能的阶跃函数,并注意到当我们使用参数以及将 MaxConcurrency 设置为低于迭代次数的值(只有第一次迭代成功)时,它会因“States.Runtime”而失败' 并且看起来像功能的错误。

Thank you for providing the details.感谢您提供详细信息。 It helped me during troubleshooting.它在故障排除期间帮助了我。 In order to confirm the behavior, I used the below state machine example with Pass:为了确认行为,我使用了下面的 state 机器示例和 Pass:

{ "StartAt": "Map State", "TimeoutSeconds": 3600, "States": { "Map State": { "Type": "Map”, "Parameters": { “ContextValue.$”: "$$.Map.Item.Value" }, "MaxConcurrency": 1, "Iterator": { "StartAt": "Run Task", "States": { "Run Task": { "Type": "Pass", "End": true } } }, "Next": "Final State" }, "Final State": { "Type": "Pass", "End": true } } } { "StartAt": "Map State", "TimeoutSeconds": 3600, "States": { "Map State": { "Type": "Map", "Parameters": { "ContextValue.$": "$$. Map.Item.Value" }, "MaxConcurrency": 1, "Iterator": { "StartAt": "Run Task", "States": { "Run Task": { "Type": "Pass", "End" : true } } }, "Next": "Final State" }, "Final State": { "Type": "Pass", "End": true } } }

I tested with multiple input lists and MaxConcurrency values and below are my observations:我使用多个输入列表和 MaxConcurrency 值进行了测试,以下是我的观察结果:

  1. Input size list: 4 MaxConcurrency:1/2/3 - Fails and MaxConcurrency:0/4/5 or above - Works输入大小列表:4 MaxConcurrency:1/2/3 - 失败和 MaxConcurrency:0/4/5 或以上 - 有效
  2. Input size list: 3 MaxConcurrency: 1/2 - Fails and MaxConcurrency:0/3/4 or above - Works输入大小列表:3 MaxConcurrency:1/2 - 失败和 MaxConcurrency:0/3/4 或以上 - 有效
  3. Similarly, I performed tests by removing the parameters from state machine as well and could see that it works as expected with different MaxConcurrency values.同样,我也通过从 state 机器中删除参数来执行测试,并且可以看到它在不同的 MaxConcurrency 值下按预期工作。
  4. I also tested the same by changing the Task type of “Pass” with “Lambda” and observed the same behavior.我还通过将“Pass”的任务类型更改为“Lambda”进行了测试,并观察到了相同的行为。

Hence, I can confirm that the state machine fails when we have parameters in the code and specify MaxConcurrency value as anything other than zero or the number greater than or equal to the list size.因此,我可以确认 state 机器在代码中有参数并将 MaxConcurrency 值指定为非零或大于或等于列表大小的数字时失败。

After doing some research regarding this behavior to check if this is intended, I could not find much information regarding the same as this is a new feature.在对这种行为进行了一些研究以检查这是否是有意的之后,我找不到太多关于此行为的信息,因为这是一项新功能。 So, I will be reaching out to the internal team with all the details and the example state machine that you have provided.因此,我将与您提供的所有详细信息和示例 state 机器联系内部团队。 Thank you for bringing this to our notice.感谢您通知我们。 I will get back to you as soon as I have an update from the internal team.收到内部团队的最新消息后,我会尽快与您联系。 Please be assured that I will regularly follow up with the team and work with them to investigate further.请放心,我会定期跟进团队并与他们合作进一步调查。

Meanwhile, if you have any other queries or concerns, please do let me know.同时,如果您有任何其他疑问或疑虑,请告诉我。

Have a great day ahead!祝您有美好的一天!

I will update here when I get more information.当我得到更多信息时,我会在这里更新。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM