gpt4 book ai didi

amazon-web-services - AWS Step Functions - 将输入传递给另一个任务

转载 作者:行者123 更新时间:2023-12-03 15:44:01 27 4
gpt4 key购买 nike

如何在 task 中将我的输入传递给我的输出在 AWS Step Functions 中?

我知道 this question ,以及文档:

If the value of ResultPath is null, that means that the state’s own raw output is discarded and its raw input becomes its result.



但我需要的是:
  • 鉴于我的意见
  • {
    "input": "my_input"
    }
  • 还有我的 lambda 输出
  • {
    "output": "my_output"
    }

    我需要将以下 json 传递给下一个状态:
    {
    "input": "my_input",
    "output": "my_output"
    }

    最佳答案

    我想到了两个建议,要么Use ResultPath to Replace the Input with the Result ,这使您可以

    If you don't specify a ResultPath, the default behavior is as if you had specified "ResultPath": "$". Because this tells the state to replace the entire input with the result, the state input is completely replaced by the result coming from the task result.



    要使此选项起作用,Lambda 函数必须返回所需的响应:
    {
    "input": "my_input",
    "output": "my_output"
    }

    或者 Use ResultPath to Include the Result with the Input在 Step Functions 开发人员指南中。接下来,如果您将 Lambda 的返回值更改为仅包含 "my_output"您可以指定 "ResultPath": "$.output"达到预期的结果:
    {
    "input": "my_input",
    "output": "my_output"
    }

    关于amazon-web-services - AWS Step Functions - 将输入传递给另一个任务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58345667/

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