Skip to content

Issue with copying directories from cache if output already exists #544

Closed
@jasper1918

Description

@jasper1918

Expected Behavior

While copying from cache to the output directory, files and directories should either be copied or compared with existing outputs. Not all functions allow overwriting so removing the object first may be necessary.

Actual Behavior

Files are being handled correctly but directories cause an error to be thrown. In this case the destination directory should be removed first.

Workflow Code

Paste the template code (ideally a minimal example) that causes the issue

Full Traceback

 
Copying /home/cwl_cache/6075a780b7f8b08884e3b012b0382c7c/mysample2_salmon_quant to /home/CWL_Pipelines/workflows/RNASEQ_Workflow/test_data/out/mysample2_salmon_quant
Unhandled error, try again with --debug for more information:
  [Errno 17] File exists: '/home/CWL_Pipelines/workflows/RNASEQ_Workflow/test_data/out/mysample2_salmon_quant'
Traceback (most recent call last):
  File "/home/anaconda2/lib/python2.7/site-packages/cwltool/main.py", line 907, in main
    **vars(args))
  File "/home/anaconda2/lib/python2.7/site-packages/cwltool/main.py", line 294, in single_job_executor
    kwargs["make_fs_access"](""))
  File "/home/anaconda2/lib/python2.7/site-packages/cwltool/process.py", line 289, in relocateOutputs
    stageFiles(pm, stageFunc=moveIt, symLink=False)
  File "/home/anaconda2/lib/python2.7/site-packages/cwltool/process.py", line 229, in stageFiles
    stageFunc(p.resolved, p.target)
  File "/home/anaconda2/lib/python2.7/site-packages/cwltool/process.py", line 282, in moveIt
    shutil.copytree(src, dst)
  File "/home/anaconda2/lib/python2.7/shutil.py", line 177, in copytree
    os.makedirs(dst)
  File "/home/anaconda2/lib/python2.7/os.py", line 157, in makedirs
    mkdir(name, mode)
OSError: [Errno 17] File exists: '/home/CWL_Pipelines/workflows/RNASEQ_Workflow/test_data/out/mysample2_salmon_quant'

Your Environment

cwltool 1.0.20170828135420

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions