Skip to content

Conversation

@Stellatsuu
Copy link

Related to : common-workflow-language/cwltool#2163

  • Added a minmax check in save() function of ResourceRequirement
  • Added tests related to save() function of ResourceRequirement
  • Added a minmax check in fromDoc() function of ResourceRequirement. I couldn't understand how to test the fromDoc() function though so tests are missing for this one. Any explanations or tips would be appreciated on that so I can add some.

@@ -18131,6 +18131,14 @@ def fromDoc(
"is not valid because:",
)
)
Copy link
Member

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.

https://github.com/common-workflow-language/cwl-utils/blob/4a8390d897913c3776a0d2b2a01e1e6134b968bc/cwl_utils/parser/cwl_v1_2.py#L2

cwl-utils/Makefile

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

Copy link
Author

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 🙂

Copy link

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:

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
Copy link

codecov bot commented Nov 15, 2025

Codecov Report

❌ Patch coverage is 43.75000% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 34.70%. Comparing base (4a8390d) to head (18635e6).

Files with missing lines Patch % Lines
cwl_utils/parser/cwl_v1_2.py 43.75% 4 Missing and 5 partials ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants