You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add new syntax for workflow onComplete and onError as sections in the entry workflow instead of closure calls. Deprecate config workflow handlers, as this kind of code should be implemented in a plugin trace observer.
---------
Signed-off-by: Ben Sherman <[email protected]>
Co-authored-by: Chris Hakkaart <[email protected]>
Copy file name to clipboardExpand all lines: docs/migrations/25-10.md
+25Lines changed: 25 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,6 +8,31 @@ This page summarizes the upcoming changes in Nextflow 25.10, which will be relea
8
8
This page is a work in progress and will be updated as features are finalized. It should not be considered complete until the 25.10 release.
9
9
:::
10
10
11
+
## Enhancements
12
+
13
+
<h3>New syntax for workflow handlers</h3>
14
+
15
+
The workflow `onComplete` and `onError` handlers were previously defined by calling `workflow.onComplete` and `workflow.onError` in the pipeline script. You can now define handlers as `onComplete` and `onError` sections in an entry workflow:
16
+
17
+
```nextflow
18
+
workflow {
19
+
main:
20
+
// ...
21
+
22
+
onComplete:
23
+
println "workflow complete"
24
+
25
+
onError:
26
+
println "error: ${workflow.errorMessage}"
27
+
}
28
+
```
29
+
30
+
This syntax is simpler and easier to use with the {ref}`strict syntax <strict-syntax-page>`. See {ref}`workflow-handlers` for details.
31
+
11
32
## Breaking changes
12
33
13
34
- The AWS Java SDK used by Nextflow was upgraded from v1 to v2, which introduced some breaking changes to the `aws.client` config options. See {ref}`the guide <aws-java-sdk-v2-page>` for details.
35
+
36
+
## Deprecations
37
+
38
+
- The use of workflow handlers in the configuration file has been deprecated. You should define workflow handlers in the pipeline script or a plugin instead. See {ref}`config-workflow-handlers` for details.
Both the `onError` and `onComplete` handlers are invoked when an error condition is encountered. The first is called as soon as the error is raised, while the second is called just before the pipeline execution is about to terminate. When using the `finish` {ref}`process-error-strategy`, there may be a significant gap between the two, depending on the time required to complete any pending job.
40
56
:::
41
57
58
+
:::{versionadded} 25.10.0
59
+
:::
60
+
61
+
Entry workflows can define an `onError` section instead of using `workflow.onError`:
62
+
63
+
```nextflow
64
+
workflow {
65
+
main:
66
+
// ...
67
+
68
+
onError:
69
+
println "Error: Pipeline execution stopped with the following message: ${workflow.errorMessage}"
70
+
}
71
+
```
72
+
42
73
## Mail
43
74
44
75
The built-in function `sendMail` allows you to send a mail message from a workflow script.
Copy file name to clipboardExpand all lines: docs/reference/syntax.md
+14-8Lines changed: 14 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -123,7 +123,7 @@ Parameters supplied via command line options, params files, and config files tak
123
123
124
124
A workflow can be a *named workflow* or an *entry workflow*.
125
125
126
-
A *named workflow* consists of a name and a body, and may consist of a *take*, *main*, *emit*, and *publish* section:
126
+
A *named workflow* consists of a name and a body, and may consist of a *take*, *main*, and *emit* section:
127
127
128
128
```nextflow
129
129
workflow greet {
@@ -146,28 +146,34 @@ workflow greet {
146
146
147
147
- The emit section consists of one or more *emit statements*. An emit statement can be a [variable name](#variable), an [assignment](#assignment), or an [expression statement](#expression-statement). If an emit statement is an expression statement, it must be the only emit.
148
148
149
-
- The publish section can be specified but is intended to be used in the entry workflow (see below).
150
149
151
-
152
-
An *entry workflow* has no name and may consist of a *main* and *publish* section:
150
+
An *entry workflow* has no name and may consist of a *main*, *publish*, *onComplete*, and *onError* section:
- Only one entry workflow may be defined in a script.
167
171
168
-
- The `main:` section label can be omitted if the publish section is not specified.
172
+
- The `main:` section label can be omitted if the other sections are not specified.
173
+
174
+
- The publish section consists of one or more *publish statements*. A publish statement is an [assignment](#assignment), where the assignment target is the name of a workflow output.
169
175
170
-
- The publish section consists of one or more *publish statements*. A publish statement is a [right-shift expression](#binary-expressions), where the left-hand side is an expression that refers to a value in the workflow body, and the right-hand side is an expression that returns a string.
176
+
- The `onComplete` and `onError` sections consist of one or more [statements](#statements).
171
177
172
178
In order for a script to be executable, it must either define an entry workflow or be a code snippet as described [above](#script-declarations).
0 commit comments