From d2041c9a1a7064ff8b717c63d09bf1d22a3ca8fb Mon Sep 17 00:00:00 2001 From: Paolo Di Tommaso Date: Fri, 5 Jul 2024 15:22:43 +0200 Subject: [PATCH 1/3] Add overrinding failOnError via env variable Signed-off-by: Paolo Di Tommaso --- .../main/groovy/nextflow/processor/PublishDir.groovy | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/modules/nextflow/src/main/groovy/nextflow/processor/PublishDir.groovy b/modules/nextflow/src/main/groovy/nextflow/processor/PublishDir.groovy index a0f1448d72..ee2a5342ee 100644 --- a/modules/nextflow/src/main/groovy/nextflow/processor/PublishDir.groovy +++ b/modules/nextflow/src/main/groovy/nextflow/processor/PublishDir.groovy @@ -16,6 +16,8 @@ package nextflow.processor +import static nextflow.util.CacheHelper.* + import java.nio.file.FileAlreadyExistsException import java.nio.file.FileSystem import java.nio.file.FileSystems @@ -40,15 +42,12 @@ import groovy.util.logging.Slf4j import nextflow.Global import nextflow.NF import nextflow.Session +import nextflow.SysEnv import nextflow.extension.FilesEx import nextflow.file.FileHelper import nextflow.file.TagAwareFile -import nextflow.fusion.FusionHelper import nextflow.util.HashBuilder import nextflow.util.PathTrie - -import static nextflow.util.CacheHelper.HashMode - /** * Implements the {@code publishDir} directory. It create links or copies the output * files of a given task to a user specified directory. @@ -98,9 +97,9 @@ class PublishDir { boolean enabled = true /** - * Trow an exception in case publish fails + * Throw an exception in case publish fails */ - boolean failOnError = true + boolean failOnError = SysEnv.getBool('NXF_PUBLISH_FAIL_ON_ERROR', true) /** * Tags to be associated to the target file From 2cf0d521044cb620fef14b189a6cb8f86107ea8f Mon Sep 17 00:00:00 2001 From: Paolo Di Tommaso Date: Mon, 8 Jul 2024 17:42:47 +0200 Subject: [PATCH 2/3] Revert "fix: docs/requirements.txt to reduce vulnerabilities (#5075) [ci skip]" This reverts commit 455b587bd45e983258e1ecfc903095e488d009f5. --- docs/requirements.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/requirements.txt b/docs/requirements.txt index b470d10bef..06694e6ca0 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -2,5 +2,4 @@ myst-parser==0.18.1 sphinx==5.3.0 sphinx-rtd-theme==1.1.1 sphinxcontrib-mermaid==0.9.2 -sphinxext-rediraffe==0.2.7 -urllib3>=2.2.2 # not directly required, pinned by Snyk to avoid a vulnerability \ No newline at end of file +sphinxext-rediraffe==0.2.7 \ No newline at end of file From d10829f83d53250aff89e8a3dfae02d211b7e354 Mon Sep 17 00:00:00 2001 From: Paolo Di Tommaso Date: Mon, 8 Jul 2024 17:46:52 +0200 Subject: [PATCH 3/3] Update docs + add tests [ci fast] Signed-off-by: Paolo Di Tommaso --- docs/config.md | 5 +++++ .../nextflow/processor/PublishDirTest.groovy | 19 +++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/docs/config.md b/docs/config.md index c55717335c..3c11195df3 100644 --- a/docs/config.md +++ b/docs/config.md @@ -2017,6 +2017,11 @@ The following environment variables control the configuration of the Nextflow ru ::: : Defines a custom plugin registry or plugin release URL for testing plugins outside of the main registry. See {ref}`testing-plugins` for more information. +`NXF_PUBLISH_FAIL_ON_ERROR` +: :::{versionadded} 24.04.3 + ::: +: Defines the default behavior of `publishDir.failOnError` setting. See {ref}`publishDir` directive for more information. + `NXF_SCM_FILE` : :::{versionadded} 20.10.0 ::: diff --git a/modules/nextflow/src/test/groovy/nextflow/processor/PublishDirTest.groovy b/modules/nextflow/src/test/groovy/nextflow/processor/PublishDirTest.groovy index 60f183fb23..4147a65120 100644 --- a/modules/nextflow/src/test/groovy/nextflow/processor/PublishDirTest.groovy +++ b/modules/nextflow/src/test/groovy/nextflow/processor/PublishDirTest.groovy @@ -22,6 +22,7 @@ import java.nio.file.Paths import nextflow.Global import nextflow.Session +import nextflow.SysEnv import spock.lang.Specification import test.TestHelper /** @@ -398,4 +399,22 @@ class PublishDirTest extends Specification { cleanup: folder?.deleteDir() } + + def 'should set failOnError via env variable' () { + given: + SysEnv.push(ENV) + + when: + def publish = new PublishDir() + then: + publish.failOnError == EXPECTED + cleanup: + SysEnv.pop() + + where: + ENV | EXPECTED + [:] | true + [NXF_PUBLISH_FAIL_ON_ERROR: 'true'] | true + [NXF_PUBLISH_FAIL_ON_ERROR: 'false'] | false + } }