runabol / piper

piper - a distributed workflow engine
Apache License 2.0
489 stars 86 forks source link

Add the output of forked branches in the context #38

Closed ccamel closed 4 years ago

ccamel commented 5 years ago

The PR collects the outputs of all executed tasks within a fork task and put them in the context. By doing this, the workflow described in #31 works fine:

tasks:
  - type: fork
    label: afork
    branches:
        - - name: adapter1
            label: Web Service Call
            type: adapter1
        - - name: adapter2
            label: Web Service Call
            type: adapter2

  - type: checkAdapterResults
    name: checkAdapterResults
    label: Checking Adapter Results
    adapter1: ${afork.adapter1}
    adapter2: ${afork.adapter2}

However, I dont't know if this behaviour is desirable, or if it is wise to do so. @creactiviti I let you decide what to do. :wink:

runabol commented 5 years ago

@ccamel interesting concept. But im worried about two things here:

  1. Conflicts in context of branches output with parent pipeline.
  2. Conflicts in context between the 2 (or more) branches.

It seems to require a more explicit output mechanism for branches like we have for pipelines.

ccamel commented 5 years ago

@creactiviti Yes. I see your point. You are right.

So you think of adding an explicit definition of outputs at the fork?

Something like that?

tasks:
  - type: fork
    label: afork
    outputs:
      - name: adapter1
        value: ${branches[0]/adapter1}
      - name: adapter2
        value: ${branches[1]/adapter2}
    branches:
        - - name: adapter1
            label: Web Service Call
            type: adapter1
        - - name: adapter2
            label: Web Service Call
            type: adapter2

  - type: checkAdapterResults
    name: checkAdapterResults
    label: Checking Adapter Results
    adapter1: ${afork.adapter1}
    adapter2: ${afork.adapter2}