如何将步进功能输入传递给批处理作业

时间:2019-02-28 14:47:56

标签: amazon-web-services aws-step-functions aws-batch

将步进功能的部分输入发送到批处理作业的正确方法是什么?

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

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

Step函数输入如下:

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

但是批处理作业最终只是在PARAM_1 env变量中被立即数“ $ .param_1”调用。

3 个答案:

答案 0 :(得分:0)

已修复。值键只需要后缀“。$”。

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

答案 1 :(得分:0)

如果要将参数传递给批处理,请将“参数”部分添加到父“参数”部分(不好用!)

WITH Tally(Nmbr) AS 
(
    SELECT TOP(LEN(@str)) ROW_NUMBER() OVER(ORDER BY (SELECT NULL)) FROM master..spt_values
)
SELECT @str=STUFF(@str,Nmbr,0,' ')
FROM Tally
ORDER BY Nmbr DESC;

SELECT @str;

答案 2 :(得分:0)

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

"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"
}