I have been try to write in CWL a description that appends stdout and stderr to a file in a specific directory, something like printf 'some message' >> out_directory/out_file 2>&1
With the following CWL description:
# File: test.cwl
cwlVersion: v1.0
class: CommandLineTool
requirements:
- class: InlineJavascriptRequirement
baseCommand: [printf]
inputs:
message:
type: string
inputBinding:
position: 1
output_name:
type: string
output_dir:
type: string
stdout: $(inputs.output_name)
stderr: $(inputs.output_name)
outputs:
output:
type: File
outputBinding:
glob: $(inputs.output_dir)/$(inputs.output_name)
and input file:
# File: test.yml
message: 'some message'
output_name: out_file
output_dir: out_directory
I get this error
Error collecting output for parameter 'output':
test.cwl:28:7: Did not find output file with glob pattern: '['out_directory/out_file']'
Any ideas about printing to specific directories? Also, how can I use >> instead of > ?
Thank you!
Take a look at the section “Capturing Standard Output” of the User Guide: https://www.commonwl.org/user_guide/05-stdout/index.html. It has an example of how to use the
stdoutvariable.In your example, I think you don't need to specify the output type as
Filenor its binding when usingstdout. Instead you can have this as your workflow file.And this as the input:
You don't need to pass an input parameter for the output directory. By default it will end up in your local directory with your workflow, but you can change it with the following command:
And that way your
out_fileshould appear in./out_directory.For future questions about CWL, you may want to post it to the CWL Discourse forum instead: https://cwl.discourse.group/
-Bruno