Skip to content

Commit 446e2c2

Browse files
committed
Add workflow.report config scopes [e2e prod]
Signed-off-by: Ben Sherman <bentshermann@gmail.com>
1 parent 41759d3 commit 446e2c2

13 files changed

Lines changed: 309 additions & 44 deletions

docs/reference/cli.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1748,7 +1748,7 @@ The `run` command is used to execute a local pipeline script or remote pipeline
17481748
$ nextflow run main.nf -profile docker
17491749
```
17501750

1751-
- Execute a pipeline and generate the summary HTML report. For more information on the metrics, please refer the {ref}`tracing-page` section:
1751+
- Execute a pipeline and generate the summary HTML report. For more information on the metrics, please refer the {ref}`reports-page` section:
17521752

17531753
```console
17541754
$ nextflow run main.nf -with-report

docs/reference/config.md

Lines changed: 107 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -552,6 +552,10 @@ The following settings are available:
552552

553553
## `dag`
554554

555+
:::{deprecated} 26.04.0
556+
Use the `workflow.report.dag` scope instead.
557+
:::
558+
555559
The `dag` scope controls the generation of the {ref}`workflow-diagram`.
556560

557561
The following settings are available:
@@ -1350,6 +1354,10 @@ The following settings are available:
13501354

13511355
## `report`
13521356

1357+
:::{deprecated} 26.04.0
1358+
Use the `workflow.report.execution` scope instead.
1359+
:::
1360+
13531361
The `report` scope controls the generation of the {ref}`execution-report`.
13541362

13551363
The following settings are available:
@@ -1570,6 +1578,10 @@ The following settings are available:
15701578

15711579
## `timeline`
15721580

1581+
:::{deprecated} 26.04.0
1582+
Use the `workflow.report.timeline` scope instead.
1583+
:::
1584+
15731585
The `timeline` scope controls the generation of the {ref}`timeline-report`.
15741586

15751587
The following settings are available:
@@ -1622,6 +1634,10 @@ The following settings are available:
16221634

16231635
## `trace`
16241636

1637+
:::{deprecated} 26.04.0
1638+
Use the `workflow.report.trace` scope instead.
1639+
:::
1640+
16251641
The `trace` scope controls the generation of the {ref}`trace-report`.
16261642

16271643
The following settings are available:
@@ -1905,9 +1921,6 @@ The following settings are available:
19051921

19061922
## `workflow`
19071923

1908-
:::{versionadded} 24.10.0
1909-
:::
1910-
19111924
The `workflow` scope provides workflow execution options.
19121925

19131926
The following settings are available:
@@ -1918,11 +1931,26 @@ The following settings are available:
19181931
: When `true`, the pipeline will exit with a non-zero exit code if any failed tasks are ignored using the `ignore` {ref}`error strategy <process-error-strategy>` (default: `false`).
19191932

19201933
`workflow.onComplete`
1934+
: :::{deprecated} 25.10.0
1935+
Use a {ref}`trace observer <plugins-trace-observers>` in a plugin to add custom workflow handlers to a pipeline via configuration.
1936+
:::
19211937
: Specify a closure that will be invoked at the end of a workflow run (including failed runs). See {ref}`workflow-handlers` for more information.
19221938

19231939
`workflow.onError`
1940+
: :::{deprecated} 25.10.0
1941+
Use a {ref}`trace observer <plugins-trace-observers>` in a plugin to add custom workflow handlers to a pipeline via configuration.
1942+
:::
19241943
: Specify a closure that will be invoked if a workflow run is terminated. See {ref}`workflow-handlers` for more information.
19251944

1945+
### `workflow.output`
1946+
1947+
:::{versionadded} 24.10.0
1948+
:::
1949+
1950+
The `workflow.output` scope controls how workflow outputs are published.
1951+
1952+
The following settings are available:
1953+
19261954
`workflow.output.contentType`
19271955
: *Currently only supported for S3.*
19281956
: Specify the media type, also known as [MIME type](https://developer.mozilla.org/en-US/docs/Web/HTTP/MIME_types), of published files (default: `false`). Can be a string (e.g. `'text/html'`), or `true` to infer the content type from the file extension.
@@ -1995,3 +2023,79 @@ The following settings are available:
19952023
```groovy
19962024
workflow.output.tags = [FOO: 'hello', BAR: 'world']
19972025
```
2026+
2027+
### `workflow.report`
2028+
2029+
:::{versionadded} 26.04.0
2030+
:::
2031+
2032+
The `workflow.report` scope controls the standard {ref}`reports <reports-page>` provided by Nextflow.
2033+
2034+
The following settings are available:
2035+
2036+
**`workflow.report.dag`**
2037+
2038+
`workflow.report.dag.depth`
2039+
: *Supported by the HTML and Mermaid renderers.*
2040+
: Controls the maximum depth at which to render sub-workflows (default: no limit).
2041+
2042+
`workflow.report.dag.direction`
2043+
: *Supported by the Graphviz, DOT, HTML and Mermaid renderers.*
2044+
: Controls the direction of the DAG, can be `'LR'` (left-to-right) or `'TB'` (top-to-bottom) (default: `'TB'`).
2045+
2046+
`workflow.report.dag.enabled`
2047+
: Create the {ref}`workflow-diagram` on workflow completion (default: `false`).
2048+
2049+
`workflow.report.dag.file`
2050+
: DAG file path relative to the output directory (default: `'dag-<timestamp>.html'`).
2051+
: The output format is inferred from the file extension. See {ref}`config-dag` for the list of supported formats.
2052+
2053+
`workflow.report.dag.overwrite`
2054+
: When `true` overwrites any existing DAG file with the same name (default: `false`).
2055+
2056+
`workflow.report.dag.verbose`
2057+
: *Only supported by the HTML and Mermaid renderers.*
2058+
: When `false`, channel names are omitted, operators are collapsed, and empty workflow inputs are removed (default: `false`).
2059+
2060+
**`workflow.report.execution`**
2061+
2062+
`workflow.report.execution.enabled`
2063+
: Create the {ref}`execution-report` on workflow completion (default: `false`).
2064+
2065+
`workflow.report.execution.file`
2066+
: Report file path relative to the output directory (default: `'report-<timestamp>.html'`).
2067+
2068+
`workflow.report.execution.overwrite`
2069+
: Overwrite any existing report file with the same name (default: `false`).
2070+
2071+
**`workflow.report.timeline`**
2072+
2073+
`workflow.report.timeline.enabled`
2074+
: Create the {ref}`timeline-report` on workflow completion (default: `false`).
2075+
2076+
`workflow.report.timeline.file`
2077+
: Timeline file path relative to the output directory (default: `'timeline-<timestamp>.html'`).
2078+
2079+
`workflow.report.timeline.overwrite`
2080+
: Overwrite any existing timeline file with the same name (default: `false`).
2081+
2082+
**`workflow.report.trace`**
2083+
2084+
`workflow.report.trace.enabled`
2085+
: Create the {ref}`trace-report` on workflow completion (default: `false`).
2086+
2087+
`workflow.report.trace.fields`
2088+
: Comma-separated list of fields to include in the trace file.
2089+
: See {ref}`config-trace` for the list of available fields.
2090+
2091+
`workflow.report.trace.file`
2092+
: Trace file path relative to the output directory (default: `'trace-<timestamp>.txt'`).
2093+
2094+
`workflow.report.trace.overwrite`
2095+
: Overwrite any existing trace file with the same name (default: `false`).
2096+
2097+
`workflow.report.trace.raw`
2098+
: Report trace metrics as raw numbers where applicable, i.e. report duration values in milliseconds and memory values in bytes (default: `false`).
2099+
2100+
`workflow.report.trace.sep`
2101+
: Character used to separate values in each row (default: `\t`).

docs/reports.md

Lines changed: 73 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
(tracing-page)=
1+
(reports-page)=
22

33
# Reports
44

@@ -121,6 +121,24 @@ report {
121121

122122
See {ref}`config-report` for the list of available config options.
123123

124+
:::{versionadded} 26.04.0
125+
:::
126+
127+
Use the `workflow.report.execution` scope instead:
128+
129+
```groovy
130+
workflow {
131+
report {
132+
execution {
133+
enabled = true
134+
file = 'report.html'
135+
}
136+
}
137+
}
138+
```
139+
140+
It will automatically create the execution report in the pipeline output directory instead of the launch directory.
141+
124142
### Summary
125143

126144
The **Summary** section reports the execution status, the launch command, overall execution time, and other workflow metadata:
@@ -185,6 +203,24 @@ timeline {
185203

186204
See {ref}`config-timeline` for the list of available config options.
187205

206+
:::{versionadded} 26.04.0
207+
:::
208+
209+
Use the `workflow.report.timeline` scope instead:
210+
211+
```groovy
212+
workflow {
213+
report {
214+
timeline {
215+
enabled = true
216+
file = 'timeline.html'
217+
}
218+
}
219+
}
220+
```
221+
222+
It will automatically create the timeline report in the pipeline output directory instead of the launch directory.
223+
188224
(trace-report)=
189225

190226
## Trace file
@@ -231,6 +267,24 @@ trace {
231267

232268
See {ref}`config-trace` for the list of available config options.
233269

270+
:::{versionadded} 26.04.0
271+
:::
272+
273+
Use the `workflow.report.trace` scope instead:
274+
275+
```groovy
276+
workflow {
277+
report {
278+
trace {
279+
enabled = true
280+
file = 'trace.txt'
281+
}
282+
}
283+
}
284+
```
285+
286+
It will automatically create the trace report in the pipeline output directory instead of the launch directory.
287+
234288
(workflow-diagram)=
235289

236290
## Workflow diagram
@@ -259,3 +313,21 @@ nextflow run rnaseq-nf -preview -with-dag
259313
```
260314

261315
See {ref}`config-dag` for the list of available config options.
316+
317+
:::{versionadded} 26.04.0
318+
:::
319+
320+
Use the `workflow.report.dag` scope instead:
321+
322+
```groovy
323+
workflow {
324+
report {
325+
dag {
326+
enabled = true
327+
file = 'dag.html'
328+
}
329+
}
330+
}
331+
```
332+
333+
It will automatically create the DAG report in the pipeline output directory instead of the launch directory.

modules/nextflow/src/main/groovy/nextflow/config/WorkflowConfig.groovy

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ import nextflow.config.spec.ConfigOption
2020
import nextflow.config.spec.ConfigScope
2121
import nextflow.config.spec.ScopeName
2222
import nextflow.script.dsl.Description
23+
import nextflow.trace.config.DagConfig
24+
import nextflow.trace.config.ReportConfig
25+
import nextflow.trace.config.TimelineConfig
26+
import nextflow.trace.config.TraceConfig
2327

2428
@ScopeName("workflow")
2529
@Description("""
@@ -34,25 +38,34 @@ class WorkflowConfig implements ConfigScope {
3438
""")
3539
final boolean failOnIgnore
3640

41+
@Deprecated
3742
@ConfigOption
3843
@Description("""
3944
Specify a closure that will be invoked at the end of a workflow run (including failed runs).
4045
""")
4146
final Closure onComplete
4247

48+
@Deprecated
4349
@ConfigOption
4450
@Description("""
4551
Specify a closure that will be invoked if a workflow run is terminated.
4652
""")
4753
final Closure onError
4854

4955
@Description("""
50-
The `workflow.output` scope provides options for publishing workflow outputs.
51-
56+
The `workflow.output` scope controls how workflow outputs are published.
57+
5258
[Read more](https://nextflow.io/docs/latest/reference/config.html#workflow)
5359
""")
5460
final WorkflowOutputConfig output
5561

62+
@Description("""
63+
The `workflow.report` scope controls the standard reports provided by Nextflow.
64+
65+
[Read more](https://nextflow.io/docs/latest/reference/config.html#workflow)
66+
""")
67+
final WorkflowReportConfig report
68+
5669
/* required by extension point -- do not remove */
5770
WorkflowConfig() {}
5871

@@ -61,6 +74,7 @@ class WorkflowConfig implements ConfigScope {
6174
onComplete = opts.onComplete as Closure
6275
onError = opts.onError as Closure
6376
output = new WorkflowOutputConfig(opts.output as Map ?: Collections.emptyMap())
77+
report = new WorkflowReportConfig(opts.report as Map ?: Collections.emptyMap())
6478
}
6579

6680
}
@@ -124,9 +138,6 @@ class WorkflowOutputConfig implements ConfigScope {
124138
""")
125139
final Map tags
126140

127-
/* required by extension point -- do not remove */
128-
WorkflowOutputConfig() {}
129-
130141
WorkflowOutputConfig(Map opts) {
131142
contentType = opts.contentType
132143
copyAttributes = opts.copyAttributes as boolean
@@ -139,3 +150,23 @@ class WorkflowOutputConfig implements ConfigScope {
139150
}
140151

141152
}
153+
154+
@CompileStatic
155+
class WorkflowReportConfig implements ConfigScope {
156+
157+
final DagConfig dag
158+
159+
final ReportConfig execution
160+
161+
final TimelineConfig timeline
162+
163+
final TraceConfig trace
164+
165+
WorkflowReportConfig(Map opts) {
166+
dag = new DagConfig(opts.dag as Map ?: Collections.emptyMap())
167+
execution = new ReportConfig(opts.execution as Map ?: Collections.emptyMap())
168+
timeline = new TimelineConfig(opts.timeline as Map ?: Collections.emptyMap())
169+
trace = new TraceConfig(opts.trace as Map ?: Collections.emptyMap())
170+
}
171+
172+
}

0 commit comments

Comments
 (0)