fission / fission-workflows

Workflows for Fission: Fast, reliable and lightweight function composition for serverless functions
Apache License 2.0
361 stars 40 forks source link

Nested foreach fails at runtime, but validation succeeds #246

Open sebastianrosch opened 5 years ago

sebastianrosch commented 5 years ago

I have a workflow with a nested foreach. The workflow passes validation, the following call does not return any output:

fission wf validate nested.wf.yaml

Creating the workflow works:

fission fn create --name nested --env workflow --src nested.wf.yaml

When running the workflow with

curl ${FISSION_ROUTER}/fission-function/nested

it fails with input 'do' is not a validType type (expected: [fission.workflows.types.TaskSpec], was: string)

Are nested foreach supported? Or is there something wrong with my workflow definition?

nested.wf.yaml:

apiVersion: 1
output: Iterate
tasks:

  # Builds a list of details
  BuildObjects:
    run: foreach
    inputs:
      foreach: ["test","test2","test3"]
      do:
        run: compose
        inputs:
          parentInvocationId: "{$.Invocation.Id}"
          name: "task().element"
          resources: ["r1","r2"]

  # Iterates over all objects and their resources
  Iterate:
    run: foreach
    inputs:
      foreach: "{$.Tasks.BuildObjects.Output}"
      do:
        run: foreach
        inputs:
          foreach: "{task().Inputs._item.resources}"
          do:
            run: nop
            inputs: "{ task().element }"
    requires:
      - BuildObjects

$ fission --version
client:
  fission/core:
    gitcommit: ee988f5a8b423926056f64bc64b5a8ed516a7261
    builddate: 2019-02-08T12:57:56Z
    version: "1.0"
  workflows:
    gitcommit: ""
    builddate: ""
    version: 0.6.0
server:
  fission/core:
    gitcommit: ee988f5a8b423926056f64bc64b5a8ed516a7261
    builddate: 2019-02-08T12:57:56Z
    version: "1.0"
erwinvaneyk commented 5 years ago

Hi @sebastianroesch - nested foreach-es should work. However, foreach is really a prototype feature right now, so this might be a bug. I will look into it.

erwinvaneyk commented 5 years ago

Seems related to #196