Global workflow context

Registered by Renat Akhmerov

This blueprint has been superseded. See the newer blueprint "Advanced publishing: global vars" for updated plans.

We need to implement a global context for Mistral workflows. Currently 'publish' keyword in Mistral saves variables into a storage which are associated only with a branch.

Example:

my_wf:
  tasks:
    A:
      action: std.noop
      publish:
        my_var: 1
      on-success: A1

    A1:
      action: my_action param1=<% $.my_var %>

    B:
      action: std.noop
      publish:
        my_var: 2
      on-success: B1

    B1:
      action: my_action param1=<% $.my_var %>

The expression "$.my_var" in the declaration of A1 will always evaluate to 1, for B1 will always evaluate to 2. This doesn't depend on order in which A and B will run. This is because we have two branches (A -> A1 and B -> B1) for which the variable "my_var" has its own different version.

Sometimes though we need to be able to pass data between branches. The concept of workflow global context can help solve this problem. A simple use case for this may be the following situation: one branch needs to notify the other one that it needs to stop.

Blueprint information

Status:
Complete
Approver:
Renat Akhmerov
Priority:
High
Drafter:
Renat Akhmerov
Direction:
Approved
Assignee:
Renat Akhmerov
Definition:
Superseded
Series goal:
Accepted for pike
Implementation:
Implemented
Milestone target:
None
Started by
Renat Akhmerov
Completed by
Renat Akhmerov

Related branches

Sprints

Whiteboard

Gerrit topic: https://review.openstack.org/#q,topic:bp/mistral-global-wf-context,n,z

Addressed by: https://review.openstack.org/441093
    Rename package 'workbook' to 'lang'

Addressed by: https://review.openstack.org/441851
    WF global ctx: add "publish-global" into direct workflow task spec

Addressed by: https://review.openstack.org/442334
    WF global context: Implement global publishing using wf_ex.context

Addressed by: https://review.openstack.org/442360
    WF global context: add function global() to access global vars

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.