有没有办法从批处理作业中检索 Step Function tasktoken?

Is there a way to retrieve the Step Function tasktoken from within a Batch job?

我正在使用 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。

谢谢!

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

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

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