Hello all! Currently, I am running docker images like so. This image below simply does an “ls /input > /output/predictions.csv”
mkdir folder
touch folder/fee
mkdir test
docker run -v $(pwd)/folder:/input:ro -v $(pwd)/test:/output:rw thomasvyu/challenge-example:latest
ls test/
predictions.csv
We specify a specific directory to write to in the container like /output. Is it possible to mimic this behavior with CWL:
cwlVersion: v1.0
class: CommandLineTool
requirements:
- class: DockerRequirement
dockerPull: ...
- class: InlineJavascriptRequirement
- class: InitialWorkDirRequirement
listing:
- entry: $(inputs.input)
entryname: $("/input")
- entry: $(inputs.output)
entryname: $("/output")
writable: true
inputs:
- id: input
type: Directory
- id: output
type: Directory
outputs:
- id: prediction_file
type: File
outputBinding:
glob: $(inputs.output.path + "/prediction.csv")
I tried the above, but that doesn’t work.
Hi @thomasyu888, could you post a sample error log please. Two things to try
- Don’t have the
entryname
be a parameter reference (not needed).
- Use a relative path, rather than an absolute path
- class: InitialWorkDirRequirement
listing:
- entry: $(inputs.input)
entryname: input
- entry: $(inputs.output)
entryname: output
writable: true
HI @kaushik-work,
Thanks for the prompt response. I found what I was looking for:
#!/usr/bin/env cwl-runner
#
# Run a docker image
#
cwlVersion: v1.0
class: CommandLineTool
requirements:
- class: DockerRequirement
dockerPull: thomasvyu/challenge-example:latest
dockerOutputDirectory: /output
- class: InlineJavascriptRequirement
- class: InitialWorkDirRequirement
listing:
- entry: $(inputs.input)
entryname: $("/input")
inputs:
- id: input
type: Directory
outputs:
- id: pred
type: File
outputBinding:
glob: $("predictions.csv")
mrc
4
Here’s a version that doesn’t required InlineJavascriptRequirement
#!/usr/bin/env cwl-runner
#
# Run a docker image
#
cwlVersion: v1.0
class: CommandLineTool
requirements:
DockerRequirement:
dockerPull: thomasvyu/challenge-example:latest
dockerOutputDirectory: /output
InitialWorkDirRequirement:
listing:
- entry: $(inputs.input)
entryname: input
inputs:
input:
type: Directory
outputs:
pred:
type: File
outputBinding:
glob: predictions.csv
1 Like