1

将 Step Function 的部分输入发送到批处理作业的正确方法是什么?

我尝试使用 Parameters.ContainerOverrides.Environment 设置和环境变量,如下所示:

"Parameters": {
    "ContainerOverrides": {
      "Environment": [
        {
          "Name": "PARAM_1",
          "Value": "$.param_1"
        }

阶跃函数输入如下所示:

{
  "param_1": "value-goes-here"
}

但是批处理作业最终会在 PARAM_1 环境变量中使用文字“$.param_1”来调用。

4

3 回答 3

2

固定的。Value 键只需要“.$”后缀。

"Parameters": {
 "ContainerOverrides": {
  "Environment": [
    {
      "Name": "PARAM_1",
      "Value.$": "$.param_1"
    }
于 2019-02-28T15:50:40.687 回答
1

将其传递给“参数”(在父“参数”中)。请注意所有参数值都是字符串

"MyStepTask": {
    "Type": "Task",
    "Resource": "arn:aws:states:::batch:submitJob.sync",
    "Parameters": {
      "JobDefinition": "myjobdef",
      "JobName": "myjobname",
      "JobQueue": "myjobqueue",
      "Parameters": { "p_param1":"101",
                      "p_param2":"201"
      }
    },
    "Next": "MyNextStepTask"
}
于 2019-06-17T01:06:52.820 回答
0

If you're wanting to pass parameters to Batch add the Parameters section to the parent Parameters section (not great naming!)

    "MyStepTask": {
        "Type": "Task",
        "Resource": "arn:aws:states:::batch:submitJob.sync",
        "Parameters": {
          "JobDefinition": "myjobdef",
          "JobName": "myjobname",
          "JobQueue": "myjobqueue",
          "Parameters": {
              "Name": "PARAM_1",
              "Value.$": "$.param_1"
          }
        },
        "Next": "MyNextStepTask"
    }
于 2019-03-25T15:49:08.577 回答