|
0
|
1 process {
|
|
|
2 publishDir = [
|
|
|
3 path: {
|
|
|
4 "${task.process.tokenize(':')[-1].toLowerCase()}" == "multiqc" ?
|
|
|
5 "${params.output}${params.fs}${params.pipeline.toLowerCase()}-${task.process.tokenize(':')[-1].toLowerCase()}" :
|
|
|
6 "${params.output}${params.fs}${task.process.tokenize(':')[-1].toLowerCase()}"
|
|
|
7 },
|
|
|
8 mode: params.publish_dir_mode,
|
|
|
9 overwrite: params.publish_dir_overwrite,
|
|
|
10 saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
|
|
|
11 ]
|
|
|
12
|
|
|
13 errorStrategy = {
|
|
|
14 ![0].contains(task.exitStatus) ? dynamic_retry(task.attempt, 10) : 'finish'
|
|
|
15 }
|
|
|
16
|
|
|
17 maxRetries = 1
|
|
|
18
|
|
|
19 withLabel: 'process_femto' {
|
|
|
20 cpus = { 1 * task.attempt }
|
|
|
21 memory = { 1.GB * task.attempt }
|
|
|
22 time = { 1.h * task.attempt }
|
|
|
23 }
|
|
|
24
|
|
|
25 withLabel: 'process_pico' {
|
|
|
26 cpus = { 2 * task.attempt }
|
|
|
27 memory = { 4.GB * task.attempt }
|
|
|
28 time = { 2.h * task.attempt }
|
|
|
29 }
|
|
|
30
|
|
|
31 withLabel: 'process_nano' {
|
|
|
32 cpus = { 4 * task.attempt }
|
|
|
33 memory = { 8.GB * task.attempt }
|
|
|
34 time = { 4.h * task.attempt }
|
|
|
35 }
|
|
|
36
|
|
|
37 withLabel: 'process_micro' {
|
|
|
38 cpus = { 8 * task.attempt }
|
|
|
39 memory = { 16.GB * task.attempt }
|
|
|
40 time = { 8.h * task.attempt }
|
|
|
41 }
|
|
|
42
|
|
|
43 withLabel: 'process_only_mem_low' {
|
|
|
44 cpus = { 1 * task.attempt }
|
|
|
45 memory = { 60.GB * task.attempt }
|
|
|
46 time = { 20.h * task.attempt }
|
|
|
47 }
|
|
|
48
|
|
|
49 withLabel: 'process_only_mem_medium' {
|
|
|
50 cpus = { 1 * task.attempt }
|
|
|
51 memory = { 100.GB * task.attempt }
|
|
|
52 time = { 30.h * task.attempt }
|
|
|
53 }
|
|
|
54
|
|
|
55 withLabel: 'process_only_mem_high' {
|
|
|
56 cpus = { 1 * task.attempt }
|
|
|
57 memory = { 128.GB * task.attempt }
|
|
|
58 time = { 60.h * task.attempt }
|
|
|
59 }
|
|
|
60
|
|
|
61 withLabel: 'process_low' {
|
|
|
62 cpus = { 10 * task.attempt }
|
|
|
63 memory = { 60.GB * task.attempt }
|
|
|
64 time = { 20.h * task.attempt }
|
|
|
65 }
|
|
|
66
|
|
|
67 withLabel: 'process_medium' {
|
|
|
68 cpus = { 10 * task.attempt }
|
|
|
69 memory = { 100.GB * task.attempt }
|
|
|
70 time = { 30.h * task.attempt }
|
|
|
71 }
|
|
|
72
|
|
|
73 withLabel: 'process_high' {
|
|
|
74 cpus = { 10 * task.attempt }
|
|
|
75 memory = { 128.GB * task.attempt }
|
|
|
76 time = { 60.h * task.attempt }
|
|
|
77 }
|
|
|
78
|
|
|
79 withLabel: 'process_higher' {
|
|
|
80 cpus = { 10 * task.attempt }
|
|
|
81 memory = { 256.GB * task.attempt }
|
|
|
82 time = { 60.h * task.attempt }
|
|
|
83 }
|
|
|
84
|
|
|
85 withLabel: 'process_gigantic' {
|
|
|
86 cpus = { 10 * task.attempt }
|
|
|
87 memory = { 512.GB * task.attempt }
|
|
|
88 time = { 60.h * task.attempt }
|
|
|
89 }
|
|
|
90 }
|
|
|
91
|
|
|
92 if ( (params.input || params.metadata ) && params.pipeline ) {
|
|
|
93 try {
|
|
|
94 includeConfig "${params.workflowsconf}${params.fs}process${params.fs}${params.pipeline}.process.config"
|
|
|
95 } catch (Exception e) {
|
|
|
96 System.err.println('-'.multiply(params.linewidth) + "\n" +
|
|
|
97 "\033[0;31m${params.cfsanpipename} - ERROR\033[0m\n" +
|
|
|
98 '-'.multiply(params.linewidth) + "\n" + "\033[0;31mCould not load " +
|
|
|
99 "default pipeline's process configuration. Please provide a pipeline \n" +
|
|
|
100 "name using the --pipeline option.\n\033[0m" + '-'.multiply(params.linewidth) + "\n")
|
|
|
101 System.exit(1)
|
|
|
102 }
|
|
|
103 }
|
|
|
104
|
|
|
105 // Function will return after sleeping for some time.
|
|
|
106 // Sleep time increases exponentially by task attempt.
|
|
|
107 def dynamic_retry(task_retry_num, factor_by) {
|
|
|
108 // sleep(Math.pow(2, task_retry_num.toInteger()) * factor_by.toInteger() as long)
|
|
|
109 sleep(Math.pow(1.27, task_retry_num.toInteger()) as long)
|
|
|
110 return 'retry'
|
|
|
111 }
|