plugin: add node count tracking for an association's running jobs #442
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.
Background
The priority plugin has no way to track the number of nodes an association is using across all of their running jobs.
This PR looks to add basic node count tracking to the priority plugin, specifically in the callbacks for
job.state.run
andjob.state.inactive
.Two new helper functions are added to the plugin to help do this -
extract_nodelist ()
andprocess_nodelist ()
.extract_nodelist ()
will look for the"nodelist"
key-value pair andprocess_nodelist ()
will take that string and use flux-core's hostlist library to count the number of nodes. Then, thecur_nodes
count for the association is incremented by the number of nodes returning byprocess_nodelist ()
. A similar process is followed in thejob.state.inactive
callback where the number of nodes returned byprocess_nodelist ()
is decremented from the association's total current nodes count.A basic set of tests are also added to simulate submitting a couple of different-sized jobs and ensuring that the priority plugin can accurately keep track of them as they are submitted and finish running.
Note that this PR does not look to add actual enforcement of an association's
max_nodes
limit, but rather just looks to track thecur_nodes
number for an association. Once this looks good, I can create a follow-up PR that tries to add the actual enforcement of a node count limit.