Handling output with full path?

I am writing a workflow for a non bioinformatics usage that takes in some file (Alembic geometries), process them and create another Alembic file

Typical usage of application are as follow

-i <some-input-file(s)> -o <some-output-file(s)>

As CWL runtime performs the operation in an encapsulated environment locally, docker or cloud, the output file are in the context/directory of that environment

My experimentation indicates that I can’t provide a full path for output (because it makes no sense in that encapsulated environment)

What is the best practice for handling such use cases ? Write such workflow with 2 steps, step 1 is the work itself and step 2 is the copying of the results to the desired location ?

Here is my current workflow (the output file is written/copied to the directory where I ran the CWL script)

Let’s say I want the file in a different final location, I will need to manually copy it

#!/usr/bin/env cwl-runner

cwlVersion: v1.0
class: CommandLineTool
  - class: InlineJavascriptRequirement
baseCommand: blender_ttcam
arguments: ["--script", $(inputs.blenderScript.path), "--input", $(inputs.inputAlembicMesh.path), "--output", $(inputs.alembicCamera)]
  - id: blenderScript
    type: File
  - id: inputAlembicMesh
    type: File
  - id: alembicCamera
    type: string
  - 0
    type: File
      glob: $(inputs.alembicCamera)

with cwl-runner there is an arg for --outdir puts the output of your workflow in a directory. Does this not work for you?

If you are running e.g. cwl-runner inside a container, then I am guessing you have some host volume mounted somewhere as well, so you would just need to direct --outdir to the location mounted inside the container that corresponds to the host volume.

If you check cwl-runner -h I think there are some other args as well for moving output files around which might be helpful.

I think if you are using another CWL runner, it should have similar options.

1 Like

For your --output parameter, I suggest

"--output", $(runtime.outdir)/$(inputs.alembicCamera)

See also Additional Arguments and Parameters – Common Workflow Language User Guide and Common Workflow Language (CWL) Command Line Tool Description, v1.2

You don’t need to update the outputBinding for outputAlembicCamera as relative paths are resolved with respect to

or leaving out the $(inputs.alembicCamera) and using a fixed string → "--output", $(runtime.outdir)/result.ext or similar. In this case you would need to update the outputBinding glob to match.