Skip to content

is Step Function Inline Map states Output array ordering consistent with input Items ordering?

0

If I iterate over an input array with indexes: [1, 2, 3, 4, 5]

Will the inline map state always produce output in the same order event with MaxConcurrency set to 40?: [1, 2, 3, 4, 5]

Or due to the concurrency could the output be inconsistently ordered, like?: [2, 5, 3, 4, 1]

asked a year ago331 views

1 Answer
1

The output array ordering of a Step Functions Inline Map state is consistent with the input Items ordering, regardless of the MaxConcurrency setting.

When you use an Inline Map state to iterate over an input array with indexes [1, 2, 3, 4, 5], the output will always maintain the same order: [1, 2, 3, 4, 5]. This ordering is preserved even if you set MaxConcurrency to 40 or any other value.

The MaxConcurrency parameter controls how many iterations can run in parallel, but it does not affect the order of the results in the output array. Step Functions ensures that the output maintains the same sequence as the input, regardless of the execution order of individual iterations.

It's important to note that while the iterations may execute concurrently, Step Functions keeps track of the original order and assembles the final output array accordingly. This means you can rely on the output array having the same order as your input array, which is particularly useful when the order of processing is significant for your workflow.

So, in your example, you would not see an inconsistently ordered output like [2, 5, 3, 4, 1], even with concurrent execution. The Inline Map state guarantees that the output order matches the input order, providing predictability and consistency in your workflow results.
Sources
Using Map state in Inline mode in Step Functions workflows - AWS Step Functions
Map workflow state - AWS Step Functions

answered a year ago

  • Is this explicitly documented? The docs you referenced do not confirm if order is consistent.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.