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

'$graph' not found when creating of a workflow uses commandline tools defined inside the workflow definition

Open
#1,325 1 comment 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
Same packed file to be generated regardless of the build type

## Actual Behavior
Tell us what happens instead

If a workflow refers to a commandline tool defined in the `run` attribute of the `step`.
A non-$graph type of workflow is packed.

If a workflow refers to a commandline tool defined in a separate file and linked to in the `run` attribute of the `step`.
A $graph type of workflow is packed instead

## Workflow Code - one file per tool
Taken from https://github.com/common-workflow-language/common-workflow-language/tree/master/v1.0/examples
```

cwlVersion: v1.0
class: Workflow
inputs:
inp: File
ex: string

outputs:
classout:
type: File
outputSource: compile/classfile

steps:
untar:
run: tar-param.cwl
in:
tarfile: inp
extractfile: ex
out: [example_out]

compile:
run: arguments.cwl
in:
src: untar/example_out
out: [classfile]
```

## Workflow Code - Single File
```
cwlVersion: v1.0
class: Workflow
inputs:
inp: File
ex: string

outputs:
classout:
type: File
outputSource: compile/classfile

steps:
untar:
run:
cwlVersion: v1.0
class: CommandLineTool
baseCommand: [tar, xf]
inputs:
tarfile:
type: File
inputBinding:
position: 1
extractfile:
type: string
inputBinding:
position: 2
outputs:
example_out:
type: File
outputBinding:
glob: $(inputs.extractfile)
in:
tarfile: inp
extractfile: ex
out: [example_out]

compile:
run:
cwlVersion: v1.0
class: CommandLineTool
label: Example trivial wrapper for Java 7 compiler
hints:
DockerRequirement:
dockerPull: java:7-jdk
baseCommand: javac
arguments: ["-d", $(runtime.outdir)]
inputs:
src:
type: File
inputBinding:
position: 1
outputs:
classfile:
type: File
outputBinding:
glob: "*.class"
in:
src: untar/example_out
out: [classfile]
```

## Workflow Code - one file per tool - packed
```
{
"$graph": [
{
"class": "CommandLineTool",
"label": "Example trivial wrapper for Java 7 compiler",
"hints": [
{
"dockerPull": "java:7-jdk",
"class": "DockerRequirement"
}
],
"baseCommand": "javac",
"arguments": [
"-d",
"$(runtime.outdir)"
],
"inputs": [
{
"type": "File",
"inputBinding": {
"position": 1
},
"id": "#arguments.cwl/src"
}
],
"outputs": [
{
"type": "File",
"outputBinding": {
"glob": "*.class"
},
"id": "#arguments.cwl/classfile"
}
],
"id": "#arguments.cwl"
},
{
"class": "Workflow",
"inputs": [
{
"type": "string",
"id": "#main/ex"
},
{
"type": "File",
"id": "#main/inp"
}
],
"outputs": [
{
"type": "File",
"outputSource": "#main/compile/classfile",
"id": "#main/classout"
}
],
"steps": [
{
"run": "#arguments.cwl",
"in": [
{
"source": "#main/untar/example_out",
"id": "#main/compile/src"
}
],
"out": [
"#main/compile/classfile"
],
"id": "#main/compile"
},
{
"run": "#tar-param.cwl",
"in": [
{
"source": "#main/ex",
"id": "#main/untar/extractfile"
},
{
"source": "#main/inp",
"id": "#main/untar/tarfile"
}
],
"out": [
"#main/untar/example_out"
],
"id": "#main/untar"
}
],
"id": "#main"
},
{
"class": "CommandLineTool",
"baseCommand": [
"tar",
"xf"
],
"inputs": [
{
"type": "string",
"inputBinding": {
"position": 2
},
"id": "#tar-param.cwl/extractfile"
},
{
"type": "File",
"inputBinding": {
"position": 1
},
"id": "#tar-param.cwl/tarfile"
}
],
"outputs": [
{
"type": "File",
"outputBinding": {
"glob": "$(inputs.extractfile)"
},
"id": "#tar-param.cwl/example_out"
}
],
"id": "#tar-param.cwl"
}
],
"cwlVersion": "v1.0"
}
```

## Workflow Code - Single File - Packed
```
{
"class": "Workflow",
"inputs": [
{
"type": "string",
"id": "#main/ex"
},
{
"type": "File",
"id": "#main/inp"
}
],
"outputs": [
{
"type": "File",
"outputSource": "#main/compile/classfile",
"id": "#main/classout"
}
],
"steps": [
{
"run": {
"cwlVersion": "v1.0",
"class": "CommandLineTool",
"label": "Example trivial wrapper for Java 7 compiler",
"hints": [
{
"dockerPull": "java:7-jdk",
"class": "DockerRequirement"
}
],
"baseCommand": "javac",
"arguments": [
"-d",
"$(runtime.outdir)"
],
"inputs": [
{
"type": "File",
"inputBinding": {
"position": 1
},
"id": "#main/compile/2486c948-9b99-4be4-b1ed-15ec38c0d842/src"
}
],
"outputs": [
{
"type": "File",
"outputBinding": {
"glob": "*.class"
},
"id": "#main/compile/2486c948-9b99-4be4-b1ed-15ec38c0d842/classfile"
}
],
"id": "#main/compile/2486c948-9b99-4be4-b1ed-15ec38c0d842"
},
"in": [
{
"source": "#main/untar/example_out",
"id": "#main/compile/src"
}
],
"out": [
"#main/compile/classfile"
],
"id": "#main/compile"
},
{
"run": {
"cwlVersion": "v1.0",
"class": "CommandLineTool",
"baseCommand": [
"tar",
"xf"
],
"inputs": [
{
"type": "string",
"inputBinding": {
"position": 2
},
"id": "#main/untar/106062ee-ebb7-41c6-b19e-ae5d17248670/extractfile"
},
{
"type": "File",
"inputBinding": {
"position": 1
},
"id": "#main/untar/106062ee-ebb7-41c6-b19e-ae5d17248670/tarfile"
}
],
"outputs": [
{
"type": "File",
"outputBinding": {
"glob": "$(inputs.extractfile)"
},
"id": "#main/untar/106062ee-ebb7-41c6-b19e-ae5d17248670/example_out"
}
],
"id": "#main/untar/106062ee-ebb7-41c6-b19e-ae5d17248670"
},
"in": [
{
"source": "#main/ex",
"id": "#main/untar/extractfile"
},
{
"source": "#main/inp",
"id": "#main/untar/tarfile"
}
],
"out": [
"#main/untar/example_out"
],
"id": "#main/untar"
}
],
"id": "#main",
"cwlVersion": "v1.0"
}
```

## Your Environment
* cwltool version:
cwltool 3.0.20200710214758

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.