fission / fission-workflows

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

Support forward dependency definitions #27

Open erwinvaneyk opened 7 years ago

erwinvaneyk commented 7 years ago

Currently workflows are defined using a backward dependencies. For example:

myTask:
  ...
  requires:
    otherDepTask1: ~
    otherDepTask2: ~

While provides more self-contained tasks, for simple use cases it might be more straightforward to allow for forward dependencies.

myTask:
  ...
  on-complete:
  - nextTask1
  - nextTask2

On the backend the dependencies should resolve similarly: a task waits for all dependencies, whether specified forward or backward, to resolve. dependencyAwait allows tasks to wait for only a part of their dependencies. However, with the constraint that individual tasks can only be invoked once, this means that you can only create discriminators not 'multiple instances' (see http://workflowpatterns.com/).

Similar to Openstack's mistral, we can support both. The user should be able to specify which type of dependency definition they want to use.

apiVersion: v1
dependencies: forward|backward
tasks:
  ...

The default, though open for discussion, would be backward.