当前设置:
我目前有一个 Step Functions 状态机,它启动一个任务状态(它调用一个 Lambda 函数),然后是一个映射状态(它向 Batch 提交一个作业),定义如下
状态机定义
(注:地区和账户ID已被省略并替换为虚拟变量ACCOUNT_INFO
)
{
"StartAt": "Populate EFS",
"States": {
"Populate EFS": {
"Next": "MapState",
"Type": "Task",
"InputPath": "$",
"ResultPath": "$.populate_efs_result",
"Resource": "arn:aws:states:::lambda:invoke",
"Parameters": {
"FunctionName": "arn:aws:lambda:{ACCOUNT_INFO}:function:PopulateEFSLambda",
"Payload.$": "$"
}
},
"MapState": {
"Type": "Map",
"End": true,
"ResultPath": "$.metadata.run_info",
"InputPath": "$",
"Iterator": {
"StartAt": "TaskState",
"States": {
"TaskState": {
"Type": "Task",
"End": true,
"InputPath": "$",
"ResultPath": null,
"Resource": "arn:aws:states:::batch:submitJob.sync",
"Parameters": {
"JobDefinition": "arn:aws:batch:{ACCOUNT_INFO}:job-definition/BatchJobDefCfn:1",
"JobName": "test",
"JobQueue": "arn:aws:batch:{ACCOUNT_INFO}:job-queue/BatchQueue123",
"ContainerOverrides": {
"Command": [
"sh",
"-c",
"entrypoint.pl -i /NGS/${sequencer}/${run_id}/ -s ${sample_name}"
],
"Environment": [
{
"Name": "run_id",
"Value.$": "$.run_id"
},
{
"Name": "sample_name",
"Value.$": "$.sample_name"
},
{
"Name": "sequencer",
"Value.$": "$.sequencer"
}
]
}
}
}
}
}
}
}
}
状态机输入
{
"metadata": {
"run_info": [
{
"sample_name": "SAMPLE_X",
"sequencer": "Nextseq"
},
{
"sample_name": "SAMPLE_Y",
"sequencer": "Nextseq"
},
{
"sample_name": "SAMPLE_Z",
"sequencer": "Nextseq"
}
]
}
}
Lambda 输出(为简单起见缩短)
{"populate_efs_result": {
"ExecutedVersion": "$LATEST",
"Payload": "RUN_1"}
预期结果:
第二步 ( MapState
) 需要来自机器输入 (sample_name
和sequencer
) 的信息,以及 Lambda 函数在populate_efs_result.Payload
( run_id
) 中返回的信息,因此两者都需要包含在 Map 状态输入的事件对象中。然而,到目前为止,在我的尝试中,地图状态的输入要么是机器输入,要么是 Lambda 输出,而不是两者。
我已尝试更改 Map 状态定义中的InputPath
和ItemsPath
参数,还尝试在 Map 状态定义中包含以下内容,但这些方法均不起作用:Parameters: {"new_run_id.$": "$.populate_efs_result.Payload"}
.