【问题标题】:Is there a way to retrieve the Step Function tasktoken from within a Batch job?有没有办法从批处理作业中检索 Step Function 任务令牌?
【发布时间】:2019-08-16 00:08:00
【问题描述】:

我正在使用 AWS Batch 与 AWS Step Functions 的集成 - https://docs.aws.amazon.com/step-functions/latest/dg/connectors-batch.html

批处理作业定义采用从 Step Function 传入的参数,并使用这些参数调用容器上的 python 脚本。

在容器上运行的这个 python 脚本中是否有办法提取 Step Function taskToken 以便我可以更新状态并将任务成功 JSON 发送回调用 Step Function (https://docs.aws.amazon.com/step-functions/latest/apireference/API_SendTaskSuccess.html ) 以后在流程中使用?

目前似乎没有任何其他方法可以将批处理作业的结果返回到 StepFunctions。

谢谢!

【问题讨论】:

  • 我一直在寻找与 AWS Batch 和 AWS Step Functions 类似的功能,但没有找到任何方法。到目前为止的结论:(1) 无法在 AWS Batch 或 AWS Step Functions 中控制 AWS Batch 输出,(2) 无法在两个 AWS Batch 作业之间传递一个信息,(3) 无法在两个 AWS 之间共享唯一 ID在 AWS Step Functions 中运行的批处理作业。

标签: boto3 aws-step-functions aws-batch


【解决方案1】:

实际上有一种方法可以通过将任务令牌作为环境变量传递给容器并从 process.env 中选择它。

"ContainerOverrides":
  {
    "Environment":
      [
        { "Name": "TASK_TOKEN", "Value.$": "$$.Task.Token" },
      ]
  }

您的环境变量TASK_TOKEN 将在容器内具有正确的值。

【讨论】:

    猜你喜欢
    • 2021-06-10
    • 1970-01-01
    • 1970-01-01
    • 2021-08-28
    • 2022-07-08
    • 1970-01-01
    • 1970-01-01
    • 2021-08-29
    • 1970-01-01
    相关资源
    最近更新 更多