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

Inconsistent behaviour in packing

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

Description

## Expected Behavior
Tell us what should happen

Consistency in types with the out section of steps

## Actual Behavior
Tell us what happens instead

Multiple variants in the `out` component of steps depending on which `id` attributes are set in the main workflow

## Workflow Code
from [https://github.com/common-workflow-language/cwl-v1.1/blob/main/tests/count-lines1-wf.cwl](https://github.com/common-workflow-language/cwl-v1.1/blob/main/tests/count-lines1-wf.cwl)
```yaml
#!/usr/bin/env cwl-runner
class: Workflow
cwlVersion: v1.1

inputs:
file1:
type: File

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

steps:
step1:
run: wc-tool.cwl
in:
file1: file1
out: [output]

step2:
run: parseInt-tool.cwl
in:
file1: step1/output
out: [output]
```

## Now let's pack it and then check on the out of the steps
```bash
cwltool --pack count-lines1-wf.cwl | jq '.["$graph"][] | select(.class == "Workflow") | .steps[] | .out'
```

Yields
```json
[
"#main/step1/output"
]
[
"#main/step2/output"
]
```

## Now let's add the id attribute to the workflow

```yaml
#!/usr/bin/env cwl-runner
class: Workflow
cwlVersion: v1.1

id: count-lines-1-wf

inputs:
file1:
type: File

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

steps:
step1:
run: wc-tool.cwl
in:
file1: file1
out: [output]

step2:
run: parseInt-tool.cwl
in:
file1: step1/output
out: [output]
```

We run the same command again:

```bash
cwltool --pack count-lines1-wf.cwl 2>/dev/null | jq '.["$graph"][] | select(.class == "Workflow") | .steps[] | .out'
```

and get

```json
[
"#/step1/output"
]
[
"#/step2/output"
]
```

Yet if we turn the out list into `id: out` then we have a different ids, note `#/stepx` is changed to `#stepx` instead.

```yaml
#!/usr/bin/env cwl-runner
class: Workflow
cwlVersion: v1.1

id: counts-lines-1-wf

inputs:
file1:
type: File

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

steps:
step1:
run: wc-tool.cwl
in:
file1: file1
out:
- id: output

step2:
run: parseInt-tool.cwl
in:
file1: step1/output
out:
- id: output
```

We run the same command again
```bash
$ cwltool --pack count-lines1-wf.cwl 2>/dev/null | jq '.["$graph"][] | select(.class == "Workflow") | .steps[] | .out'
```

but now we get
```json
[
{
"id": "#step1/output"
}
]
[
{
"id": "#step2/output"
}
]
```

## Your Environment
* cwltool version: 3.0.20201203173111
Check using ``cwltool --version``

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.