cwltool icon indicating copy to clipboard operation
cwltool copied to clipboard

Resource requirement min max validation

Open Stellatsuu opened this issue 2 months ago • 2 comments

Related to : https://github.com/common-workflow-language/cwltool/issues/2163

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

Stellatsuu avatar Nov 14 '25 12:11 Stellatsuu

Codecov Report

:x: Patch coverage is 77.77778% with 4 lines in your changes missing coverage. Please review. :white_check_mark: 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 :warning:
cwltool/process.py 50.00% 1 Missing and 1 partial :warning:

:exclamation: 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     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

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

codecov[bot] avatar Nov 17 '25 13:11 codecov[bot]

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?

Stellatsuu avatar Nov 19 '25 10:11 Stellatsuu