Skip to content

Specifying "--outdir" to cwl-runner when running a Workflow doesn't appear to work #154

Closed

Description

@vardaofthevalier

When I run one of my CommandLineTools (which runs in a Docker container) using the "--outdir" flag, I can see that the output directory gets set correctly:

sudo cwl-runner --outdir /cwl-data/workflows/snapr/outputs snapr-index.cwl snapr-index.json
/usr/local/bin/cwl-runner 1.0.20151022085449
[job 52613392] /cwl-data/workflows/snapr/outputs$ docker run -i --volume=/home/abby/bioinformatics-pipelines/cwl-examples/snapr/snapr-index/genome-index/.success:/tmp/job21078165_genome-index/.success:ro --volume=/cwl-data/workflows/snapr/inputs/sequence.fa:/tmp/job21078165_inputs/sequence.fa:ro --volume=/cwl-data/workflows/snapr/outputs:/tmp/job_output:rw --volume=/tmp/tmp0T8fq2:/tmp/job_tmp:rw --workdir=/tmp/job_output --user=0 --rm --env=TMPDIR=/tmp/job_tmp isbbheavner/snapr_1.0dev57_v2 snapr index /tmp/job21078165_inputs/sequence.fa genome-index > /cwl-data/workflows/snapr/outputs/snapr-index.out

When I attempt to run a Workflow using the same CommandLineTool as a step, using the "--outdir" flag has no effect:

sudo cwl-runner --outdir /cwl-data/workflows/snapr/outputs snapr-pipeline2.cwl snapr-pipeline2.json
/usr/local/bin/cwl-runner 1.0.20151022085449
[job 38991504] /tmp/tmpJHsaiD$ docker run -i --volume=/tmp/tmp1N0uv5/mkdirs.stdout:/tmp/job601370219_tmp1N0uv5/mkdirs.stdout:ro --volume=/cwl-data/workflows/snapr/inputs/sequence.fa:/tmp/job601370219_inputs/sequence.fa:ro --volume=/tmp/tmpJHsaiD:/tmp/job_output:rw --volume=/tmp/tmpSp49V9:/tmp/job_tmp:rw --workdir=/tmp/job_output --user=0 --rm --env=TMPDIR=/tmp/job_tmp isbbheavner/snapr_1.0dev57_v2 snapr index /tmp/job601370219_inputs/sequence.fa genome-index > /tmp/tmpJHsaiD/snapr-index.out

What I need is for all of my workflow steps to have access to the same output directory. Is there some other way to force the output directory to be the same for all workflow steps?

Activity

  1. tetron commented on Oct 29, 2015

    @tetron
    Member

    Can you explain what it is you are doing that you need a shared output directory? In general, you can't do that with CWL, because workflow steps may run in separate containers on separate nodes, and there is no requirement for a shared file system, so you have to be explicit about which files each step consumes and produces.

    A couple of features that may help you:

    "secondaryFiles": http://common-workflow-language.github.io/draft-2/#binding

    "CreateFileRequirement": http://common-workflow-language.github.io/draft-2/#createfilerequirement

  2. vardaofthevalier commented on Oct 30, 2015

    @vardaofthevalier
    Author

    The workflow that I'm working on has 3 primary steps (refer to SNAPR documentation for more specifics):

    1. Create a genome index in an existing directory, where the directory path is provided as a parameter, e.g.:
    snapr index genome.fa path/to/genome-index
    
    1. Do basically the same operation as in step 1, except for the transcriptome index.
    snapr transcriptome annotation.gtf genome.fa path/to/transcriptome-dir -O1000
    
    1. Perform a single-end (or paired-end) alignment on a bam file, given the genome and transcriptome index directories from steps 1 and 2:
    snapr single path/to/index-dir path/to/transcriptome-dir annotation.gtf reads.bam -o out.bam
    snapr paired ... <the rest of the command is identical to the one above>
    

    Steps 1 and 2 each create 4 files in their respective index directories, which isn't too difficult to map to individual outputs. The problem now is that step 3 expects all of the files from step one to be in a single (distinct) directory, and the same goes for the files from step 2. Putting them all in the same directory wouldn't work (which is what I think would happen if I just fed all of the resulting files from steps 1 and 2 as input to the third step), because steps 1 and 2 create the same number of files with the same file names, so attempting to merge them all into a single directory would likely cause something to be overwritten.

    Intuitively I was thinking that steps sharing the same output directory would solve the issue, but I think I'm starting to see why that's not possible. I'm trying to make sense of "linkMerge" in the draft 2 spec, but the wording is a little bit vague. Is this a feature that I could use to somehow merge collections of output files for use as input for subsequent steps?

  3. vardaofthevalier commented on Nov 6, 2015

    @vardaofthevalier
    Author

    I think I figured out how to make this scenario work using the CreateFileRequirement in the final step, in which the content from the outputs of the previous steps are used for the fileContent property. I just use / to generate the file on the correct path in the designated output directory and it appears to work. This issue can probably be closed now.

  4. added a commit that references this issue on Mar 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions