来自内部 Step Function 的过滤结果
Filter result from inner Step Function
我有一个启动另一个 Step Function 的 Step Function。
内步函数的输出没问题,正是我想要的
这里是触发外步函数的代码:
{
"StartAt": "MySF",
"States": {
"Textract": {
"Type": "Task",
"OutputPath": "$",
"Resource": "arn:aws:states:::states:startExecution.sync:2",
"Parameters": {
"Input": {
"input.$": "$$.Execution.Input"
},
"StateMachineArn": "inner_step_function_arn"
},
"End": true
}
},
"TimeoutSeconds": 3600
}
如果我查看外步函数,内步函数的结果比我需要的多得多,它基本上是该次执行的元数据,如下所示:
{
"ExecutionArn": "inner_step_function_arn"
"Input": {
"input": {
the output that I need
}
},
"InputDetails": {
"Included": true
},
"Name": "xxx",
"Output": {
the output that I need
},
"OutputDetails": {
"Included": true
},
"StartDate": 1637923353831,
"StateMachineArn": "inner_step_function_arn,
"Status": "SUCCEEDED",
"StopDate": 1637923386955
}
所以我的问题是如何只得到 "input"
节点内的结果。
有没有办法只过滤输入?
谢谢。
您可以使用ResultSelector仅从外步函数中过滤出所需的结果。它允许选择您需要的字段。
您的 SF 定义应如下所示:
{
"StartAt": "MySF",
"States": {
"Textract": {
"Type": "Task",
"OutputPath": "$",
"Resource": "arn:aws:states:::states:startExecution.sync:2",
"Parameters": {
"Input": {
"input.$": "$$.Execution.Input"
},
"StateMachineArn": "inner_step_function_arn"
},
"ResultSelector": {
"Output.$": "$.Output"
},
"End": true
}
},
"TimeoutSeconds": 3600
}
我有一个启动另一个 Step Function 的 Step Function。
内步函数的输出没问题,正是我想要的
这里是触发外步函数的代码:
{
"StartAt": "MySF",
"States": {
"Textract": {
"Type": "Task",
"OutputPath": "$",
"Resource": "arn:aws:states:::states:startExecution.sync:2",
"Parameters": {
"Input": {
"input.$": "$$.Execution.Input"
},
"StateMachineArn": "inner_step_function_arn"
},
"End": true
}
},
"TimeoutSeconds": 3600
}
如果我查看外步函数,内步函数的结果比我需要的多得多,它基本上是该次执行的元数据,如下所示:
{
"ExecutionArn": "inner_step_function_arn"
"Input": {
"input": {
the output that I need
}
},
"InputDetails": {
"Included": true
},
"Name": "xxx",
"Output": {
the output that I need
},
"OutputDetails": {
"Included": true
},
"StartDate": 1637923353831,
"StateMachineArn": "inner_step_function_arn,
"Status": "SUCCEEDED",
"StopDate": 1637923386955
}
所以我的问题是如何只得到 "input"
节点内的结果。
有没有办法只过滤输入?
谢谢。
您可以使用ResultSelector仅从外步函数中过滤出所需的结果。它允许选择您需要的字段。 您的 SF 定义应如下所示:
{
"StartAt": "MySF",
"States": {
"Textract": {
"Type": "Task",
"OutputPath": "$",
"Resource": "arn:aws:states:::states:startExecution.sync:2",
"Parameters": {
"Input": {
"input.$": "$$.Execution.Input"
},
"StateMachineArn": "inner_step_function_arn"
},
"ResultSelector": {
"Output.$": "$.Output"
},
"End": true
}
},
"TimeoutSeconds": 3600
}