-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathprocess.config
122 lines (114 loc) · 3.39 KB
/
process.config
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
/*
* -------------------------------------------------
* Nextflow process config file
* -------------------------------------------------
* Define here the different level of RAM/CPUs use
* for the different processes as well as the track
* reports
*/
params {
// Limit max resources
maxCpus = 8
maxMemory = 80.GB
maxTime = 48.h
}
process {
// Defaults for processes without labels
cpus = { checkMax( 1, 'cpus' ) }
memory = { checkMax( 1.GB * task.attempt, 'memory' ) }
time = { checkMax( 12.h * task.attempt, 'time' ) }
//errorStrategy = { task.exitStatus in [143,137,104,134,139] ? 'retry' : 'finish' }
errorStrategy = 'retry'
maxRetries = 1
maxErrors = '-1'
withName: preseq {
errorStrategy = 'ignore'
}
// Process-specific resource requirements
// Customise requirements for specific processes
withLabel: minCpu {
cpus = { checkMax( 1 * task.attempt, 'cpus' ) }
}
withLabel: lowCpu {
cpus = { checkMax( 2 * task.attempt, 'cpus' ) }
}
withLabel: medCpu {
cpus = { checkMax( 4 * task.attempt, 'cpus' ) }
}
withLabel: highCpu {
cpus = { checkMax( 8 * task.attempt, 'cpus' ) }
}
withLabel: extraCpu {
cpus = { checkMax( 16 * task.attempt, 'cpus' ) }
}
withLabel: minMem {
memory = { checkMax( 1.GB * task.attempt, 'memory' ) }
}
withLabel: lowMem {
memory = { checkMax( 4.GB * task.attempt, 'memory' ) }
}
withLabel: medMem {
memory = { checkMax( 8.GB * task.attempt, 'memory' ) }
}
withLabel: highMem {
memory = { checkMax( 16.GB * task.attempt, 'memory' ) }
}
withLabel: extraMem {
memory = { checkMax( 42.GB * task.attempt, 'memory' ) }
}
}
// Capture exit codes from upstream processes when piping
process.shell = ['/bin/bash', '-euo', 'pipefail']
// From nf-core
timeline {
enabled = true
file = "${params.summaryDir}/trace/timeline.html"
}
report {
enabled = true
file = "${params.summaryDir}/trace/report.html"
}
trace {
enabled = true
overwrite = true
raw = true
fields = 'process,task_id,hash,native_id,module,container,tag,name,status,exit,submit,start,complete,duration,realtime,%cpu,%mem,rss,vmem,peak_rss,peak_vmem,rchar,wchar,syscr,syscw,read_bytes,write_bytes,attempt,workdir,scratch,queue,cpus,memory,disk,time,env'
file = "${params.summaryDir}/trace/trace.txt"
}
dag {
enabled = true
overwrite = true
file = "${params.summaryDir}/trace/DAG.pdf"
}
// Function to ensure that resource requirements don't go beyond
// a maximum limit
def checkMax(obj, type) {
if(type == 'memory'){
try {
if(obj.compareTo(params.maxMemory as nextflow.util.MemoryUnit) == 1)
return params.maxMemory as nextflow.util.MemoryUnit
else
return obj
} catch (all) {
println " ### ERROR ### Max memory '${params.maxMemory}' is not valid! Using default value: $obj"
return obj
}
} else if(type == 'time'){
try {
if(obj.compareTo(params.maxTime as nextflow.util.Duration) == 1)
return params.maxTime as nextflow.util.Duration
else
return obj
} catch (all) {
println " ### ERROR ### Max time '${params.maxTime}' is not valid! Using default value: $obj"
return obj
}
} else if(type == 'cpus'){
try {
return Math.min( obj, params.maxCpus as int )
} catch (all) {
println " ### ERROR ### Max cpus '${params.maxCpus}' is not valid! Using default value: $obj"
return obj
}
}
}