将任务划分为 aws step 函数,然后在全部完成后加入它们
Dividing tasks into aws step functions and then join them back when all completed
我们有一个 AWS step 函数可以处理 csv 文件。这些 CSV 文件记录可以是 1 到 4000 之间的任何内容。
现在,我想创建另一个 内部 AWS 步骤函数 来处理这些 csv 记录。问题是对于每条记录我都需要打另一个 API 并且为此我希望异步执行所有记录。
例如 - 收到的 CSV 有 2500 条记录
步骤函数调用另一个步骤函数 2500 次(另一个步骤函数将 CSV 记录作为输入)处理它,然后将结果存储在 Dynamo 或任何其他地方。
我已经了解了 aws step 函数中的回调模式,但在我的例子中,我将传递 2500 个标记,我希望外部 step 函数处理它们当所有 2500 条记录都完成处理时.
所以我的问题是这可能使用 AWS 步进函数。
如果您知道任何文章或指南供我参考,那就太好了。
提前致谢
听起来 dynamic parallelism 可行:
To configure a Map state, you define an Iterator, which is a complete sub-workflow. When a Step Functions execution enters a Map state, it will iterate over a JSON array in the state input. For each item, the Map state will execute one sub-workflow, potentially in parallel. When all sub-workflow executions complete, the Map state will return an array containing the output for each item processed by the Iterator.
这使所有流程都在单个 Step Function 中,并允许更轻松的可追溯性。
限制因素是可用的并发量 (docs):
Concurrent iterations may be limited. When this occurs, some iterations will not begin until previous iterations have completed. The likelihood of this occurring increases when your input array has more than 40 items.
这里要注意的另一件事是成本。您将很容易地通过免费套餐并开始产生实际成本 (link)。
我们有一个 AWS step 函数可以处理 csv 文件。这些 CSV 文件记录可以是 1 到 4000 之间的任何内容。
现在,我想创建另一个 内部 AWS 步骤函数 来处理这些 csv 记录。问题是对于每条记录我都需要打另一个 API 并且为此我希望异步执行所有记录。
例如 - 收到的 CSV 有 2500 条记录 步骤函数调用另一个步骤函数 2500 次(另一个步骤函数将 CSV 记录作为输入)处理它,然后将结果存储在 Dynamo 或任何其他地方。
我已经了解了 aws step 函数中的回调模式,但在我的例子中,我将传递 2500 个标记,我希望外部 step 函数处理它们当所有 2500 条记录都完成处理时.
所以我的问题是这可能使用 AWS 步进函数。 如果您知道任何文章或指南供我参考,那就太好了。
提前致谢
听起来 dynamic parallelism 可行:
To configure a Map state, you define an Iterator, which is a complete sub-workflow. When a Step Functions execution enters a Map state, it will iterate over a JSON array in the state input. For each item, the Map state will execute one sub-workflow, potentially in parallel. When all sub-workflow executions complete, the Map state will return an array containing the output for each item processed by the Iterator.
这使所有流程都在单个 Step Function 中,并允许更轻松的可追溯性。
限制因素是可用的并发量 (docs):
Concurrent iterations may be limited. When this occurs, some iterations will not begin until previous iterations have completed. The likelihood of this occurring increases when your input array has more than 40 items.
这里要注意的另一件事是成本。您将很容易地通过免费套餐并开始产生实际成本 (link)。