Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to override failOnError setting default via env variable #5117

Merged
merged 4 commits into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -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<process-publishdir>` directive for more information.

`NXF_SCM_FILE`
: :::{versionadded} 20.10.0
:::
Expand Down
3 changes: 1 addition & 2 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
sphinxext-rediraffe==0.2.7
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
/**
Expand Down Expand Up @@ -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
}
}
Loading