<p>Argo permits the dynamic generation of parallel workflow steps based on outputs from previous steps.</p>
<p>An example of this dynamic workflow generation is provided here: <a href="https://github.com/argoproj/argo-workflows/blob/master/examples/loops-param-result.yaml" rel="nofollow noreferrer">https://github.com/argoproj/argo-workflows/blob/master/examples/loops-param-result.yaml</a></p>
<p>I'm trying to create a similar workflow with a final 'fan-in' step that will read outputs from the dynamically created parallel steps. Here's a stab at it:</p>
<pre><code>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: &quot;{{item}}&quot;
        withParam: &quot;{{steps.generate.outputs.result}}&quot;
    - - name: fan-in
        template: fan-in
        arguments:
          parameters:
          - name: numbers
            value: &quot;{{steps.write.outputs.parameters.number}}&quot;

  - 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: [&quot;echo {{inputs.parameters.number}} &gt; /tmp/number.txt&quot;]
    outputs:
      parameters:
        - name: number
          valueFrom:
            path: /tmp/number.txt

  - name: fan-in
    inputs:
      parameters:
        - name: numbers
    container:
      image: alpine:latest
      command: [sh, -c]
      args: [&quot;echo received {{inputs.parameters.numbers}}&quot;]
</code></pre>
<p>I'm able to submit this workflow, and it runs successfully. Unfortunately, the output of the final <code>fan-in</code> step looks like this:</p>
<pre><code>fan-in: received {{steps.write.outputs.parameters.number}}
</code></pre>
<p>The value for the input <code>numbers</code> parameter is not being interpolated. Any ideas about how to get this working?</p>

mpatek
<p>Aggregated step output parameters are accessible via <code>steps.STEP-NAME.outputs.parameters</code>. It's not possible to access an aggregated set of outputs for one parameter by name.</p>
<p>This slight change to your workflow should get you what you need:</p>
<pre class="lang-yaml prettyprint-override"><code>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: &quot;{{item}}&quot;
        withParam: &quot;{{steps.generate.outputs.result}}&quot;
    - - name: fan-in
        template: fan-in
        arguments:
          parameters:
          - name: numbers
            value: &quot;{{steps.write.outputs.parameters}}&quot;

  - 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: [&quot;echo {{inputs.parameters.number}} &gt; /tmp/number.txt&quot;]
    outputs:
      parameters:
        - name: number
          valueFrom:
            path: /tmp/number.txt

  - name: fan-in
    inputs:
      parameters:
        - name: numbers
    container:
      image: alpine:latest
      command: [sh, -c]
      args: [&quot;echo received {{inputs.parameters.numbers}}&quot;]
</code></pre>
<p>The only change was to remove <code>.number</code> from <code>{{steps.write.outputs.parameters.number}}</code>.</p>
<p>This is the new output:</p>
<pre><code>received [{number:20},{number:21},{number:22},{number:23},{number:24},{number:25},{number:26},{number:27},{number:28},{number:29},{number:30}]
</code></pre>
<p>Here is the <a href="https://github.com/argoproj/argo-workflows/issues/861" rel="nofollow noreferrer">GitHub issue where output parameter aggregation was discussed/created</a>.</p>
<p>I've put in an <a href="https://github.com/argoproj/argo-workflows/issues/2393" rel="nofollow noreferrer">enhancement proposal</a> for accessing aggregated output parameters by name.</p>
