-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
plugin: enforce running jobs limit per-queue
Problem: The priority plugin has no way of enforcing a max running jobs limit for an association on a per-queue basis. Add a new member to the Association class: queue_held_jobs, a hash map of key-value pairs where the key is the name of the queue the held job is supposed to run under and the value is a vector of job IDs. Add a helper function, max_run_jobs_per_queue (), to fetch the max number of running jobs for an association in a queue. In the callback for job.state.depend, add a check for the number of currently running jobs an association has in a queue compared to the limit of running jobs a queue can have. If they are equal, add a dependency to the currently submitted job to hold it until a currently running job finishes. Push back the held job ID onto the vector of held jobs and store it in the Association object. In the callback for job.state.inactive, add a check for the release of any held jobs in a queue for an association *after* a currently running job in that queue completes. If the association is now under that limit, grab the first job ID in the held jobs queue and remove the dependency from it. Remove that job ID from the vector that holds IDs of held jobs for that queue.
- Loading branch information
Showing
4 changed files
with
95 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters