-
Notifications
You must be signed in to change notification settings - Fork 4
Resource requirements validation #40
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: main
Are you sure you want to change the base?
Conversation
|
@Stellatsuu PRs and/or issues to |
|
Hi @mr-c, |
…cognitive complexity
…p from possible class cwl_object values
|
Thank you @Stellatsuu ! The overall looks good to me. I have a remark on the testing part. We can probably do something more concise here without adding that many cwl files. Here is a suggestion which could be extended: This is more easily extendable, and it also allows to test the RequirementValidator separately of the job submission. What do you think? |
@natthan-pigoux Thanks, I hadn't thought of that, but it definitely seems like a better approach! I was already realizing that there were a lot of files... I forgot I could test it this way, so I'll give it a try and see if we can apply these tests to cover all cases 😄 |
| def validate_minmax(min_value, max_value, resource, context): | ||
| """ | ||
| Check if the resource min_value is higher than the resource max_value. | ||
| If so, raise a ValueError. | ||
| :param min_value: The current resource min_value. | ||
| :param max_value: The current resource max_value. | ||
| :param resource: The resource name. | ||
| :param context: A context string describing the validation context. | ||
| Ex: "Step requirement", "Global requirement", etc. | ||
| """ | ||
| if min_value and max_value and min_value > max_value: | ||
| raise ValueError(f"{resource}Min is higher than {resource}Max in {context}") |
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.
We now know that this should be part of cwl itself.
By the way, now that I am seeing that, I think we should include it to cwl-utils and not cwltool (or may be both).
In this way, this minmax test would be performed when we use save in the Production/Transformation/JobSubmissionModel.
Do you see what I mean?
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.
I added a minmax check in cwl-utils : common-workflow-language/cwl-utils@addfebb
When saving a Workflow or CLT with save(), it triggers an error if min > max, I also added a test for that.
But, this will only check the minmax values of a same ResourceRequirement (ex: Workflow RR, Step RR, CLT RR, etc.). I don't think we can check that a Step RR values are not higher than a 'global' Workflow RR values using cwl-utils, I don't really see how to do it right now.
Also, I don't really know how to test the fromDoc() method, so I added the check without any test..
Do you think I should also look to add it to cwltool ? @aldbr
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.
I don't think we can check that a Step RR values are not higher than a 'global' Workflow RR values using
cwl-utils
If there is a step-level ResourceRequirement in requirements, then any ResourceRequirement under the workflow-level hints or requirements would be ignored in CWL v1.0-v1.3; so such a check is unnecessarily and non-sensical
|
@aldbr Here's an update for now : I removed my Validator classes and added everything into
As for the implementation in |
|
Open |
I tried to run "bad" jobs with
cwltooland it seems that it does not check for conflicts or higher requirements than expected in ResourceRequirement.So, I've come to this code to validate ResourceRequirements in workflows, related to #27. I tried to make something generic in case we need to implement other Requirements in the future?
However, I'm not entirely sure if this matches with how we want to implement things in the proto, so I'd appreciate any feedback or suggestions.