common-workflow-language / common-workflow-language/cwltool
$include / $import fail when used to include input parameter
- Dominant language
- Python
- Stars
- 376
- Forks
- 255
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 12
Description
## Expected Behavior
I expect that my YAML snippet should be included / imported into the CWL tool definition
## Actual Behavior
`cwltool` fails to parse the CWL specification, seemingly trying to process it before the `$include` / `$import` is resolved.
## Workflow Code
```cwl
#!/usr/bin/env cwl-runner
cwlVersion: v1.0
id: CWLTest
class: CommandLineTool
requirements:
InitialWorkDirRequirement:
listing:
- entry: $(inputs.infile)
entryname: foo.txt
stdout: output.txt
baseCommand: [ "cat", "foo.txt" ]
inputs:
# fails with $include too:
$import: infile.yml
outputs:
output:
type: File
outputBinding:
glob: output.txt
```
where infile.yml is:
```yaml
infile:
type: File
default:
class: File
path: myfile.txt
```
## Full Traceback
When I use `$include`:
```pytb
$ cwltool --debug test.cwl
/home/pvh/.virtualenvs/cwltool/bin/cwltool 1.0.20180508202931
Resolved 'test.cwl' to 'file:///home/pvh/Documents/code/cwl/testtool/test.cwl'
I'm sorry, I couldn't load this CWL file. The error was:
Traceback (most recent call last):
File "/home/pvh/.virtualenvs/cwltool/local/lib/python2.7/site-packages/cwltool/main.py", line 479, in main
do_validate=args.do_validate)
File "/home/pvh/.virtualenvs/cwltool/local/lib/python2.7/site-packages/cwltool/load_tool.py", line 286, in validate_document
_convert_stdstreams_to_files(workflowobj)
File "/home/pvh/.virtualenvs/cwltool/local/lib/python2.7/site-packages/cwltool/load_tool.py", line 154, in _convert_stdstreams_to_files
if inp.get('type') == 'stdin':
AttributeError: 'unicode' object has no attribute 'get'
```
When I use `$import`:
```pytb
$ cwltool --debug test.cwl
/home/pvh/.virtualenvs/cwltool/bin/cwltool 1.0.20180508202931
Resolved 'test.cwl' to 'file:///home/pvh/Documents/code/cwl/testtool/test.cwl'
I'm sorry, I couldn't load this CWL file. The error was:
Traceback (most recent call last):
File "/home/pvh/.virtualenvs/cwltool/local/lib/python2.7/site-packages/cwltool/main.py", line 479, in main
do_validate=args.do_validate)
File "/home/pvh/.virtualenvs/cwltool/local/lib/python2.7/site-packages/cwltool/load_tool.py", line 286, in validate_document
_convert_stdstreams_to_files(workflowobj)
File "/home/pvh/.virtualenvs/cwltool/local/lib/python2.7/site-packages/cwltool/load_tool.py", line 154, in _convert_stdstreams_to_files
if inp.get('type') == 'stdin':
AttributeError: 'str' object has no attribute 'get'
```
## Your Environment
* cwltool version:
Check using ``cwltool --version``
Contributor guide
Assessment
This issue has not been assessed yet.