[openstack-dev] [Mistral] Access to worklfow/task results without implicit publish

Dmitri Zimine dzimine at stackstorm.com
Tue Dec 23 01:26:06 UTC 2014


The problem:

Refer to workflow / action output without explicitly re-publishing the output values. Why we want it: to reduce repetition, and to make modifications in the place values are used, not where they are obtained (and not in multiple places). E.g., as an editor of a workflow, when I just realized that I need a value of some task down the line, I want to make change right here in the tasks that consumes the data (and only those which need this data), without finding and modifying the task that supplies the data.

Reasons:

We don't have a concept of workflow or action ‘results': it's the task which produces and publishes results. Different tasks call same actions/workflows, produce same output variables with diff values. We don't want to publish this output with output name as a key, to the global context: they will conflict and mess up. Instead, we can namespace them by the task (as specific values are the attributes of the tasks, and we want to refer to tasks, not actions/workflows).

Solution:

To refer the output of a particular task (aka raw result of action execution invoked by this task), use the_task prefix:

 $_task.<taskname>.<path.to.variable>
 $_task.my_task.my_task_result.foo.bar


Expanded example
 
my_sublfow:
   output:
        - foo # << declare output here
        - bar 
   tasks:
       my_task:
         action: get_foo
         publish: 
             foo: $foo # << define output in a task
             bar: $bar
         ...
main_flow_with_explicit_publishing:
    tasks:
        t1: 
           workflow: my_subflow 
        publish: 
           # Today, you must explicitly publish to make data 
           # from action available for other tasks
            foo: $foo # << re-plublish, else you can't use it
            bar: $bar
        t2: 
            action: echo output="$foo and $bar" # << use it from task t1

main_flow_with_implicit_publishing:
    tasks:
        t1: 
           workflow: my_subflow 
        t2: 
            action: echo output="$_task.t1.foo and $_task.t1.bar"

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20141222/c9ef4822/attachment.html>


More information about the OpenStack-dev mailing list