-
Notifications
You must be signed in to change notification settings - Fork 54
validator: validate resource count strings #7052
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
base: master
Are you sure you want to change the base?
validator: validate resource count strings #7052
Conversation
5a17689
to
85af1d2
Compare
My only suggestion/question was if we could use
I do realize after writing the above that this would suppress the specific error raised by Not a big deal, but thought I'd bring up the question first. |
85af1d2
to
ba62438
Compare
@grondo I must admit my main reason for using regex was because So here's an alternative solution which directly models the (old solution backed up here: https://github.com/sam-maloney/flux-core/tree/validate-resource-count-strings-backup) |
Oh yeah, sorry. I meant to either do something exactly like what you did (or write a decode method in python that raises an error on failure). Sorry I should have been more clear! |
This is great! The only issue is that Let me see how easy it would be to export the count API from libjob so we can keep this simpler approach. If not, we could fall back to your first proposal for now. |
Ok, doing this properly would probably require moving So there are a couple ways forward:
Not sure if @garlick has an opinion about the export of the |
ba62438
to
afd592d
Compare
40e05dd
to
a228b0d
Compare
Problem: changes to RFC14 now allow a resource count to be a string containing either an RFC22 idset or RFC45 range Update the Python Jobspec class to properly validate string counts
Problem: none of the current valid jobspecs use a resource count string Add use_case_1.8.yaml from RFC14, resource_count_string_min_only.yaml, and valid/resource_count_string_range.yaml to the testsuite valid jobspecs
a228b0d
to
cab62f4
Compare
Alright, I'm a lot less comfortable with how exactly the python bindings should be "properly" exposed, so for now I'll stick to modifying the "simpler" previous approach. (2nd attempt in branch at https://github.com/sam-maloney/flux-core/tree/validate-resource-count-strings-bindings) This is regex free, uses the As an aside, is the main reason for avoiding regex because of performance or because they are impenetrable to read later? |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #7052 +/- ##
==========================================
- Coverage 84.10% 84.08% -0.02%
==========================================
Files 549 549
Lines 92490 92513 +23
==========================================
+ Hits 77785 77787 +2
- Misses 14705 14726 +21
🚀 New features to boost your workflow:
|
I was thinking the latter :-). Also, the approach we've mostly taken elsewhere in the Python code is use |
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.
@sam-maloney: this version looks good to me if you're happy with it. Thanks!
@grondo I'm happy if you're happy! |
Problem: changes to RFC14 now allow a resource count to be a string containing either an RFC22 idset or RFC45 range
Update the Python Jobspec class to properly validate string counts