Skip to content

Commit

Permalink
Consolidate Wave retryPolicy options
Browse files Browse the repository at this point in the history
Signed-off-by: Paolo Di Tommaso <[email protected]>
  • Loading branch information
pditommaso committed Jun 9, 2023
1 parent 1433a90 commit 7d7464f
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 6 deletions.
16 changes: 12 additions & 4 deletions docs/wave.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,14 +202,22 @@ The following configuration options are available:
`wave.report.file` (preview)
: The name of the containers report file (default: `containers-<timestamp>.config` requires version `23.06.0-edge` or later).

`wave.retry.delay`
`wave.retryPolicy.delay`
: :::{versionadded} 22.06.0-edge
:::
: The initial delay when a failing HTTP request is retried (default: `150ms`).

`wave.retry.maxDelay`
`wave.retryPolicy.maxDelay`
: :::{versionadded} 22.06.0-edge
:::
: The max delay when a failing HTTP request is retried (default: `90 seconds`).

`wave.retry.maxAttempts`
`wave.retryPolicy.maxAttempts`
: :::{versionadded} 22.06.0-edge
:::
: The max number of attempts a failing HTTP request is retried (default: `5`).

`wave.retry.jitter`
`wave.retryPolicy.jitter`
: :::{versionadded} 22.06.0-edge
:::
: Sets the jitterFactor to randomly vary retry delays by (default: `0.25`).
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class WaveConfig {
this.strategy = parseStrategy(opts.strategy)
this.bundleProjectResources = opts.bundleProjectResources
this.reportOpts = new ReportOpts(opts.report as Map ?: Map.of())
this.retryOpts = new RetryOpts(opts.retry as Map ?: Map.of())
this.retryOpts = new RetryOpts(opts.retryPolicy as Map ?: Map.of())
if( !endpoint.startsWith('http://') && !endpoint.startsWith('https://') )
throw new IllegalArgumentException("Endpoint URL should start with 'http:' or 'https:' protocol prefix - offending value: $endpoint")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

package io.seqera.wave.plugin.config


import nextflow.util.Duration
import spock.lang.Specification
import spock.lang.Unroll

Expand Down Expand Up @@ -168,4 +168,20 @@ class WaveConfigTest extends Specification {
def e = thrown(IllegalArgumentException)
e.message == "Invalid value for 'wave.strategy' configuration attribute - offending value: foo"
}

def 'should get retry policy' () {
when:
def opts = new WaveConfig([:])
then:
opts.retryOpts().maxAttempts == 5
opts.retryOpts().maxDelay == Duration.of('90s')

when:
opts = new WaveConfig([retryPolicy:[ maxAttempts: 20, jitter: 1.0, delay: '1s', maxDelay: '10s' ]])
then:
opts.retryOpts().maxAttempts == 20
opts.retryOpts().jitter == 1.0d
opts.retryOpts().delay == Duration.of('1s')
opts.retryOpts().maxDelay == Duration.of('10s')
}
}

0 comments on commit 7d7464f

Please sign in to comment.