Skip to content

Conversation

@Stellatsuu
Copy link

Related to : #2163

  • Added resource requirement minmax validation
  • Added validation when running --validate
  • Added related tests

Copy link
Member

@mr-c mr-c left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @Stellatsuu !

@codecov
Copy link

codecov bot commented Nov 17, 2025

Codecov Report

❌ Patch coverage is 77.77778% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 55.48%. Comparing base (135a0c6) to head (c8d7d68).

Files with missing lines Patch % Lines
cwltool/checker.py 66.66% 1 Missing and 1 partial ⚠️
cwltool/process.py 50.00% 1 Missing and 1 partial ⚠️

❗ There is a different number of reports uploaded between BASE (135a0c6) and HEAD (c8d7d68). Click for more details.

HEAD has 6 uploads less than BASE
Flag BASE (135a0c6) HEAD (c8d7d68)
17 11
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #2179       +/-   ##
===========================================
- Coverage   85.12%   55.48%   -29.65%     
===========================================
  Files          46       46               
  Lines        8368     8383       +15     
  Branches     1956     1961        +5     
===========================================
- Hits         7123     4651     -2472     
- Misses        779     3230     +2451     
- Partials      466      502       +36     

☔ 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.

Comment on lines +1847 to +1848
"file", ["tests/wf/bad_resreq_mnmx_clt.cwl", "tests/wf/bad_resreq_mnmx_wf.cwl"]
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the CWL descriptions need inputs

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was a bad copypaste of mine, I only took a workflow from the test folder and modified it, forgot about the inputs.
Since we want to focus on requirements validation, I changed both workflows to be only helloworld without inputs or outputs but with invalid requirements.

Would it work like this? Or maybe I did not understand your review.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was explaining why the tests failed :-)

tests/wf/bad_resreq_mnmx_wf.cwl still requires inputs; you need to either provide them as a separate file, or also modify that CWL description to not need inputs provided (perhaps via default values).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default inputs are required even in a workflow like this one where inputs and outputs are empty and not used?

#!/usr/bin/env cwl-runner
class: Workflow
cwlVersion: v1.2

requirements:
  ResourceRequirement:
      ramMin: 128
      ramMax: 64

inputs: []
outputs: []

steps:
  hello_world:
    requirements:
      ResourceRequirement:
        ramMin: 64
        ramMax: 128
    run:
        class: CommandLineTool
        baseCommand: [ "echo", "Hello World" ]
        inputs: [ ]
        outputs: [ ]
    out: [ ]
    in: [ ]

Copy link
Author

@Stellatsuu Stellatsuu Nov 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this be a correct workflow?

#!/usr/bin/env cwl-runner
class: Workflow
cwlVersion: v1.2

requirements:
  ResourceRequirement:
    ramMin: 128
    ramMax: 64

inputs:
  message: string?

outputs: []

steps:
  hello_world:
    requirements:
      ResourceRequirement:
        ramMin: 64
        ramMax: 128
    run:
      class: CommandLineTool
      baseCommand: echo
      inputs:
        message:
          type: string?
          default: "Hello World"
      outputs: []
      arguments:
        - $(inputs.message)
    in:
      message: message
    out: []

@Stellatsuu
Copy link
Author

Stellatsuu commented Nov 19, 2025

cwltool --disable-validate tests/wf/bad_resreq_mnmx_wf.cwl command works while it shouldn't, since the workflow resource requirement is wrong:

#!/usr/bin/env cwl-runner
class: Workflow
cwlVersion: v1.2

requirements: <-----
  ResourceRequirement:
      ramMin: 128
      ramMax: 64

inputs: []
outputs: []

steps:
  hello_world:
    requirements:
      ResourceRequirement:
        ramMin: 64
        ramMax: 128
    run:
        class: CommandLineTool
        baseCommand: [ "echo", "Hello World" ]
        inputs: [ ]
        outputs: [ ]
    out: [ ]
    in: [ ]

I looked at the code, and it seems that the main reason is that, evalResources is only called when the cwl object is not a Workflow:

def Process(...):
   def _init_job(...):
        ...
        if self.tool["class"] != "Workflow":
            builder.resources = self.evalResources(builder, runtime_context)
        return builder
   def evalResources(...):
        -validation is here-

How should I manage to check if the resource requirements of a Workflow are correct when calling --disable-validate?

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.

2 participants