Skip to content

Commit 0f92282

Browse files
authored
Implement retry strategy for Git repository provider (#6195)
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
1 parent ae07c96 commit 0f92282

File tree

12 files changed

+500
-162
lines changed

12 files changed

+500
-162
lines changed

docs/reference/config.md

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,10 +1185,26 @@ Read the {ref}`sharing-page` page to learn how to publish your pipeline to GitHu
11851185

11861186
## `nextflow`
11871187

1188-
:::{deprecated} 24.10.0
1189-
The `nextflow.publish` scope has been renamed to `workflow.output`. See {ref}`config-workflow` for more information.
1188+
:::{versionchanged} 24.10.0
1189+
The `nextflow.publish.retryPolicy` settings were moved to `workflow.output.retryPolicy`.
11901190
:::
11911191

1192+
:::{versionchanged} 25.06.0-edge
1193+
The `workflow.output.retryPolicy` settings were moved to `nextflow.retryPolicy`.
1194+
:::
1195+
1196+
`retryPolicy.delay`
1197+
: Delay used for retryable operations (default: `350ms`).
1198+
1199+
`retryPolicy.jitter`
1200+
: Jitter value used for retryable operations (default: `0.25`).
1201+
1202+
`retryPolicy.maxAttempts`
1203+
: Max attempts used for retryable operations (default: `5`).
1204+
1205+
`retryPolicy.maxDelay`
1206+
: Max delay used for retryable operations (default: `90s`).
1207+
11921208
(config-notification)=
11931209

11941210
## `notification`
@@ -1644,18 +1660,6 @@ The `workflow` scope provides workflow execution options.
16441660
`'standard'`
16451661
: Overwrite existing files when the file size or last modified timestamp is different.
16461662

1647-
`workflow.output.retryPolicy.delay`
1648-
: Delay when retrying a failed publish operation (default: `350ms`).
1649-
1650-
`workflow.output.retryPolicy.jitter`
1651-
: Jitter value when retrying a failed publish operation (default: `0.25`).
1652-
1653-
`workflow.output.retryPolicy.maxAttempt`
1654-
: Max attempts when retrying a failed publish operation (default: `5`).
1655-
1656-
`workflow.output.retryPolicy.maxDelay`
1657-
: Max delay when retrying a failed publish operation (default: `90s`).
1658-
16591663
`workflow.output.storageClass`
16601664
: *Currently only supported for S3.*
16611665
: Specify the storage class for published files.

docs/reference/env-vars.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,26 @@ The following environment variables control the configuration of the Nextflow ru
166166
:::
167167
: Defines the default behavior of `publishDir.failOnError` setting. See {ref}`publishDir<process-publishdir>` directive for more information.
168168

169+
`NXF_RETRY_POLICY_DELAY`
170+
: :::{versionadded} 25.06.0-edge
171+
:::
172+
: Delay used for HTTP retryable operations (default: `350ms`).
173+
174+
`NXF_RETRY_POLICY_JITTER`
175+
: :::{versionadded} 25.06.0-edge
176+
:::
177+
: Jitter value used for HTTP retryable operations (default: `0.25`).
178+
179+
`NXF_RETRY_POLICY_MAX_ATTEMPTS`
180+
: :::{versionadded} 25.06.0-edge
181+
:::
182+
: Max number of attempts used for HTTP retryable operations (default: `5`).
183+
184+
`NXF_RETRY_POLICY_MAX_DELAY`
185+
: :::{versionadded} 25.06.0-edge
186+
:::
187+
: Max delay used for HTTP retryable operations (default: `90s`).
188+
169189
`NXF_SCM_FILE`
170190
: :::{versionadded} 20.10.0
171191
:::

modules/nextflow/src/main/groovy/nextflow/processor/PublishDir.groovy

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ import nextflow.file.TagAwareFile
5252
import nextflow.trace.event.FilePublishEvent
5353
import nextflow.util.HashBuilder
5454
import nextflow.util.PathTrie
55+
import nextflow.util.RetryConfig
5556
/**
5657
* Implements the {@code publishDir} directory. It create links or copies the output
5758
* files of a given task to a user specified directory.
@@ -127,7 +128,7 @@ class PublishDir {
127128
*/
128129
private String storageClass
129130

130-
private PublishRetryConfig retryConfig
131+
private RetryConfig retryConfig
131132

132133
private PathMatcher matcher
133134

@@ -231,19 +232,10 @@ class PublishDir {
231232
return result
232233
}
233234

234-
protected Map getRetryOpts() {
235-
def result = session.config.navigate('nextflow.publish.retryPolicy') as Map
236-
if( result != null )
237-
log.warn 'The `nextflow.publish` config scope has been renamed to `workflow.output`'
238-
else
239-
result = session.config.navigate('workflow.output.retryPolicy') as Map ?: Collections.emptyMap()
240-
return result
241-
}
242-
243235
protected void apply0(Set<Path> files) {
244236
assert path
245237
// setup the retry policy config to be used
246-
this.retryConfig = new PublishRetryConfig(getRetryOpts())
238+
this.retryConfig = RetryConfig.config(session)
247239

248240
createPublishDir()
249241
validatePublishMode()

modules/nextflow/src/main/groovy/nextflow/processor/PublishRetryConfig.groovy

Lines changed: 0 additions & 53 deletions
This file was deleted.

modules/nextflow/src/main/groovy/nextflow/scm/AzureRepositoryProvider.groovy

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,14 +161,14 @@ final class AzureRepositoryProvider extends RepositoryProvider {
161161
* Check for response error status. Throws a {@link nextflow.exception.AbortOperationException} exception
162162
* when a 401 or 403 error status is returned.
163163
*
164-
* @param connection A {@link HttpURLConnection} connection instance
164+
* @param response A {@link HttpURLConnection} connection instance
165165
*/
166-
protected checkResponse( HttpResponse<String> connection ) {
167-
this.continuationToken = connection
166+
protected checkResponse( HttpResponse<String> response) {
167+
this.continuationToken = response
168168
.headers()
169169
.firstValue("x-ms-continuationtoken")
170170
.orElse(null)
171-
super.checkResponse(connection)
171+
super.checkResponse(response)
172172
}
173173

174174
/** {@inheritDoc} */

0 commit comments

Comments
 (0)