makes some improvements to the BPMN task iterator (namely not descending into completed subprocesses to look for unfinished tasks)
changes the behavior of the end_at_spec argument to get_tasks such that it checks all branches rather than stopping at the first instance
transitions subworkflow tasks to STARTED instead of WAITING while they are running to prevent repeatedly checking whether they have finished
improves the readability of the code in Join task spec of the core spec module
completely reimplements how joins are handled in the BPMN module
The impetus for these improvements were workflow getting bogged down when large numbers of branches are active at once. The main bottleneck turned out to be repeatedly updating waiting joins. When a merge point is reached on any branch, the task transitions to waiting until enough branches complete. Every time any task completes, all waiting tasks in workflow are re-checked to see if they've become runnable.
So what I've done is maintain only the most recently completed task in a waiting state and preemptively cancelled the others incrementally rather than cancelling all but one when the gateway threshold is finally reached. This is where the bulk of the improvment comes from. But not constantly updating waiting subprocesses also helps.
Additionally, checking whether the subprocess is finished involves finding the subprocess, so that should alleviate some runtime errors regarding the size of the dictionary where they're maintained changing as well.
In one example, processing time went from 11 seconds to 5 seconds. We are seeing huge improvements for some processes.
This PR
end_at_spec
argument toget_tasks
such that it checks all branches rather than stopping at the first instanceSTARTED
instead ofWAITING
while they are running to prevent repeatedly checking whether they have finishedJoin
task spec of the core spec moduleThe impetus for these improvements were workflow getting bogged down when large numbers of branches are active at once. The main bottleneck turned out to be repeatedly updating waiting joins. When a merge point is reached on any branch, the task transitions to waiting until enough branches complete. Every time any task completes, all waiting tasks in workflow are re-checked to see if they've become runnable.
So what I've done is maintain only the most recently completed task in a waiting state and preemptively cancelled the others incrementally rather than cancelling all but one when the gateway threshold is finally reached. This is where the bulk of the improvment comes from. But not constantly updating waiting subprocesses also helps.
Additionally, checking whether the subprocess is finished involves finding the subprocess, so that should alleviate some runtime errors regarding the size of the dictionary where they're maintained changing as well.
In one example, processing time went from 11 seconds to 5 seconds. We are seeing huge improvements for some processes.