Skip to content

Commit 631a2fe

Browse files
committed
Merge branch 'main' into song-score-download@2.6.2
2 parents fa9285b + 4650ed9 commit 631a2fe

20 files changed

Lines changed: 1168 additions & 0 deletions

process/score_upload.nf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ nextflow.enable.dsl=2
55
params.cpus = 8
66
params.mem = 20
77

8+
params.max_retries = 5 // set to 0 will disable retry
9+
params.first_retry_wait_time = 1 // in seconds
10+
811
// required params w/ default
912
params.container_version = "5.0.0"
1013
params.transport_mem = 2 // Transport memory is in number of GBs
@@ -17,6 +20,12 @@ params.api_token = "" // song/score API token for download process
1720
// --score_url score url for download process
1821

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

2231
cpus params.cpus

process/song_manifest.nf

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ nextflow.enable.dsl=2
55
params.cpus = 1
66
params.mem = 1
77

8+
params.publish_dir = ""
9+
10+
params.max_retries = 5 // set to 0 will disable retry
11+
params.first_retry_wait_time = 1 // in seconds
12+
813
// required params w/ default
914
params.container_version = "4.2.1"
1015

@@ -16,6 +21,14 @@ params.api_token = "" // song/score API token for download process
1621
// --score_url score url for download process
1722

1823
process songManifest {
24+
maxRetries params.max_retries
25+
errorStrategy {
26+
sleep(Math.pow(2, task.attempt) * params.first_retry_wait_time * 1000 as long); // backoff time doubles before each retry
27+
return params.max_retries ? 'retry' : 'finish'
28+
}
29+
30+
publishDir "${params.publish_dir}/${task.process.replaceAll(':', '_')}", mode: "copy", enabled: params.publish_dir
31+
1932
pod = [secret: workflow.runName + "-secret", mountPath: "/tmp/rdpc_secret"]
2033

2134
cpus params.cpus

process/song_publish.nf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ nextflow.enable.dsl=2
55
params.cpus = 1
66
params.mem = 1
77

8+
params.max_retries = 5 // set to 0 will disable retry
9+
params.first_retry_wait_time = 1 // in seconds
10+
811
// required params w/ default
912
params.container_version = "4.2.1"
1013

@@ -16,6 +19,12 @@ params.api_token = "" // song/score API token for download process
1619
// --score_url score url for download process
1720

1821
process songPublish {
22+
maxRetries params.max_retries
23+
errorStrategy {
24+
sleep(Math.pow(2, task.attempt) * params.first_retry_wait_time * 1000 as long); // backoff time doubles before each retry
25+
return params.max_retries ? 'retry' : 'finish'
26+
}
27+
1928
pod = [secret: workflow.runName + "-secret", mountPath: "/tmp/rdpc_secret"]
2029

2130
cpus params.cpus

process/song_submit.nf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ nextflow.enable.dsl=2
55
params.cpus = 1
66
params.mem = 1
77

8+
params.max_retries = 5 // set to 0 will disable retry
9+
params.first_retry_wait_time = 1 // in seconds
10+
811
// required params w/ default
912
params.container_version = "4.2.1"
1013

@@ -16,6 +19,12 @@ params.api_token = "" // song/score API token for download process
1619
// --score_url score url for download process
1720

1821
process songSubmit {
22+
maxRetries params.max_retries
23+
errorStrategy {
24+
sleep(Math.pow(2, task.attempt) * params.first_retry_wait_time * 1000 as long); // backoff time doubles before each retry
25+
return params.max_retries ? 'retry' : 'finish'
26+
}
27+
1928
pod = [secret: workflow.runName + "-secret", mountPath: "/tmp/rdpc_secret"]
2029

2130
cpus params.cpus
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../process/score_upload.nf
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../process/song_manifest.nf
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../process/song_publish.nf
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../process/song_submit.nf

song-score-upload/main.nf

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
#!/usr/bin/env nextflow
2+
3+
/*
4+
Copyright (c) 2020-2021, Ontario Institute for Cancer Research
5+
6+
Licensed under the Apache License, Version 2.0 (the "License");
7+
you may not use this file except in compliance with the License.
8+
You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing, software
13+
distributed under the License is distributed on an "AS IS" BASIS,
14+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
See the License for the specific language governing permissions and
16+
limitations under the License.
17+
18+
Authors:
19+
Alex Lepsa
20+
Junjun Zhang
21+
*/
22+
23+
nextflow.enable.dsl = 2
24+
version = '2.6.1'
25+
26+
// universal params go here, change default value as needed
27+
params.publish_dir = "" // set to empty string will disable publishDir
28+
29+
params.max_retries = 5 // set to 0 will disable retry
30+
params.first_retry_wait_time = 1 // in seconds
31+
32+
// tool specific parmas go here, add / change as needed
33+
params.study_id = "TEST-PR"
34+
params.payload = "NO_FILE"
35+
params.upload = []
36+
37+
params.api_token = ""
38+
39+
params.song_cpus = 1
40+
params.song_mem = 1 // GB
41+
params.song_url = "https://song.rdpc-qa.cancercollaboratory.org"
42+
params.song_api_token = ""
43+
params.song_container_version = "4.2.1"
44+
45+
params.score_cpus = 1
46+
params.score_mem = 1 // GB
47+
params.score_transport_mem = 1 // GB
48+
params.score_url = "https://score.rdpc-qa.cancercollaboratory.org"
49+
params.score_api_token = ""
50+
params.score_container_version = "5.0.0"
51+
52+
53+
song_params = [
54+
*:params,
55+
'cpus': params.song_cpus,
56+
'mem': params.song_mem,
57+
'song_url': params.song_url,
58+
'song_container_version': params.song_container_version,
59+
'api_token': params.song_api_token ?: params.api_token
60+
]
61+
62+
score_params = [
63+
*:params,
64+
'cpus': params.score_cpus,
65+
'mem': params.score_mem,
66+
'transport_mem': params.score_transport_mem,
67+
'song_url': params.song_url,
68+
'score_url': params.score_url,
69+
'score_container_version': params.score_container_version,
70+
'api_token': params.score_api_token ?: params.api_token
71+
]
72+
73+
include { songSubmit as songSub } from './local_modules/song-submit' params(song_params)
74+
include { songManifest as songMan } from './local_modules/song-manifest' params(song_params)
75+
include { scoreUpload as scoreUp } from './local_modules/score-upload' params(score_params)
76+
include { songPublish as songPub } from './local_modules/song-publish' params(song_params)
77+
78+
79+
workflow SongScoreUpload {
80+
take:
81+
study_id
82+
payload
83+
upload
84+
85+
main:
86+
// Create new analysis
87+
songSub(study_id, payload)
88+
89+
// Generate file manifest for upload
90+
songMan(study_id, songSub.out, upload.collect())
91+
92+
// Upload to SCORE
93+
scoreUp(songSub.out, songMan.out, upload.collect())
94+
95+
// Publish the analysis
96+
songPub(study_id, scoreUp.out.ready_to_publish)
97+
98+
emit:
99+
analysis_id = songPub.out.analysis_id
100+
}
101+
102+
103+
// this provides an entry point for this main script, so it can be run directly without clone the repo
104+
// using this command: nextflow run <git_acc>/<repo>/<pkg_name>/<main_script>.nf -r <pkg_name>.v<pkg_version> --params-file xxx
105+
106+
workflow {
107+
SongScoreUpload(
108+
params.study_id,
109+
file(params.payload),
110+
Channel.fromPath(params.upload)
111+
)
112+
}

song-score-upload/nextflow.config

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
docker {
2+
enabled = true
3+
runOptions = '-u \$(id -u):\$(id -g)'
4+
}

0 commit comments

Comments
 (0)