Skip to content

Commit adca4ad

Browse files
committed
review/edits
1 parent 7024d8e commit adca4ad

File tree

1 file changed

+16
-44
lines changed

1 file changed

+16
-44
lines changed

docs/SubWorkflows.md

Lines changed: 16 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,11 @@
1-
_For the Doc-A-Thon_
2-
**Questions to answer and things to consider:**
1+
In order to support the composition and reuse of workflows, WDL allows the execution of an entire workflow as a step in a larger workflow. When a workflow calls another workflow, that second workflow is referred to as a sub-workflow. Note that sub-workflows can themselves contain sub-workflows and so on and there is no explicit limit as to how deeply workflows can be nested. Cromwell supports execution of such workflows.
32

4-
1. Who is visiting the Subworkflows page?
5-
6-
2. What do they need to know first?
7-
8-
3. Is all the important information there? If not, add it!
9-
10-
4. Are there things that don't need to be there? Remove them.
11-
12-
5. Are the code and instructions accurate? Try it!
13-
14-
---
15-
**DELETE ABOVE ONCE COMPLETE**
16-
17-
---
18-
19-
20-
WDL allows the execution of an entire workflow as a step in a larger workflow (see WDL SPEC for more details), which is what will be referred to as a sub workflow going forward.
21-
Cromwell supports execution of such workflows. Note that sub workflows can themselves contain sub workflows, etc... There is no limitation as to how deeply workflows can be nested.
3+
However, that a single WDL file can contain only a single workflow definition. In order to reference a sub-workflow, the import directive can be used to bring that sub-workflow into existence and referenced by it's alias and name. See the [documentation on imports](Imports.md) for more details of how to declare and reference tasks and workflows via imports.
224

235
**Execution**
246

25-
Sub workflows are executed exactly as a task would be.
26-
*This means that if another call depends on an output of a sub workflow, this call will run when the whole sub workflow completes (successfully).*
7+
A sub-workflows is executed exactly as a task would be.
8+
*This means that if another call depends on an output of a sub-workflow, this call will run when the whole sub-workflow completes (successfully).*
279
For example, in the following case :
2810

2911
`main.wdl`
@@ -49,9 +31,6 @@ task hello {
4931
command {
5032
echo "Hello ${addressee}!"
5133
}
52-
runtime {
53-
docker: "ubuntu:latest"
54-
}
5534
output {
5635
String salutation = read_string(stdout())
5736
}
@@ -62,9 +41,6 @@ task goodbye {
6241
command {
6342
echo "Goodbye ${addressee}!"
6443
}
65-
runtime {
66-
docker: "ubuntu:latest"
67-
}
6844
output {
6945
String salutation = read_string(stdout())
7046
}
@@ -83,27 +59,27 @@ workflow hello_and_goodbye {
8359
}
8460
```
8561

86-
`myTask` will start only when hello_and_goodbye completes (which means all of its calls are done), even though `myTask` only needs the output of hello in the hello_and_goodbye sub workflow.
62+
`myTask` will start only when hello_and_goodbye completes (which means all of its calls are done), even though `myTask` only needs the output of hello in the hello_and_goodbye sub-workflow.
8763
If hello_and_goodbye fails, then `myTask` won't be executed.
88-
Only workflow outputs are visible outside a workflow, which means that references to outputs produced by a sub workflow will only be valid if those outputs are exposed in the workflow output section.
64+
Only workflow outputs are visible outside a workflow, which means that references to outputs produced by a sub-workflow will only be valid if those outputs are exposed in the workflow output section.
8965

90-
Sub workflows are executed in the context of a main workflow, which means that operations that are normally executed once per workflow (set up, clean up, outputs copying, log copying, etc...)
91-
will NOT be re-executed for each sub workflow. For instance if a resource is created during workflow initialization, sub workflows will need to share this same resource.
92-
Workflow outputs will be copied for the main root workflow but not for intermediate sub workflows.
66+
Sub-workflows are executed in the context of a main workflow, which means that operations that are normally executed once per workflow (set up, clean up, outputs copying, log copying, etc...)
67+
will NOT be re-executed for each sub-workflow. For instance if a resource is created during workflow initialization, sub-workflows will need to share this same resource.
68+
Workflow outputs will be copied for the main root workflow but not for intermediate sub-workflows.
9369

9470
Restarts, aborts, and call-caching work exactly as they would with tasks.
95-
All tasks run by a sub workflow are eligible for call caching under the same rules as any other task.
71+
All tasks run by a sub-workflow are eligible for call caching under the same rules as any other task.
9672
However, workflows themselves are not cached as such. Which means that running the exact same workflow twice with call caching on will trigger each task to cache individually,
9773
but not the workflow itself.
9874

99-
The root path for sub workflow execution files (scripts, output files, logs) will be under the parent workflow call directory.
75+
The root path for sub-workflow execution files (scripts, output files, logs) will be under the parent workflow call directory.
10076
For example, the execution directory for the above main workflow would look like the following:
10177

10278
```
10379
cromwell-executions/main_workflow/1d919bd4-d046-43b0-9918-9964509689dd/ <- main workflow id
10480
└── call-hello_and_goodbye <- call directory for call hello_and_goodbye in the main workflow
105-
└── hello_and_goodbye <- name of the sub workflow
106-
└── a6365f91-c807-465a-9186-a5d3da98fe11 <- sub workflow id
81+
└── hello_and_goodbye <- name of the sub-workflow
82+
└── a6365f91-c807-465a-9186-a5d3da98fe11 <- sub-workflow id
10783
├── call-goodbye
10884
│ └── execution
10985
│ ├── rc
@@ -129,7 +105,7 @@ cromwell-executions/main_workflow/1d919bd4-d046-43b0-9918-9964509689dd/ <- main
129105

130106
**Metadata**
131107

132-
Each sub workflow will have its own workflow ID. This ID will appear in the metadata of the parent workflow, in the call section corresponding to the sub workflow, under the "subWorkflowId" attribute.
108+
Each sub-workflow will have its own workflow ID. This ID will appear in the metadata of the parent workflow, in the call section corresponding to the sub-workflow, under the "subWorkflowId" attribute.
133109
For example, querying the `main_workflow` metadata above (minus the `myTask` call) , could result in something like this:
134110

135111
`GET /api/workflows/v2/1d919bd4-d046-43b0-9918-9964509689dd/metadata`
@@ -174,7 +150,7 @@ For example, querying the `main_workflow` metadata above (minus the `myTask` cal
174150
}
175151
```
176152

177-
The sub workflow ID can be queried separately:
153+
The sub-workflow ID can be queried separately:
178154

179155
`GET /api/workflows/v2/a6365f91-c807-465a-9186-a5d3da98fe11/metadata`
180156

@@ -191,7 +167,6 @@ The sub workflow ID can be queried separately:
191167
"salutation": "Hello sub world!"
192168
},
193169
"runtimeAttributes": {
194-
"docker": "ubuntu:latest",
195170
"failOnStderr": false,
196171
"continueOnReturnCode": "0"
197172
},
@@ -248,7 +223,6 @@ The sub workflow ID can be queried separately:
248223
"salutation": "Goodbye sub world!"
249224
},
250225
"runtimeAttributes": {
251-
"docker": "ubuntu:latest",
252226
"failOnStderr": false,
253227
"continueOnReturnCode": "0"
254228
},
@@ -313,7 +287,7 @@ The sub workflow ID can be queried separately:
313287
}
314288
```
315289

316-
It's also possible to set the URL query parameter `expandSubWorkflows` to `true` to automatically include sub workflows metadata (`false` by default).
290+
It's also possible to set the URL query parameter `expandSubWorkflows` to `true` to automatically include sub-workflows metadata (`false` by default).
317291

318292
`GET api/workflows/v2/1d919bd4-d046-43b0-9918-9964509689dd/metadata?expandSubWorkflows=true`
319293

@@ -339,7 +313,6 @@ It's also possible to set the URL query parameter `expandSubWorkflows` to `true`
339313
"salutation": "Hello sub world!"
340314
},
341315
"runtimeAttributes": {
342-
"docker": "ubuntu:latest",
343316
"failOnStderr": false,
344317
"continueOnReturnCode": "0"
345318
},
@@ -388,7 +361,6 @@ It's also possible to set the URL query parameter `expandSubWorkflows` to `true`
388361
"salutation": "Goodbye sub world!"
389362
},
390363
"runtimeAttributes": {
391-
"docker": "ubuntu:latest",
392364
"failOnStderr": false,
393365
"continueOnReturnCode": "0"
394366
},

0 commit comments

Comments
 (0)