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

plugin: initialize factor weights on plugin load #458

Merged
merged 1 commit into from
Jun 7, 2024

Conversation

cmoussa1
Copy link
Member

@cmoussa1 cmoussa1 commented Jun 6, 2024

Problem

Mentioned as possible cleanup in #455, the weight of each factor is checked every time the priority of a job is calculated. It would be cleaner to put this check somewhere else so it does not need to be repeated for every job.


This PR creates defaults for the weights of each factor used in the priority calculation of a job and initializes each weight when the plugin is first loaded. In the callback for conf.update, it then checks to see if these weights have been configured; if not, it will just continue to use the defaults defined at the top of the file.

@cmoussa1 cmoussa1 added improvement Upgrades to an already existing feature plugin related to the multi-factor priority plugin labels Jun 6, 2024
@cmoussa1 cmoussa1 requested a review from grondo June 6, 2024 20:57
Copy link
Contributor

@grondo grondo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great! Just one very minor comment.

Comment on lines 204 to 205
if (fshare_weight != -1) priority_weights["fairshare"] = fshare_weight;
if (queue_weight != -1) priority_weights["queue"] = queue_weight;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find single line conditionals a little hard to read, I'd suggest breaking these into two lines for readability.
I see we didn't comment on this earlier so this is just a suggestion not required.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem - I think that's perfectly reasonable. I'll push up a fix to break these up into two lines. 👍

Problem: The weight of each factor is checked every time the priority of
a job is calculated. It would be cleaner to put this check somewhere
else so it does not need to be repeated.

Create defaults for the weights of each factor used in the priority
calculation of a job. Initialize each weight when the plugin is loaded.
In the callback for conf.update, check to see if these weights have been
configured; if not, continue to use the defaults defined at the top of
the file.
@cmoussa1 cmoussa1 force-pushed the move.factor.init branch from 932c6d1 to 9c2ed1c Compare June 7, 2024 15:19
@cmoussa1
Copy link
Member Author

cmoussa1 commented Jun 7, 2024

Thanks for reviewing @grondo! I'll set MWP here

@mergify mergify bot merged commit 2aaf033 into flux-framework:master Jun 7, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Upgrades to an already existing feature merge-when-passing plugin related to the multi-factor priority plugin
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants