-
-
Notifications
You must be signed in to change notification settings - Fork 231
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
Evaluate requirements and hints using the correct input reference #1703
base: main
Are you sure you want to change the base?
Conversation
722e66d
to
2e75cff
Compare
Codecov Report
@@ Coverage Diff @@
## main #1703 +/- ##
===========================================
- Coverage 66.58% 54.68% -11.90%
===========================================
Files 89 45 -44
Lines 15850 7965 -7885
Branches 4188 2066 -2122
===========================================
- Hits 10553 4356 -6197
+ Misses 4207 3086 -1121
+ Partials 1090 523 -567 Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
This comment was marked as outdated.
This comment was marked as outdated.
Conformance tests fixed locally, mypy and linter passing too. Pushed a new commit, waiting for CI. I think mypy failed on GH, but I'm hoping it's just a glitch (otherwise my environment might be using an older version?) |
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.
Unit & conformance tests passing 🎉
Mypy passes locally, but for some reason is failing on GH (maybe some usage limits on the server side?)
File "/opt/hostedtoolcache/Python/3.6.15/x64/lib/python3.6/subprocess.py", line 311, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['docker', 'pull', 'docker.io/ubuntu']' returned non-zero exit status 1.
ERROR cwltool:test_relocate.py:17 Workflow error, try again with --debug for more information:
Docker is not available for this tool, try --no-container to disable Docker, or install a user space Docker replacement like uDocker with --user-space-docker-cmd.: Command '['docker', 'pull', 'docker.io/ubuntu']' returned non-zero exit status 1.
Will try to add the tests from #1566, but I believe it's ready for a review—even though I'm not sure if this is the best fix, but we can iterate and improve it as needed 👍
I tested it with a workflow 1330.cwl
:
cwlVersion: v1.2
class: Workflow
hints:
InlineJavascriptRequirement: {}
ResourceRequirement:
coresMax: $(inputs.threads_max)
inputs:
threads_max:
type: int
default: 4
steps:
one:
in: []
run:
class: CommandLineTool
inputs:
other_input:
type: int
default: 8
baseCommand: echo
arguments: [ $(runtime.cores) ]
outputs: []
out: []
outputs: []
-Bruno
From today's APAC-EMEA meeting:
|
It does! 🎉 I thought I would have to modify I tested with the following (possible good candidates for conformance tests): 1330-wf.cwl cwlVersion: v1.2
class: Workflow
hints:
ResourceRequirement:
coresMax: $(inputs.threads_max)
inputs:
threads_max:
type: int
default: 4
steps:
one:
in: []
run:
class: CommandLineTool
inputs:
other_input:
type: int
default: 8
baseCommand: echo
arguments: [ $(runtime.cores) ]
outputs: []
out: []
outputs: [] 1330-cmdtool.cwl cwlVersion: v1.2
class: CommandLineTool
hints:
ResourceRequirement:
coresMax: $(inputs.threads_max)
inputs:
threads_max:
type: int
default: 4
outputs: []
arguments: ['echo', $(runtime.cores)] 1330-expr.cwl cwlVersion: v1.2
class: ExpressionTool
requirements:
InlineJavascriptRequirement: {}
hints:
ResourceRequirement:
coresMax: $(inputs.threads_max)
inputs:
threads_max:
type: int
default: 4
outputs:
out: string
expression: |
${ return {"out": runtime.cores }} Using the default job order, and providing -Bruno |
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.
Great to see CI passing!
Please add local copies of the suggested conformance tests that did not previously pass, and use pytest to confirm that they now pass.
I would like @tetron to review this before merging
df93a68
to
d89fd84
Compare
This comment was marked as outdated.
This comment was marked as outdated.
Rebased, and re-worded the commit that said eager, to say: “Evaluate hints and resources at the workflow level, using the correct inputs.”. The docs and functions were updated in code and tests, to say “earlier” rather than “eagerly” 👍 |
I was fixing the @mr-c, your suggestion to use I am evaluating the I think the proper fix would have to allow the correct The only blocker to making this change, is that the logic to evaluate requirements resides in cwltool/cwltool/command_line_tool.py Line 1196 in 0e2ced5
workflow.py or workflow_job.py without duplicating code. Maybe these could be moved to a separate function.
Moving it back to draft. |
for hint_or_requirement in hints_or_requirements: | ||
for key, value in hint_or_requirement.items(): | ||
if key in requirements_or_hints_to_evaluate: | ||
hint_or_requirement[key] = expression.do_eval( |
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.
Ah, now I see the challenge you uncovered. This is evaluating CWL expressions in every key (but not sub-key) of every requirement/hint. Not only is it missing nested fields that should be evaluated, it is evaluating fields that should NOT be evaluated! Only fields where Expression
appears in the type definition are to be evaluated.
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.
Exactly. I was happy and sad at the same time when I realized that 🤣 Happy we found it before it was merged, sad (in a good nerdy-way!) that it doesn't seem to be an easy fix.
Review of CWL requirement/hint fields that can contain CWL expressions (inspired by the incomplete list at https://www.commonwl.org/user_guide/13-expressions/index.html ) CWL v1.0
CWL v1.1Same as v1.0 plus
CWL v1.2Same as v1.1 plus
|
Thanks! It's not hard to review the existing code and confirm these rules/cases match, or if there are any missing. I think the hard part is figuring out a way to re-use that in another context (when evaluating the workflow or workflow steps). Will have a go after the user guide, but happy if anyone beats me to it. |
Similar to #1566, with a tentative fix for the infamous #1330 🤠
Letting CI run to see what breaks after the fix, before adding tests or making further changes. If CI looks OK, and tests (new/old) pass, then it: