Skip to content

Commit 7eab4f6

Browse files
committed
added retry errorStrategy
1 parent 742b12c commit 7eab4f6

4 files changed

Lines changed: 24 additions & 0 deletions

File tree

process/score_download.nf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ params.mem = 20
77

88
params.publish_dir = ""
99

10+
params.max_retries = 5 // set to 0 will disable retry
11+
params.first_retry_wait_time = 1 // in seconds
12+
1013
// required params w/ default
1114
params.container_version = "5.0.0"
1215
params.transport_mem = 2 // Transport memory is in number of GBs
@@ -20,6 +23,12 @@ params.api_token = "" // song/score API token for download process
2023

2124
// TODO: Replace with score container once it can download files via analysis_id
2225
process scoreDownload {
26+
maxRetries params.max_retries
27+
errorStrategy {
28+
sleep(Math.pow(2, task.attempt) * params.first_retry_wait_time * 1000 as long); // backoff time increases exponentially before each retry
29+
return params.max_retries ? 'retry' : 'terminate'
30+
}
31+
2332
pod = [secret: workflow.runName + "-secret", mountPath: "/tmp/rdpc_secret"]
2433

2534
cpus params.cpus

process/song_get_analysis.nf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ params.mem = 1
77

88
params.publish_dir = ""
99

10+
params.max_retries = 5 // set to 0 will disable retry
11+
params.first_retry_wait_time = 1 // in seconds
12+
1013
// required params w/ default
1114
params.container_version = "4.2.1"
1215

@@ -18,6 +21,12 @@ params.api_token = "" // song/score API token for download process
1821
// --score_url score url for download process
1922

2023
process songGetAnalysis {
24+
maxRetries params.max_retries
25+
errorStrategy {
26+
sleep(Math.pow(2, task.attempt) * params.first_retry_wait_time * 1000 as long); // backoff time increases exponentially before each retry
27+
return params.max_retries ? 'retry' : 'terminate'
28+
}
29+
2130
pod = [secret: workflow.runName + "-secret", mountPath: "/tmp/rdpc_secret"]
2231

2332
cpus params.cpus

song-score-download/main.nf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ params.container = ""
2727
params.container_registry = ""
2828
params.publish_dir = "" // set to empty string will disable publishDir
2929

30+
params.max_retries = 5 // set to 0 will disable retry
31+
params.first_retry_wait_time = 1 // in seconds
32+
3033
// tool specific parmas go here, add / change as needed
3134
params.study_id = "TEST-PR"
3235
params.analysis_id = "9940db0f-c100-496a-80db-0fc100d96ac1"

song-score-download/tests/checker.nf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ version = '2.6.0' // package version
3030
// universal params
3131
params.publish_dir = ""
3232

33+
params.max_retries = 5 // set to 0 will disable retry
34+
params.first_retry_wait_time = 1 // in seconds
35+
3336
// tool specific parmas go here, add / change as needed
3437
params.study_id = ""
3538
params.analysis_id = ""

0 commit comments

Comments
 (0)