common-workflow-language / common-workflow-language/cwltool

ExpressionTool cannot return one of its input files as an output

Open
#248 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
376
Forks
255
Avg merge
2d 7h
Merged PRs (30d)
12

Description

I found some advice in https://github.com/common-workflow-language/common-workflow-language/issues/235 but it fails when trying to put into practice with cwltool.

The simple ExpressionTool in [this gist](https://gist.github.com/dleehr/4c72a5a70e4a59f80f453c0379f52aab) 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
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.