Skip to content

ExpressionTool cannot return one of its input files as an output #248

Open
@dleehr

Description

@dleehr

I found some advice in common-workflow-language/common-workflow-language#235 but it fails when trying to put into practice with cwltool.

The simple ExpressionTool in this gist tries to add secondaryFiles to a file, but the execution fails because cwltool tries to copy the source file over itself, and python raises an exception:

Error: `/Users/dcl9/Code/yaml/bespin-cwl/tools/primary` and `/Users/dcl9/Code/yaml/bespin-cwl/tools/primary` are the same file

Full logs:

$ cwltool merge-secondary-files.cwl merge.json 
/Users/dcl9/Code/yaml/bespin-cwl/env/bin/cwltool 1.0.20161202203310
Resolved 'merge-secondary-files.cwl' to 'file:///Users/dcl9/Code/yaml/bespin-cwl/tools/merge-secondary-files.cwl'
Final process status is success
Unhandled error, try again with --debug for more information:
  `/Users/dcl9/Code/yaml/bespin-cwl/tools/primary` and `/Users/dcl9/Code/yaml/bespin-cwl/tools/primary` are the same file
(env)Homer15:tools dcl9 (master)$ cwltool --debug merge-secondary-files.cwl merge.json 
/Users/dcl9/Code/yaml/bespin-cwl/env/bin/cwltool 1.0.20161202203310
Resolved 'merge-secondary-files.cwl' to 'file:///Users/dcl9/Code/yaml/bespin-cwl/tools/merge-secondary-files.cwl'
Final process status is success
Copying /Users/dcl9/Code/yaml/bespin-cwl/tools/primary to /Users/dcl9/Code/yaml/bespin-cwl/tools/primary
Unhandled error, try again with --debug for more information:
  `/Users/dcl9/Code/yaml/bespin-cwl/tools/primary` and `/Users/dcl9/Code/yaml/bespin-cwl/tools/primary` are the same file
Traceback (most recent call last):
  File "/Users/dcl9/Code/yaml/bespin-cwl/env/lib/python2.7/site-packages/cwltool/main.py", line 721, in main
    **vars(args))
  File "/Users/dcl9/Code/yaml/bespin-cwl/env/lib/python2.7/site-packages/cwltool/main.py", line 246, in single_job_executor
    output_dirs, kwargs.get("move_outputs"))
  File "/Users/dcl9/Code/yaml/bespin-cwl/env/lib/python2.7/site-packages/cwltool/process.py", line 216, in relocateOutputs
    stageFiles(pm, moveIt)
  File "/Users/dcl9/Code/yaml/bespin-cwl/env/lib/python2.7/site-packages/cwltool/process.py", line 179, in stageFiles
    stageFunc(p.resolved, p.target)
  File "/Users/dcl9/Code/yaml/bespin-cwl/env/lib/python2.7/site-packages/cwltool/process.py", line 211, in moveIt
    shutil.copy(src, dst)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 119, in copy
    copyfile(src, dst)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 69, in copyfile
    raise Error("`%s` and `%s` are the same file" % (src, dst))
Error: `/Users/dcl9/Code/yaml/bespin-cwl/tools/primary` and `/Users/dcl9/Code/yaml/bespin-cwl/tools/primary` are the same file

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