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

static_checker mistakenly fails with source -> sink

Offen
#437 0 Kommentare 2 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Python
Sterne
376
Forks
255
Ø Merge
2 T. 7 Std.
Gemergte PRs (30 T.)
12

Beschreibung

## Expected Behavior
Workflow inputs
```json
inputs:
file1:
- type: array
items: File
file2:
- type: array
items: File
```
should be exactly the same as
```json
inputs:
file1:
type: File[]
file2:
type: File[]
```

## Actual Behavior
`static_checker` mistakenly fails with source -> sink mismatch
```
Tool definition failed validation:
count-lines11-wf.cwl:9:5: Source 'file1' of type [{"type": "array", "items": "File"}] is incompatible
count-lines11-wf.cwl:25:7: with sink 'file1' of type {"type": "array", "items": "File"}
count-lines11-wf.cwl:25:7: sink has linkMerge method merge_flattened
count-lines11-wf.cwl:12:5: Source 'file2' of type [{"type": "array", "items": "File"}] is incompatible
count-lines11-wf.cwl:25:7: with sink 'file1' of type {"type": "array", "items": "File"}
count-lines11-wf.cwl:25:7: sink has linkMerge method merge_flattened
```

## Workflow Code
Workflow `count-lines11-wf.cwl`
```yaml
#!/usr/bin/env cwl-runner
class: Workflow
cwlVersion: v1.0

requirements:
- class: MultipleInputFeatureRequirement

inputs:
file1:
- type: array
items: File
file2:
- type: array
items: File

outputs:
count_output:
type: int
outputSource: step1/output

steps:
step1:
run: wc3-tool.cwl
in:
file1:
source: [file1, file2]
linkMerge: merge_flattened
out: [output]
```
tool `wc3-tool.cwl`
```
#!/usr/bin/env cwl-runner
class: CommandLineTool
cwlVersion: v1.0

requirements:
- class: InlineJavascriptRequirement

inputs:
file1:
type: File[]
inputBinding: {}
outputs:
output:
type: int
outputBinding:
glob: output.txt
loadContents: true
outputEval: |
${
var s = self[0].contents.split(/\r?\n/);
return parseInt(s[s.length-2]);
}
stdout: output.txt
baseCommand: wc
```
job `count-lines6-job.json`
```json
{
"file1": [
{
"class": "File",
"location": "whale.txt"
},
{
"class": "File",
"location": "whale.txt"
}
],
"file2": [
{
"class": "File",
"location": "hello.txt"
},
{
"class": "File",
"location": "hello.txt"
}
]
}
```
## Full Traceback
```pytb
cwltool --debug count-lines11-wf.cwl count-lines6-job.json
/Users/kot4or/venv/cwl_latest/bin/cwltool 1.0.20170622090721
Resolved 'count-lines11-wf.cwl' to 'file:///Users/kot4or/workspaces/python_ws/common-workflow-language/v1.0/v1.0/count-lines11-wf.cwl'
Tool definition failed validation:
count-lines11-wf.cwl:9:5: Source 'file1' of type [{"type": "array", "items": "File"}] is incompatible
count-lines11-wf.cwl:25:7: with sink 'file1' of type {"type": "array", "items": "File"}
count-lines11-wf.cwl:25:7: sink has linkMerge method merge_flattened
count-lines11-wf.cwl:12:5: Source 'file2' of type [{"type": "array", "items": "File"}] is incompatible
count-lines11-wf.cwl:25:7: with sink 'file1' of type {"type": "array", "items": "File"}
count-lines11-wf.cwl:25:7: sink has linkMerge method merge_flattened
Traceback (most recent call last):
File "/Users/kot4or/venv/cwl_latest/lib/python2.7/site-packages/cwltool/main.py", line 715, in main
makeTool, vars(args))
File "/Users/kot4or/venv/cwl_latest/lib/python2.7/site-packages/cwltool/load_tool.py", line 251, in make_tool
tool = makeTool(processobj, **kwargs)
File "/Users/kot4or/venv/cwl_latest/lib/python2.7/site-packages/cwltool/workflow.py", line 37, in defaultMakeTool
return Workflow(toolpath_object, **kwargs)
File "/Users/kot4or/venv/cwl_latest/lib/python2.7/site-packages/cwltool/workflow.py", line 524, in __init__
static_checker(workflow_inputs, workflow_outputs, step_inputs, step_outputs)
File "/Users/kot4or/venv/cwl_latest/lib/python2.7/site-packages/cwltool/workflow.py", line 612, in static_checker
raise validate.ValidationException(all_exception_msg)
ValidationException: count-lines11-wf.cwl:9:5: Source 'file1' of type [{"type": "array", "items": "File"}] is incompatible
count-lines11-wf.cwl:25:7: with sink 'file1' of type {"type": "array", "items": "File"}
count-lines11-wf.cwl:25:7: sink has linkMerge method merge_flattened
count-lines11-wf.cwl:12:5: Source 'file2' of type [{"type": "array", "items": "File"}] is incompatible
count-lines11-wf.cwl:25:7: with sink 'file1' of type {"type": "array", "items": "File"}
count-lines11-wf.cwl:25:7: sink has linkMerge method merge_flattened
```

## Your Environment
* cwltool version: 1.0.20170622090721

## Link to reproduce test
[count-lines11-wf.cwl](https://github.com/michael-kotliar/common-workflow-language/blob/99eae7583e67e7af387668f4b94bc1e7875c6ec0/v1.0/v1.0/count-lines11-wf.cwl)
[count-lines6-job.json](https://github.com/michael-kotliar/common-workflow-language/blob/99eae7583e67e7af387668f4b94bc1e7875c6ec0/v1.0/v1.0/count-lines6-job.json)
[wc3-tool.cwl](https://github.com/michael-kotliar/common-workflow-language/blob/99eae7583e67e7af387668f4b94bc1e7875c6ec0/v1.0/v1.0/wc3-tool.cwl)
[whale.txt](https://github.com/michael-kotliar/common-workflow-language/blob/99eae7583e67e7af387668f4b94bc1e7875c6ec0/v1.0/v1.0/whale.txt)
[hello.txt](https://github.com/michael-kotliar/common-workflow-language/blob/99eae7583e67e7af387668f4b94bc1e7875c6ec0/v1.0/v1.0/hello.txt)

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.