gpt4 book ai didi

amazon-web-services - Step Functions - 在后面的步骤中使用旧步骤的输出(非顺序)

转载 作者:行者123 更新时间:2023-12-04 02:28:20 25 4
gpt4 key购买 nike

在一个有 3 个步骤的状态机中,步骤 3 是否可以使用步骤 1 的输出?在我的特定场景中,我有:

Task -> Map State -> Task

我特别感兴趣的是将 map 状态的输入用于其第一次迭代作为步骤 3 的输入。我也可以处理 map 状态的整个输入,但到目前为止我我不知道如何实现其中任何一个。

最佳答案

"ResultPath":"$.mapOutput" 会将 mapOutput 作为 map 输出的前缀。组合的输入和输出将作为输入发送到后续任务。

这是第 3 步的输入:

{
"Comment": "Insert your JSON here",
"inputForMap": [
"iter 1",
"iter2"
],
"mapOutput": [
"iter 1",
"iter2"
]
}

这里是完整的定义

{
"StartAt":"Dummy Step 1 Output",
"States":{
"Dummy Step 1 Output":{
"Type":"Pass",
"Result":[
"iter 1",
"iter2"
],
"ResultPath":"$.inputForMap",
"Next":"loop on map"
},
"loop on map":{
"Type":"Map",
"ResultPath":"$.mapOutput",
"Next":"Step three",
"Iterator":{
"StartAt":"Step 2 - Looping on map",
"States":{
"Step 2 - Looping on map":{
"Type":"Pass",
"End":true
}
}
},
"ItemsPath":"$.inputForMap",
"MaxConcurrency":1
},
"Step three":{
"Type":"Pass",
"Next":"End of Step Function"
},
"End of Step Function":{
"Type":"Pass",
"End":true
}
}
}

enter image description here

第三步输入: enter image description here

关于amazon-web-services - Step Functions - 在后面的步骤中使用旧步骤的输出(非顺序),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65830196/

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