步骤功能-在后续步骤中使用较旧步骤的输出(非顺序) [英] Step Functions - Use output from older step in later step (non-sequential)
问题描述
在具有3个步骤的状态机中,步骤3是否可以使用步骤1的输出?在我的特定情况下,我有:
In a state machine with 3 steps, is it possible for step 3 to use the output of step 1? In my specific scenario I have:
Task -> Map State -> Task
我特别感兴趣的是将地图状态的第一次迭代输入用作步骤3的输入.我也可以将整个输入处理到地图状态,但到目前为止我没有看到如何实现这两个目标.
where I'm specifically interested in using the Map State's input for its first iteration as the input for Step 3. I could handle the entire input to the map state as well, but so far I'm not seeing how to achieve either of these.
推荐答案
"ResultPath":" $.mapOutput"
将 mapOutput
前缀添加到地图输出中.并将组合的输入和输出作为输入发送到下一个任务.
"ResultPath":"$.mapOutput"
will prefix mapOutput
to output of the map. and combined input and output will be send as input to following task.
这是输入到步骤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
}
}
}
第三步输入:
这篇关于步骤功能-在后续步骤中使用较旧步骤的输出(非顺序)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!