From db8e8b0e8c207919991acf405ed91976dc5b0d6d Mon Sep 17 00:00:00 2001 From: Lehmann_Fabian Date: Fri, 28 Jul 2023 10:07:42 +0200 Subject: [PATCH 1/3] Allow to skip publishDir Signed-off-by: Lehmann_Fabian --- docs/process.md | 31 +++++++++++++++++++ .../nextflow/processor/TaskConfig.groovy | 2 +- .../nextflow/processor/TaskConfigTest.groovy | 17 ++++++++++ 3 files changed, 49 insertions(+), 1 deletion(-) diff --git a/docs/process.md b/docs/process.md index db7a594aca..72217f4947 100644 --- a/docs/process.md +++ b/docs/process.md @@ -2018,6 +2018,10 @@ process foo { Files are copied into the specified directory in an *asynchronous* manner, so they may not be immediately available in the publish directory at the end of the process execution. For this reason, downstream processes should not try to access output files through the publish directory, but through channels. ::: +:::{tip} +To skip all publishDir directives for a process, set the `skipPublishDir` directive for the according process. +::: + Available options: `contentType` @@ -2066,6 +2070,33 @@ Available options: : *Experimental: currently only supported for S3.* : Allow the association of arbitrary tags with the published file e.g. `tags: [FOO: 'Hello world']`. +(process-skippublishdir)= + +### skipPublishDir +`contentType` +: :::{versionadded} 23.08.0-edge +::: +The `publishDir` directives for one task can be spread over the workflow file and many config files. Each `publishDir` has to be disabled individually. To skip all publishDir directives at once for a process, set the `skipPublishDir` directive for the according process. + +```groovy +process foo { + publishDir '/data/chunks1', mode: 'copy', overwrite: false + publishDir '/data/chunks2', mode: 'copy', overwrite: false + publishDir '/data/chunks3', mode: 'copy', overwrite: false + skipPublishDir true + + output: + path 'chunk_*' + + ''' + printf 'Hola' | split -b 1 - chunk_ + ''' +} +``` + +```groovy + + (process-queue)= ### queue diff --git a/modules/nextflow/src/main/groovy/nextflow/processor/TaskConfig.groovy b/modules/nextflow/src/main/groovy/nextflow/processor/TaskConfig.groovy index cf88eab3af..907b730b6e 100644 --- a/modules/nextflow/src/main/groovy/nextflow/processor/TaskConfig.groovy +++ b/modules/nextflow/src/main/groovy/nextflow/processor/TaskConfig.groovy @@ -354,7 +354,7 @@ class TaskConfig extends LazyMap implements Cloneable { List getPublishDir() { def dirs = get('publishDir') - if( !dirs ) { + if( !dirs || target.skipPublishDir ) { return Collections.emptyList() } diff --git a/modules/nextflow/src/test/groovy/nextflow/processor/TaskConfigTest.groovy b/modules/nextflow/src/test/groovy/nextflow/processor/TaskConfigTest.groovy index d290723992..fdac6fcc43 100644 --- a/modules/nextflow/src/test/groovy/nextflow/processor/TaskConfigTest.groovy +++ b/modules/nextflow/src/test/groovy/nextflow/processor/TaskConfigTest.groovy @@ -490,6 +490,23 @@ class TaskConfigTest extends Specification { } + def 'should skip publishDir object' () { + + setup: + def script = Mock(BaseScript) + ProcessConfig process + List publish + + when: + process = new ProcessConfig(script) + process.publishDir '/data' + process.skipPublishDir = true + publish = process.createTaskConfig().getPublishDir() + then: + publish.isEmpty() + + } + def 'should create publishDir with local variables' () { given: From cb6f6445de3507cd019040276abe81e0cfa5710e Mon Sep 17 00:00:00 2001 From: Lehmann_Fabian Date: Fri, 28 Jul 2023 10:14:17 +0200 Subject: [PATCH 2/3] Fix docs Signed-off-by: Lehmann_Fabian --- docs/process.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/docs/process.md b/docs/process.md index 72217f4947..a60b4b0c34 100644 --- a/docs/process.md +++ b/docs/process.md @@ -2094,9 +2094,6 @@ process foo { } ``` -```groovy - - (process-queue)= ### queue From 188c10164c78a8744f2ff3a74240b2db9d105547 Mon Sep 17 00:00:00 2001 From: Lehmann_Fabian Date: Fri, 28 Jul 2023 10:18:29 +0200 Subject: [PATCH 3/3] Fix docs Signed-off-by: Lehmann_Fabian --- docs/process.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/process.md b/docs/process.md index a60b4b0c34..de563b50e4 100644 --- a/docs/process.md +++ b/docs/process.md @@ -2073,9 +2073,10 @@ Available options: (process-skippublishdir)= ### skipPublishDir -`contentType` -: :::{versionadded} 23.08.0-edge + +:::{versionadded} 23.08.0-edge ::: + The `publishDir` directives for one task can be spread over the workflow file and many config files. Each `publishDir` has to be disabled individually. To skip all publishDir directives at once for a process, set the `skipPublishDir` directive for the according process. ```groovy