Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/performance improvements #398

Merged
merged 8 commits into from Apr 1, 2024
Merged

Conversation

essweine
Copy link
Contributor

@essweine essweine commented Mar 29, 2024

This PR

  • 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.

@jbirddog jbirddog merged commit 25dafe9 into main Apr 1, 2024
5 checks passed
@jbirddog jbirddog deleted the feature/performance-improvements branch April 1, 2024 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Workflow gets bogged down when a task has too many children
2 participants