-
-
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
WIP fix #1330 #1566
base: main
Are you sure you want to change the base?
WIP fix #1330 #1566
Conversation
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.
@manabuishii impressive work tracking down where you had to add the state/job info 👏
I think what this change is doing is making the job info from the parent Job available to children Jobs. Not sure if there's any downsides to this.
Maybe another approach could be to modify Process#evalResources
and rewrite the Resource value, evaluating the expression to 4
. This way when children Job are created they wouldn't have to try to resolve the variables/values.
cwltool/workflow_job.py
Outdated
@@ -386,6 +386,8 @@ def object_from_state( | |||
incomplete: bool = False, | |||
) -> Optional[CWLObjectType]: | |||
inputobj = {} # type: CWLObjectType | |||
for s in state.keys(): | |||
inputobj[s] = state[s].value |
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.
I think we can avoid accessing keys & values separately. Something like:
for k, v in state.items():
inputobj[k] = v
Or start inputobj
by deep-cloning state
.
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.
Current commited version is
https://github.com/common-workflow-language/cwltool/pull/1566/files#diff-ed87d61e2237460638e7f3ddb21bafc9969d8c142c804d79f94801142342f3d6R389-R391
My local version is following .
It handles 1330 well and pass py39-unit
But I can not pass py39-mypy
for s in state.keys():
if hasattr(state[s], "value"):
inputobj[s] = state[s].value
Now I try to replace it to your code, because it looks good.
But I can not pass py39-mypy
for k,v in state.items():
if type(v) is WorkflowStateItem:
if hasattr(v, "value"):
inputobj[k] = v.value
currently
Hmm, interesting. Tried that, but realized that 🤷♂️ there must be a good reason for doing so, so I think your approach should be the right fix @manabuishii 👍 let's see what's wrong with the build... |
@manabuishii Can you fix the merge conflict so that the CI can run? |
Codecov Report
@@ Coverage Diff @@
## main #1566 +/- ##
==========================================
+ Coverage 66.82% 66.84% +0.02%
==========================================
Files 93 93
Lines 16578 16784 +206
Branches 4404 4447 +43
==========================================
+ Hits 11078 11220 +142
- Misses 4361 4396 +35
- Partials 1139 1168 +29
Continue to review full report at Codecov.
|
Getting closer to a green build! 🚀 |
@manabuishii the commit will be squashed when we merge the PR (it has 6 commits, ideally a single commit is best, or grouped commits if they are helpful for future devs.) Or if you prefer to edit the commit now and change the author, you can use interactive rebase or amend (if the last commit), e.g. https://stackoverflow.com/a/3042512 |
@kinow Thanks !! |
@kinow @mr-c
Is this correct ?
In my linux machine, above command is take long time. I want to fix the error which GitHub Actions says. |
You can run just the test that failed
Note that this test should fail: https://github.com/common-workflow-language/common-workflow-language/blob/a62f91e3d75036e7d89dbd454fc4e1f72caf901f/v1.0/conformance_test_v1.0.yaml#L1863 So if this PR causes this to not fail, then that is a problem 🙂 |
My current strategy is such that I make everything a global variable, so Therefore, the
Essentialy , I think So this is the reason why I need to change strategy. |
Memo: |
@mr-c I think this PullRequest fix #1330. Now I want to check that there is no unwanted behavior . I want to ask questions related to Question 1: What kind of output is expected for
class: Workflow
cwlVersion: v1.1
inputs:
inp1:
type: string
default: hello inp1
inp2:
type: string
default: hello inp2
outputs:
out:
type: string
outputSource: step1/out
steps:
step1:
in:
in: inp1
in2: inp2
out: [out]
run: fail-unspecified-input-expressiontool.cwl and
cwlVersion: v1.0
class: ExpressionTool
requirements:
InlineJavascriptRequirement: {}
inputs:
in:
type: string
outputs:
out:
type: string
expression: |
${
return {"out": inputs.in +" "+inputs.in2};
} Both Is this result correct ? python3 -m cwltool fail-unconnected-expressiontool.cwl
INFO /home/manabu/ghq/github.com/common-workflow-language/cwltool/cwltool/__main__.py 3.1.20220325085616
INFO Resolved 'fail-unconnected-expressiontool.cwl' to 'file:///home/manabu/ghq/github.com/common-workflow-language/cwltool/fail-unconnected-expressiontool.cwl'
WARNING Workflow checker warning:
fail-unconnected-expressiontool.cwl:18:7: 'in2' is not an input parameter of
file:///home/manabu/ghq/github.com/common-workflow-language/cwltool/fail-unspecified-input-expressiontool.cwl,
expected in
INFO [workflow ] start
INFO [workflow ] starting step step1
INFO [step step1] start
INFO [step step1] completed success
INFO [workflow ] completed success
{
"out": "hello inp1 undefined"
}
INFO Final process status is success As WARNING messages indicates , When Question2: What kind of output is expected for |
I guess the both cases must fail. The spec of WorkflowStep.in says:
But |
|
||
- job: tests/empty.json | ||
tool: tests/fail-unconnected-expressiontool.cwl | ||
label: wf_step_access_undeclared_param_expressiontool | ||
id: 198 | ||
doc: >- | ||
Test that parameters that don't appear in the `run` process | ||
inputs are not present in the input object used to run the expressiontool. | ||
should_fail: true | ||
tags: [ required, workflow ] | ||
|
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.
The CI doesn't run this copy of the tests, it makes a new checkout from GitHub
Line 41 in 7a058fe
wget "https://github.com/common-workflow-language/${repo}/archive/${spec_branch}.tar.gz" |
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.
@mr-c Thanks
I will create a PullRequest about this test case (tests/fail-unconnected-expressiontool.cwl),
Repo:
https://github.com/common-workflow-language/cwl-v1.2
Branch:
1.2.1_proposed
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.
Thanks, you can also keep it in this PR, just move the test scripts to the the test directory and add an entry to test_examples.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.
Can you move this file to the tests
directory, or a sub-directory?
Original PullRequest common-workflow-language/cwltool#1566 Original Issue common-workflow-language/cwltool#1330
Original PullRequest common-workflow-language/cwltool#1566 Original Issue common-workflow-language/cwltool#1330
It is not passed parameters which is not pass to ExpressionTool
I improve This does not cause error. First, currently
I think this is expected behavior for following Just before fn is following. '"use strict";
var inputs = {
"in": "hello inp1"
};
var self = null;
var runtime = {
"cores": 1,
"ram": 1024,
"tmpdirSize": 1024,
"outdirSize": 1024,
"tmpdir": null,
"outdir": null
};
(function(){
return {"out": inputs.in +" "+inputs.in2};
})()' function executed, Output is here $ python3 -m cwltool tests/fail-unconnected-expressiontool.cwl
INFO /Users/manabu/ghq/github.com/common-workflow-language/cwltool/cwltool/__main__.py 3.1.20211111031309
INFO Resolved 'tests/fail-unconnected-expressiontool.cwl' to 'file:///Users/manabu/ghq/github.com/common-workflow-language/cwltool/tests/fail-unconnected-expressiontool.cwl'
WARNING Workflow checker warning:
tests/fail-unconnected-expressiontool.cwl:18:7: 'in2' is not an input parameter of
file:///Users/manabu/ghq/github.com/common-workflow-language/cwltool/tests/fail-unspecified-input-expressiontool.cwl,
expected in
INFO [workflow ] start
INFO [workflow ] starting step step1
INFO [step step1] start
INFO [step step1] completed success
INFO [workflow ] completed success
{
"out": "hello inp1 undefined"
}
INFO Final process status is success I investigate related JS behavior. When
I think that |
Until previous commit 14a2ded so output is following. $ python3 -m cwltool tests/fail-unconnected-expressiontool.cwl
INFO /Users/manabu/ghq/github.com/common-workflow-language/cwltool/cwltool/__main__.py 3.1.20211111031309
INFO Resolved 'tests/fail-unconnected-expressiontool.cwl' to 'file:///Users/manabu/ghq/github.com/common-workflow-language/cwltool/tests/fail-unconnected-expressiontool.cwl'
WARNING Workflow checker warning:
tests/fail-unconnected-expressiontool.cwl:18:7: 'in2' is not an input parameter of
file:///Users/manabu/ghq/github.com/common-workflow-language/cwltool/tests/fail-unspecified-input-expressiontool.cwl,
expected in
INFO [workflow ] start
INFO [workflow ] starting step step1
INFO [step step1] start
INFO [step step1] completed success
INFO [workflow ] completed success
{
"out": "hello inp1 hello inp2"
}
INFO Final process status is success |
I think current this PR approach is Lazy evaluation. How do you think ? |
I haven't dug really deep in the issue as @manabuishii , but from what I could see, I also think that eager evaluation in this case would be better for As for specification, I think we can leave it as-is, or maybe add a comment that eager or lazy evaluation is up to implementers, but not enforced by the specification. |
@kinow Thanks !!
I consider about multi cloud situation (including on-premise cloud and some on-premise cluster) sometimes lazy evaluations require variable or file which is not accessible from some environment. To consider such a situation , I think we keep discuss and investigate about pros, cons and reasonable assumption. One more option is that spec said nothing but implementation is accept variable about eager or lazy evaluation. But I want to fix #1330 😄 |
I agree with @kinow that we leave the spec as is (at least in v1.2.0) because clarifying the evaluation strategy may break existing platforms. I prefer the eager strategy by default because it makes much easier to implement platforms. |
Original PullRequest common-workflow-language/cwltool#1566 Original Issue common-workflow-language/cwltool#1330
Original PullRequest common-workflow-language/cwltool#1566 Original Issue common-workflow-language/cwltool#1330
Original PullRequest common-workflow-language/cwltool#1566 Original Issue common-workflow-language/cwltool#1330
Original PullRequest common-workflow-language/cwltool#1566 Original Issue common-workflow-language/cwltool#1330
#1330
At least workflow-dyn-res.cwl does not create error.
But this PR fail some tests.
Strategy
( I think below, but need to know more about inside)
To resolve ResourceRequirement value,
First,
I bring Workflow inputs to steps inputs,( see TODO )
Second,
When
evalResources
is called, resource resolved.Third,
After the call, CommandLineTool's inputs are rewrite to remove inputs for ResourceRequirement.
TODO:
evalResources
are exists or not .evalResources
.cwltool/cwltool/process.py
Lines 973 to 974 in 898fddf