Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.