yaql function errors() to access task errors in path

Registered by Winson Chan

This was achieved by a function with a different name. See more info here: https://blueprints.launchpad.net/mistral/+spec/yaql-tasks-function

Old description:
For a WF with task-defaults to send/notify details on-error, there's no easy way in the error handler to know which task failed and failure information. Can we add a custom errors() function that returns a list of failed tasks in the WF execution path and their state_info & result?

Blueprint information

Status:
Complete
Approver:
Renat Akhmerov
Priority:
Medium
Drafter:
Winson Chan
Direction:
Needs approval
Assignee:
Michal Gershenzon
Definition:
Approved
Series goal:
Accepted for ocata
Implementation:
Implemented
Milestone target:
milestone icon ocata-2
Started by
Renat Akhmerov
Completed by
Michal Gershenzon

Related branches

Sprints

Whiteboard

I think this method should provide a list of all tasks (error can be passed as desired state).
If we will return all states, we can find another name instead of "errors" e.g tasks.

it should have a few parameters:
1. workflow-execution-id (optional) which will allow to get tasks information from a specific workflow execution as well (either the same execution or a different one), if not passed, it will list all tasks.
2. recursive (optional default False) - if true, list failed tasks for sub-workflows executions as well. relevant when passing workflow-execution-id
3. leaves (optional default False) - if true, only list the root tasks that failed, and not the tasks that were failed due to the sub-workflow-execution they executed.
4. state (optional)- get only tasks with the given state for example ERROR

The new idea also overlaps with https://blueprints.launchpad.net/mistral/+spec/mistral-workflow-executions-yaql-function

Gerrit topic: https://review.openstack.org/#q,topic:bp/yaql-tasks-function,n,z

Addressed by: https://review.openstack.org/401360
    Yaql Tasks Function

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.