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