-
-
Notifications
You must be signed in to change notification settings - Fork 21
Resource requirement min max validation #384
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?
Resource requirement min max validation #384
Conversation
| @@ -18131,6 +18131,14 @@ def fromDoc( | |||
| "is not valid because:", | |||
| ) | |||
| ) | |||
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.
Thank you for prototyping the validation. This file is autogenerated, so any changes here would get overwritten.
Lines 191 to 209 in 4a8390d
| cwl_utils/parser/cwl_v1_0.py: FORCE | |
| schema-salad-tool --codegen python \ | |
| --codegen-parser-info "org.w3id.cwl.v1_0" \ | |
| https://github.com/common-workflow-language/common-workflow-language/raw/codegen/v1.0/extensions.yml \ | |
| > $@ | |
| cwl_utils/parser/cwl_v1_1.py: FORCE | |
| schema-salad-tool --codegen python \ | |
| --codegen-parser-info "org.w3id.cwl.v1_1" \ | |
| https://github.com/common-workflow-language/cwl-v1.1/raw/codegen/extensions.yml \ | |
| > $@ | |
| cwl_utils/parser/cwl_v1_2.py: FORCE | |
| schema-salad-tool --codegen python \ | |
| --codegen-parser-info "org.w3id.cwl.v1_2" \ | |
| https://github.com/common-workflow-language/cwl-v1.2/raw/codegen/extensions.yml \ | |
| > $@ | |
| regen_parsers: cwl_utils/parser/cwl_v1_*.py |
Additional validation logic should be added elsewhere, perhaps cwl_utils/parser/utils.py
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.
Oh, my bad on that! I didn't see it was autogenerated, those comments were hidden on my IDE.
I will look to add this validation in cwltool only then, since you mentioned that there isn't much validation code to add in cwl-utils 🙂
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.
Is there any documentation to onboard developers?
I am also trying to understand the workflow to see where we should add that piece of logic. From what I understand:
- You define the CWL specifications in these repos: cwl 1.3, cwl 1.2, ...
- You are using schema_salad to convert the CWL specifications into python code in cwl-utils
- So cwl-utils is the repository we should use to manipulate CWL workflows in Python
- And then on top of that there is cwltool, used for the execution of CWL workflows
IIUC, checks should generally be included in the CWL specifications in JSON/YAML; But the structure would not enable the comparison of 2 attributes like minCores and maxCores for instance.
So this would need to be added in the cwl_utils/parser/utils.py module.
From here - and if my understanding has been correct so far - I am a bit confused. I don't see where these functions are used. They don't seem to appear in the generated parser files, and in cwltool I see functions with the same names but they are redefined. Example:
cwl-utils/cwl_utils/parser/utils.py
Line 35 in 4a8390d
def convert_stdstreams_to_files(process: Process) -> None: cwl-utils/cwl_utils/parser/cwl_v1_2_utils.py
Line 358 in 4a8390d
def convert_stdstreams_to_files(clt: cwl.CommandLineTool) -> None: - https://github.com/common-workflow-language/cwltool/blob/135a0c67afd67383c44e89fba136ccd9ce6afb1f/cwltool/load_tool.py#L144
Ideally I think we would love to have this min-max validation when we call load_document.
Thank you very much for you guidance
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #384 +/- ##
==========================================
+ Coverage 34.63% 34.70% +0.07%
==========================================
Files 30 30
Lines 35396 35412 +16
Branches 9538 9546 +8
==========================================
+ Hits 12259 12290 +31
+ Misses 20257 20234 -23
- Partials 2880 2888 +8 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Related to : common-workflow-language/cwltool#2163
save()function ofResourceRequirementsave()function ofResourceRequirementfromDoc()function ofResourceRequirement. I couldn't understand how to test thefromDoc()function though so tests are missing for this one. Any explanations or tips would be appreciated on that so I can add some.