Hello guys,
I'm experimenting with scatter/gather feature of Common Workflow Language and I have troubles with return type that differs from string.
So, returning strings works good:
class: CommandLineTool
cwlVersion: "v1.0"
baseCommand: [bash, -c, "echo 42 > data.txt"]
inputs: []
outputs:
value:
type: string
outputBinding:
glob: data.txt
loadContents: true
outputEval: $(self[0].contents)
I run cwl in docker. The output for string evaluatuion is:
root@c9b274ac17d4:~/cwl/complex-out# cwl-runner complex.cwl
/usr/local/bin/cwl-runner 1.0.20181012180214
Resolved 'complex.cwl' to 'file:///root/cwl/complex-out/complex.cwl'
[job complex.cwl] /tmp/tmp557p7kqz$ bash \
-c \
'echo 42 > data.txt'
[job complex.cwl] completed success
{
"value": "42\n"
}
Final process status is success
However, when I change output value type from string to int, cwl-runner reports permanentFail:
root@c9b274ac17d4:~/cwl/complex-out# cwl-runner complex.cwl
/usr/local/bin/cwl-runner 1.0.20181012180214
Resolved 'complex.cwl' to 'file:///root/cwl/complex-out/complex.cwl'
[job complex.cwl] /tmp/tmp8x40850b$ bash \
-c \
'echo 42 > data.txt'
[job complex.cwl] Job error:
Error validating output record. the `value` field is not valid because
`'42\n'` is not int
in {
"value": "42\n"
}
[job complex.cwl] completed permanentFail
{}
Final process status is permanentFail
I also tried array of integers and array of strings; but I stuck event at the basic things.
I also tried to add JS requirements, but it didn't help.
requirements:
InlineJavascriptRequirement: {}
Should I use ExpressionTool or SchemaDefRequirement/CommandOutputBinding to issue an integer from workflow processing unit?
Thanks!
Hello Michael,
Thanks for replying!
I've tried your code sample but 42 is still read as string.
Thanks, I've fixed my answer and added a version without Javscript
Thank you Michael, that works!
Here is sample code without InlineJavascriptRequirement:
And another sample with string array output: