AWS Step and Batch 动态命令
Posted
技术标签:
【中文标题】AWS Step and Batch 动态命令【英文标题】:AWS Step and Batch Dynamic Command 【发布时间】:2020-03-15 11:46:50 【问题描述】:我有一个批处理作业,其中包含一个作业定义,根据环境命令选项上的参数执行。
原始值为"--param2=XXX"
,但我需要根据 Step Functions 的输入参数将其设为动态。
"param2": "--param2=YYY"
我无法将 Step Function 中的值替换为输入值
"Step1":
"Type": "Task",
"Resource": "arn:aws:states:::batch:submitJob.sync",
"Parameters":
"JobDefinition": "arn:aws:batch:us-east-2:zzzzzzzzz:job-definition/XXXXXX",
"JobQueue": "arn:aws:batch:us-east-2:zzzzzzzz:job-queue/YYYYYY",
"JobName": "Step1",
"ContainerOverrides":
"Environment": [
"Name": "envparam",
"Value": "0"
],
"Command": [
"python",
"run.py",
"--param=val",
"$.param2"
]
,
"Next": "Step2"
【问题讨论】:
【参考方案1】:我找到了一个将参数添加到 Batch 的解决方案,并使用 Ref::Param2
引用它
这是完整的代码
"Step1":
"Type": "Task",
"Resource": "arn:aws:states:::batch:submitJob.sync",
"Parameters":
"JobDefinition": "arn:aws:batch:us-east-2:zzzzzzzzz:job-definition/XXXXXX",
"JobQueue": "arn:aws:batch:us-east-2:zzzzzzzz:job-queue/YYYYYY",
"JobName": "Step1",
"Parameters":
"Param2.$": "$.param2"
,
"ContainerOverrides":
"Environment": [
"Name": "envparam",
"Value": "0"
],
"Command": [
"python",
"run.py",
"--param=val",
"Ref::Param2"
]
,
"Next": "Step2"
【讨论】:
您知道仅使用 Step Functions 的任何方法吗?Parameters
不适用于 Step Functions。以上是关于AWS Step and Batch 动态命令的主要内容,如果未能解决你的问题,请参考以下文章
Build step 'Execute Windows batch command' marked build as failure
Powershell AWS 自动化管理- ELB and Auto Scaling
带有 JobParameters 的 Spring Batch SQL 命令
在 ubuntu 中安装 AWS elasticbeanstalk 命令行工具:error The 'awsebcli==3.10.0' distribution was not found and