Argo 允许基于先前步骤的输出动态生成并行工作流步骤。
此处提供了此动态工作流生成的示例:https ://github.com/argoproj/argo-workflows/blob/master/examples/loops-param-result.yaml
我正在尝试使用最终的“扇入”步骤创建一个类似的工作流程,该步骤将从动态创建的并行步骤中读取输出。这是一个尝试:
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: loops-param-result-
spec:
entrypoint: loop-param-result-example
templates:
- name: loop-param-result-example
steps:
- - name: generate
template: gen-number-list
- - name: write
template: output-number
arguments:
parameters:
- name: number
value: "{{item}}"
withParam: "{{steps.generate.outputs.result}}"
- - name: fan-in
template: fan-in
arguments:
parameters:
- name: numbers
value: "{{steps.write.outputs.parameters.number}}"
- name: gen-number-list
script:
image: python:alpine3.6
command: [python]
source: |
import json
import sys
json.dump([i for i in range(20, 31)], sys.stdout)
- name: output-number
inputs:
parameters:
- name: number
container:
image: alpine:latest
command: [sh, -c]
args: ["echo {{inputs.parameters.number}} > /tmp/number.txt"]
outputs:
parameters:
- name: number
valueFrom:
path: /tmp/number.txt
- name: fan-in
inputs:
parameters:
- name: numbers
container:
image: alpine:latest
command: [sh, -c]
args: ["echo received {{inputs.parameters.numbers}}"]
我能够提交此工作流程,并且它运行成功。不幸的是,最后fan-in
一步的输出如下所示:
fan-in: received {{steps.write.outputs.parameters.number}}
输入numbers
参数的值没有被插值。关于如何使它工作的任何想法?