-
Notifications
You must be signed in to change notification settings - Fork 49
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
python: allow resource count of 0 in Jobspec v1 #4259
Merged
Merged
Conversation
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
Problem: The yaml jobspec invalid/resource_slot_with_zero.yaml actually sets the value of the 'core' resource count to zero, not the slot resource. Move the 0 count to the 'slot' definition instead of 'core'.
Problem: Jobspec v1 doesn't require that resources have a count greater than zero, but the Jobspec Python class raises an exception if this is so. This is inconvenient for users that want to do things like jobspec templating, since the resource entry must be removed instead of simply zeroed. Allow a count of 0 for resources other than "node", "slot", or "core", since zero for these specific resource types doesn't (currently) make any sense. Fixes flux-framework#3275
I force-pushed an update that reduces the changes here:
Also added a test to ensure a |
Problem: The Python jobspec v1 class allows a count of 0 for resources that aren't node, slot or core, but the jobspec1 C API rejects a jobspec with any resource count of 0 as invalid. Allow gpu resources specifically to have a count of 0 since this is the only resource supported by the jobspec1 class besides node, slot and core.
Problem: The Python and libjob jobspec1 implementations both have been relaxed to allow a count of 0 for some resource types, but the schemas in src/modules/job-ingest/schemas fail to validate newly allowed jobspec. Update the jobspec jsonschema to allow a count 1 of resources other than "node", "slot", and "core" to match the other jobspec validators in flux-core.
Problem: Detection of an invalid core count in jobspec is not currently exercised in jobspec validation testing. Add a jobspec with a 0 core count to t/jobspec/invalid_v1.
Problem: No test verifies that a v1 jobspec with a gpu count of 0 is accepted as valid, but a gpu count of -1 is rejected as invalid. Add a jobspec with 0 gpu count to t/jobspec/valid_v1, and a jobspec with a -1 gpu count to t/jobspec/invalid_v1.
Codecov Report
@@ Coverage Diff @@
## master #4259 +/- ##
==========================================
- Coverage 83.55% 83.55% -0.01%
==========================================
Files 388 388
Lines 64993 64998 +5
==========================================
+ Hits 54307 54310 +3
- Misses 10686 10688 +2
|
garlick
approved these changes
Apr 3, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Thanks! Setting MWP. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
When going through old issues I noticed #3275, which seemed like a reasonable and easy fix.
This change allows a count of 0 for core and gpu resources (not sure if core is all that useful, but this addresses the main point of the issue)