Comments (7)
@drjrm3 Here is a workaround, as self
is correctly set inside a scatter
ed valueFrom
:
inner.cwl
#!/usr/bin/env cwl-tool
cwlVersion: v1.0
class: Workflow
requirements:
StepInputExpressionRequirement: {}
ScatterFeatureRequirement: {}
inputs:
input_files: File[]
steps:
foo:
run: foo.cwl
scatter: [ input_file, output_filename ]
scatterMethod: dotproduct
in:
input_file: input_files
output_filename:
source: input_files
valueFrom: $(self.nameroot).out
out:
[output_file]
outputs:
output_files:
type: File[]
outputSource: foo/output_file
from cwlexec.
@drjrm3, I test the @mr-c method, it works. you can use it as a workaround, and to make cwlexec
more compatibility, we will try to fix this problem
@mr-c my understanding, for ${return inputs.input_file.nameroot + ".out";}
, the input_file
should be an array in its context, for scatter case, can we introduce an implicit variable: scatter_index
(like self
) for each scattered item on specific level, so we can use it like ${return inputs.input_file[scatter_index].nameroot + ".out";}
, I think this more clear for users, what is your opinion?
from cwlexec.
As a workaround, did you try valueFrom: $(inputs.input_file.nameroot).out
? That is also valid, and simpler.
from cwlexec.
Okay, that doesn't work. Sticking with your original example and running with --debug
we see that the scatter isn't being applied prior to evaluating the valueFrom
as per the spec:
https://www.commonwl.org/v1.0/Workflow.html#WorkflowStepInput
The value of
inputs
in the parameter reference or expression must be the input object to the workflow step after assigning thesource
values, applyingdefault
, and then scattering.
(emphasis added)
08:08:35.583 default [main] DEBUG c.i.s.c.e.util.evaluator.JSEvaluator - Evaluate js expression "${return inputs.input_file.nameroot + ".out";}" with c
ontext
[var runtime={"outdirSize":"52709240832","tmpdir":"/home/jenkins/cwl-workdir/7fa42f5f-ce85-4cca-a77e-cfe2f63ea3f1/scatter_flow","tmpdirSize":"527092408
32","cores":"1","outdir":"/home/jenkins/cwl-workdir/7fa42f5f-ce85-4cca-a77e-cfe2f63ea3f1/scatter_flow","ram":"1"};, var inputs={"input_file":[{"locatio
n":"/home/jenkins/cwl-workdir/UndefinedFile/data/file3.txt","path":"/home/jenkins/cwl-workdir/UndefinedFile/data/file3.txt","basename":"file3.txt","dir
name":"/home/jenkins/cwl-workdir/UndefinedFile/data","nameroot":"file3","nameext":".txt","size":2,"secondaryFiles":[],"class":"File"},{"location":"/hom
e/jenkins/cwl-workdir/UndefinedFile/data/file4.txt","path":"/home/jenkins/cwl-workdir/UndefinedFile/data/file4.txt","basename":"file4.txt","dirname":"/
home/jenkins/cwl-workdir/UndefinedFile/data","nameroot":"file4","nameext":".txt","size":2,"secondaryFiles":[],"class":"File"}],"output_filename":null};
, var self=null;]
08:08:36.616 default [main] DEBUG c.i.s.c.e.util.evaluator.JSEvaluator - Evaluated js expression "${return inputs.input_file.nameroot + ".out";}" to un
defined.out
Here we see the value of inputs.input_file
is the original array of inputs, not the post-scatter
single item that it should be.
from cwlexec.
Even running inner.cwl
directly (after adding the missing ScatterFeatureRequirement
) the same failure to scatter
before evaluating the valueFrom
is observed
from cwlexec.
If you guys find the fix, don't forget to create a pull request and sign off per the instructions. Thanks!
from cwlexec.
@skeeey - Thanks. This does resolved the current issue I am experiencing. However, I use this example in a larger workflow and now the next step is having problem. I will work on a minimal example and open a new ticket. For now, however, I think this can be considered a good workaround.
@mr-c - Comparing your scatter with my original example, which is best practice?
from cwlexec.
Related Issues (20)
- Bad Scatter in subworkflow HOT 2
- Failed to bind value HOT 3
- Undefined javascript variable error HOT 1
- Failed to evaluate the expression in the [std] field, string is required HOT 5
- Incorrect Null evaluation of file HOT 1
- Empty JS array HOT 1
- Failed to "Fill out the scatter gather result in the script" HOT 7
- ScatterFeature does not accept list of files as input: Java ClassCastException thrown HOT 4
- ExpressionTool cannot return multiple arrays HOT 2
- Complete support for CWL 1.0
- add the -n option to model.conf files HOT 9
- Error: Could not find or load main class HOT 4
- Regression after June 7th +29 CWL conformance tests fail
- CWLEXEC fails with Hibernate exception for workflows with more than 20 steps HOT 3
- CWLEXEC doesn't correctly run several subworkflows
- Works with Jsrun?
- Don't *copy* result files. HOT 1
- consider using 'cwljava' for CWL parsing
- dockerOptions.sh as documented fails on short options
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cwlexec.