Workflow Execution Graph

On invocation of a workflow execution, the workflow definition is translated and expanded into an execution graph. Tasks is represented as nodes and the transition (i.e. on-success, on-error, etc.) between tasks as edges with YAQL expression in the graph. The workflow engine will use the execution graph at runtime to determine which set of task(s) to run. The graph will store task states and will mark the edges that have been evaluated.

There are a number of problems that the execution graph will solve.
1) Minimize the number of database queries that the engine has to make to determine the next set of tasks. Thus reduce the DB transaction time and minimizing the risk of deadlocking.
2) Able to address a workflow use case which current implementation cannot do accurately (i.e. where a non join task is referenced by multiple tasks) .
3) Add an API endpoint to get the execution graph for visualization in the UI. This will minimize the number of DB queries required to get the same set of information if this graph isn't available.