-
Notifications
You must be signed in to change notification settings - Fork 54
Improve range validation and cleanup validator #7130
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
Conversation
Thanks @sam-maloney! These changes look great! An optional How do you envision this looking on the command line, i.e. the difference between specifying an exact count vs a minimum with unlimited maximum. (Sorry if you've already explained this elsewhere, I probably lost track of any discussion here) |
@grondo My initial thought would be simply allowing RFC45 strings to be used for current CLI options, e.g.
or
where in the second example it's implicit in RFC45 that the Eventually a CLI option/plugin to allow use of RFC46 strings would also be nice for testing or power users, something like
|
FWIW, Fluxion originally used defaults for all three of |
That sounds right. The fluxion code that reads from these always uses the max currently though, and somewhat relies on there being an upper bound. We can certainly make the max optional, but the effect will be that the min will become the max until we have time to work through how to handle unbounded requests. |
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.
Looks good to me on the flux-core side! Thanks @sam-maloney and @trws!
Setting MWP here. Thanks again @sam-maloney |
60ea58b
to
57ef97e
Compare
This pull request has been removed from the queue for the following reason: The merge conditions cannot be satisfied due to failing checks. You may have to fix your CI before adding the pull request to the queue again. |
Problem: complex ranges validation is not as complete as it should be Add more thorough checks of min/max/operand/operator combinations
Problem: "max" key should always be optional in complex ranges Remove the previously "invalid" jobspec from the testsuite related to "max" key being missing
Problem: several tests in validator for invalid jobpsec are not covered Add invalid inputs for the following: - invalid operator in resource count complex range - zero value for min in resource count complex range - type not int for min in resource count complex range - max < min in resource count complex range - min = 1 with "^" operator in resource count complex range - operand = 1 with "*" operator in resource count complex range - operand = 0 in resource count complex range - operator not a single char in resource count complex range - resource count negative for resource not in ["node", "slot", "core"] - resource type not a string - version = 0
Problem: t/jobspec/invalid/resource_slot_with_zero.yaml is a duplicate of t/jobspec/invalid/resource_count_is_zero.yaml Remove the duplicate jobspec
Problem: message for wrong 'attributes' type incorrectly says 'count' and message for resource counts being > 0 omits 'core' Change 'count' to 'attributes' and add 'core' to list of resource types in respective error messages
Problem: validation of required keys is inconsistent; "resources" and "tasks" are required positional arguments to the constructors, while "attributes" and "version" are kwargs, which require additional checks. Make "attributes" and "version" also positional arguments, with a default value for "version" in the JobspecV1 constructor so it remains optional there. This greatly simplifies the validation of these mandatory top-level keys, and improves consistency.
57ef97e
to
6b136a9
Compare
Approving reviews have been dismissed because this pull request
was updated.
@Mergifyio requeue |
✅ The queue state of this pull request has been cleaned. It can be re-embarked automatically |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #7130 +/- ##
=======================================
Coverage 83.85% 83.86%
=======================================
Files 551 551
Lines 93303 93304 +1
=======================================
+ Hits 78241 78250 +9
+ Misses 15062 15054 -8
🚀 New features to boost your workflow:
|
This PR adds more thorough checks for
min
/max
/operand
/operator
combinations for resource count complex ranges, accompanied by new/modified "invalid" jobspec examples to match the validation and increase cover. The penultimate commit clarifies some "typos" in error messages, and the final commit simplifies the validation of required top-level keys using positional arguments in the class constructors (feel free to revert this if you disagree, it just felt much cleaner when I was examining how everything was implemented).One point that merits attention is that I have made the
max
key always optional in the complex range; this disagrees with with the current RFC14 (and my earlier change in flux-framework/rfc#444) but after implementing the count infrastructure and the range string spec in RFC45 it seems clear to me that themax
key should always be optional to indicate an unbounded/infinite/give_me_everything_you_got request, without the user or CLI tools having to otherwise insert an arbitrary large number whenever a non-defaultoperand
/operator
combination is used. If this seems sensible to others I am of course happy to tweak RFC14 to match (and I suppose also update my changes from flux-framework/flux-sched#1341)