Reputation: 3133
Here's some part of my StepFunction:
Here's the workflow for the "Parallel" node:
{
"Type": "Parallel",
"Branches": [
{
"StartAt": "InvokeEndpoint01",
"States": {
"InvokeEndpoint01": {
"Type": "Task",
"End": true,
"Parameters": {
"Body": "$.Input",
"EndpointName": "dummy-endpoint-name1"
},
"Resource": "arn:aws:states:::aws-sdk:sagemakerruntime:invokeEndpoint"
}
}
},
{
"StartAt": "InvokeEndpoint02",
"States": {
"InvokeEndpoint02": {
"Type": "Task",
"End": true,
"Parameters": {
"Body": "$.Input",
"EndpointName": "dummy-endpoint-name2"
},
"Resource": "arn:aws:states:::aws-sdk:sagemakerruntime:invokeEndpoint"
}
}
}
],
"Next": "Lambda Invoke"
},
I would like to access the EndpointName
of each node inside this Parallel block and add it as one of the keys of that particular node's output, without modifying the existing output's body and other headers.(in the above json, EndpointName
can be found for first node inside the Parallel at $.Branches[0].States.InvokeEndpoint01.Parameters.EndpointName
)
Here's output of one of the node inside the Parallel block:
{
"Body": "{xxxx}",
"ContentType": "application/json",
"InvokedProductionVariant": "xxxx"
}
and I would like to access the API Parameter and make it something like below:
{
"Body": "{xxxx}",
"ContentType": "application/json",
"InvokedProductionVariant": "xxxx",
"EndpointName": "dummy-endpoint-name1"
}
How do I do this?
Upvotes: 0
Views: 208
Reputation: 195
you may add "ResultPath": "$.taskresult" parameter to your tasks inside parallel state and also add endpoint names inside your input data ($.Input). in this way you can access both output data and input data as input to your final Lambda function.
here original docs: https://docs.aws.amazon.com/step-functions/latest/dg/input-output-resultpath.html
Upvotes: 1