Skip to content
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
10 changes: 10 additions & 0 deletions docs/reference/env-vars.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,11 @@ The following environment variables control the configuration of the Nextflow ru
`NXF_PLUGINS_DIR`
: The path where the plugin archives are loaded and stored (default: `$NXF_HOME/plugins`).

`NXF_PLUGINS_REGISTRY_URL`
: :::{versionadded} 25.08.0-edge
:::
: Specifies the URL of the plugin registry used to download and resolve plugins. This allows using custom or private plugin registries instead of the default public registry.

`NXF_PLUGINS_TEST_REPOSITORY`
: :::{versionadded} 23.04.0
:::
Expand Down Expand Up @@ -191,6 +196,11 @@ The following environment variables control the configuration of the Nextflow ru
:::
: Max delay used for HTTP retryable operations (default: `90s`).

`NXF_RETRY_POLICY_MULTIPLIER`
: :::{versionadded} 25.08.0-edge
:::
: Delay multiplier used for HTTP retryable operations (default: `2.0`).

`NXF_SCM_FILE`
: :::{versionadded} 20.10.0
:::
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ class PublishDir {
protected void apply0(Set<Path> files) {
assert path
// setup the retry policy config to be used
this.retryConfig = RetryConfig.config(session)
this.retryConfig = RetryConfig.config(session.config)

createPublishDir()
validatePublishMode()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2013-2024, Seqera Labs
* Copyright 2013-2025, Seqera Labs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -18,13 +18,10 @@ package nextflow.util

import java.nio.file.Path

import com.google.common.base.CaseFormat
import groovy.json.JsonOutput
import groovy.transform.CompileDynamic
import groovy.transform.CompileStatic
import groovy.transform.PackageScope
import groovy.util.logging.Slf4j
import nextflow.SysEnv
import nextflow.config.ConfigClosurePlaceholder
import org.codehaus.groovy.runtime.InvokerHelper
import org.yaml.snakeyaml.DumperOptions
Expand Down Expand Up @@ -370,37 +367,5 @@ class ConfigHelper {
return value
}

static <T> T valueOf(Map config, String name, String prefix, T defValue, Class<T> type) {
assert name, "Argument 'name' cannot be null or empty"
assert type, "Argument 'type' cannot be null"

// try to get the value from the config map
final cfg = config?.get(name)
if( cfg != null ) {
return toType(cfg, type)
}
// try to fallback to the sys environment
if( !prefix.endsWith('_') )
prefix += '_'
final key = prefix.toUpperCase() + CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, name)
final env = SysEnv.get(key)
if( env != null ) {
return toType(env, type)
}
// return the default value
return defValue
}

@CompileDynamic
static protected <T> T toType(Object value, Class<T> type) {
if( value == null )
return null
if( type==Boolean.class ) {
return type.cast(Boolean.valueOf(value.toString()))
}
else {
return value.asType(type)
}
}
}

87 changes: 0 additions & 87 deletions modules/nextflow/src/main/groovy/nextflow/util/RetryConfig.groovy

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,9 @@ package nextflow.util
import java.nio.file.Files
import java.nio.file.Paths

import nextflow.SysEnv
import nextflow.config.ConfigClosurePlaceholder
import spock.lang.Specification
import spock.lang.Unroll

/**
*
* @author Paolo Di Tommaso <paolo.ditommaso@gmail.com>
Expand Down Expand Up @@ -354,72 +352,5 @@ class ConfigHelperTest extends Specification {
"withName:2foo" | "'withName:2foo'" | "withName:'2foo'"
}

@Unroll
def 'should get config from map' () {
given:
def NAME = 'foo'
def PREFIX = 'P_'
and:
SysEnv.push(ENV)

expect:
ConfigHelper.valueOf(CONFIG, NAME, PREFIX, DEF_VAL, DEF_TYPE) == EXPECTED

cleanup:
SysEnv.pop()

where:
CONFIG | ENV | DEF_VAL | DEF_TYPE | EXPECTED
null | [:] | null | String | null
[:] | [:] | null | String | null
[:] | [:] | 'one' | String | 'one'
[foo:'two'] | [:] | 'one' | String | 'two'
[foo:''] | [:] | 'one' | String | ''
[foo:'two'] | [P_FOO:'bar'] | 'one' | String | 'two'
[:] | [P_FOO:'bar'] | 'one' | String | 'bar'

and:
null | [:] | null | Integer | null
[:] | [:] | null | Integer | null
[:] | [:] | 1 | Integer | 1
[foo:2] | [:] | 1 | Integer | 2
[foo:'2'] | [:] | 1 | Integer | 2
[foo:'2'] | [P_FOO:'3'] | 1 | Integer | 2
[:] | [P_FOO:'3'] | 1 | Integer | 3

and:
null | [:] | null | Boolean | null
[:] | [:] | true | Boolean | true
[foo:false] | [:] | true | Boolean | false
[foo:'false'] | [:] | true | Boolean | false
[foo:true] | [:] | false | Boolean | true
[foo:'true'] | [:] | false | Boolean | true
[foo:'true'] | [P_FOO:'false']| null | Boolean | true
[:] | [P_FOO:'false']| null | Boolean | false
[:] | [P_FOO:'true'] | null | Boolean | true

and:
[:] | [:] | Duration.of('1s') | Duration | Duration.of('1s')
[foo:'10ms'] | [:] | null | Duration | Duration.of('10ms')
[:] | [P_FOO:'1s'] | null | Duration | Duration.of('1s')
}

def 'should map camelCase to snake uppercase' () {
given:
SysEnv.push(ENV)

expect:
ConfigHelper.valueOf([:], NAME, PREFIX, null, String) == EXPECTED

cleanup:
SysEnv.pop()

where:
EXPECTED | PREFIX | NAME | ENV
null | 'foo' | 'bar' | [:]
'one' | 'foo' | 'bar' | [FOO_BAR: 'one']
'one' | 'foo_' | 'bar' | [FOO_BAR: 'one']
'one' | 'foo_' | 'thisAndThat' | [FOO_THIS_AND_THAT: 'one']
}

}

This file was deleted.

2 changes: 2 additions & 0 deletions modules/nf-commons/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ dependencies {
api 'org.pf4j:pf4j:3.12.0'
api 'org.pf4j:pf4j-update:2.3.0'
api 'dev.failsafe:failsafe:3.1.0'
api 'io.seqera:lib-httpx:1.0.0'
api 'io.seqera:lib-retry:1.2.0'
// patch gson dependency required by pf4j
api 'com.google.code.gson:gson:2.13.1'

Expand Down
Loading
Loading