From cab334fcf5ed2649e4295d19b3ba963969138259 Mon Sep 17 00:00:00 2001 From: adamrtalbot <12817534+adamrtalbot@users.noreply.github.com> Date: Mon, 19 May 2025 11:58:50 +0100 Subject: [PATCH 1/2] feat: New output syntax --- main.nf | 24 +++++++++++++++++------- nextflow.config | 19 ++++++++++--------- 2 files changed, 27 insertions(+), 16 deletions(-) diff --git a/main.nf b/main.nf index a2c7484..c45c6f9 100644 --- a/main.nf +++ b/main.nf @@ -1,3 +1,5 @@ +nextflow.preview.output = true + process TEST_SUCCESS { /* This process should automatically succeed @@ -143,9 +145,6 @@ process TEST_PUBLISH_FILE { Creates a file on the worker node and uploads to the publish directory. */ - - publishDir { params.outdir ?: file(workflow.workDir).resolve("outputs").toUriString() }, mode: 'copy' - output: path("*.txt") @@ -160,8 +159,6 @@ process TEST_PUBLISH_FOLDER { Creates a file on the worker node and uploads to the publish directory. */ - publishDir { params.outdir ?: file(workflow.workDir).resolve("outputs").toUriString() }, mode: 'copy' - output: path("test", type: 'dir') @@ -362,7 +359,7 @@ workflow NF_CANARY { TEST_MV_FILE() TEST_MV_FOLDER_CONTENTS() TEST_VAL_INPUT("Hello World") - + TEST_GPU( dummy.filter { params.gpu } ) // POC of emitting the channel Channel.empty() @@ -390,5 +387,18 @@ workflow NF_CANARY { } workflow { - NF_CANARY() + main: + NF_CANARY().collect() + + publish: + outputs = NF_CANARY.out.collect() } + +output { + outputs { + path "." + index { + path params.output_index + } + } +} \ No newline at end of file diff --git a/nextflow.config b/nextflow.config index 8edb0c6..db5f012 100644 --- a/nextflow.config +++ b/nextflow.config @@ -1,17 +1,18 @@ params { - skip = '' - gpu = false - run = null - outdir = null - remoteFile = null - container = "quay.io/biocontainers/ubuntu:24.04" + skip = '' + gpu = false + run = null + outdir = null + remoteFile = null + output_index = "outputs.json" + container = "quay.io/biocontainers/ubuntu:24.04" } process { container = params.container errorStrategy = "finish" - when = { - ( params.run ? params.run.split(',').any{ "NF_CANARY:${it.toUpperCase()}".contains(task.process) } : true ) && - (!params.skip.split(',').any{ "NF_CANARY:${it.toUpperCase()}".contains(task.process) } ) + when = { + ( params.run ? params.run.split(',').any{ "NF_CANARY:${it.toUpperCase()}".contains(task.process) } : true ) && + (!params.skip.split(',').any{ "NF_CANARY:${it.toUpperCase()}".contains(task.process) } ) } } From 4f4e05ca6ea0281ec7befd69cf5188cf66c37ee1 Mon Sep 17 00:00:00 2001 From: adamrtalbot <12817534+adamrtalbot@users.noreply.github.com> Date: Mon, 19 May 2025 11:59:13 +0100 Subject: [PATCH 2/2] Re-add old publishDir syntax back for continuity --- main.nf | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/main.nf b/main.nf index c45c6f9..ebb7974 100644 --- a/main.nf +++ b/main.nf @@ -145,6 +145,9 @@ process TEST_PUBLISH_FILE { Creates a file on the worker node and uploads to the publish directory. */ + + publishDir { params.outdir ?: file(workflow.workDir).resolve("outputs").toUriString() }, mode: 'copy' + output: path("*.txt") @@ -159,6 +162,8 @@ process TEST_PUBLISH_FOLDER { Creates a file on the worker node and uploads to the publish directory. */ + publishDir { params.outdir ?: file(workflow.workDir).resolve("outputs").toUriString() }, mode: 'copy' + output: path("test", type: 'dir')