flux-framework / flux-accounting

bank/accounting interface for the Flux resource manager
https://flux-framework.readthedocs.io/projects/flux-accounting/en/latest/index.html
GNU Lesser General Public License v3.0
3 stars 10 forks source link

plugin: add instance owner info to plugin #477

Closed cmoussa1 closed 3 months ago

cmoussa1 commented 3 months ago

Problem

The instance owner cannot run jobs when the priority plugin is loaded because they are not a part of the flux-accounting database. flux-accounting should be able to handle this automatically so that administrators do not have to manually add instance owner information.


This PR sends instance owner information to the priority plugin along with the rest of the flux-accounting DB information during an accounting update. It leverages Flux's handle.attr_get("security.owner") to get the uid and corresponding username of the instance owner. Once retrieved, it is sent and stored by the plugin, which will allow the instance owner to submit jobs with the plugin loaded. I set the limits values very high for the instance owner, but just gave it a default fair-share value of 0.5. I am definitely open to making this value higher, however.

I had to adjust a few of the existing sharness tests that created users with conflicting uid's as the instance owner in the testsuite, so the second commit in this PR is just some cleanup and adjusting of some of those tests to use a different uid. I also refined a couple of the tests that use jq to search for key-value pairs by first calling select() with a uid instead of manually indexing the JSON object.

Finally, I added a short set of tests that loads the plugin and and submits a job as the instance owner and makes sure it receives a priority.

Fixes #476

codecov[bot] commented 3 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 82.34%. Comparing base (283126a) to head (1374786). Report is 12 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #477 +/- ## ========================================== - Coverage 83.30% 82.34% -0.96% ========================================== Files 23 20 -3 Lines 1557 1456 -101 ========================================== - Hits 1297 1199 -98 + Misses 260 257 -3 ``` [see 2 files with indirect coverage changes](https://app.codecov.io/gh/flux-framework/flux-accounting/pull/477/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=flux-framework)
cmoussa1 commented 3 months ago

Thanks for reviewing @grondo - I'll set MWP here so I can get this landed in time for some testing