-
Notifications
You must be signed in to change notification settings - Fork 3
/
requirements.config
83 lines (72 loc) · 3.04 KB
/
requirements.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
params {
// Dynamic resource allocation will adhere to these limits
max_memory = 128.GB
max_cpus = 16
max_time = 48.h
}
process {
cpus = { check_max( 1 * task.attempt, params.max_cpus ) }
memory = { check_max( 2.GB * task.attempt, params.max_memory ) }
time = { check_max( 2.h * task.attempt, params.max_time ) }
withLabel: index {
cpus = { mapper.tool.matches(params.one_thread_idx) ? 1 : check_max( (params.debug ? 2 : 8) * task.attempt, params.max_cpus ) }
memory = { maxIndexMem( ref.size(), params.max_memory, task.attempt) }
time = { maxIndexTime( ref.size(), params.max_time, task.attempt) }
}
withLabel: align {
cpus = { check_max( params.debug ? 2 : 8, params.max_cpus ) }
memory = { maxMapMem( ref.size(), params.max_memory) }
time = { maxMapTime(meta.query.nreads, params.max_time, task.attempt) }
}
withLabel: benchmark {
cpus = { check_max( 2 * task.attempt, params.max_cpus ) }
memory = { check_max( 2.GB * task.attempt, params.max_memory ) }
time = { check_max( (params.debug ? 10.m : 1.h) * task.attempt, params.max_time ) }
}
withLabel: quick {
time = { check_max( 30.m * task.attempt, params.max_time ) }
cpus = { check_max( 2 * task.attempt, params.max_cpus ) }
memory = { check_max( (params.debug ? 4.GB : 8.GB) * task.attempt, params.max_memory ) }
}
withLabel: slow {
time = { check_max( (params.debug ? 30.m : 24.h) * task.attempt, params.max_time ) }
cpus = { check_max( 2 * task.attempt, params.max_cpus ) }
memory = { check_max( (params.debug ? 4.GB : 8.GB) * task.attempt, params.max_memory ) }
}
withLabel: sort {
cpus = { check_max( (params.debug ? 1 : 2) * task.attempt, params.max_cpus ) }
memory = { check_max( (params.debug ? 1.GB : 4.GB) * task.attempt, params.max_memory ) }
time = { check_max( (params.debug ? 10.m : 30.m) * task.attempt, params.max_time ) }
}
}
def check_max(obj, max) {
if( obj instanceof nextflow.util.MemoryUnit ) {
def other = max as nextflow.util.MemoryUnit
return obj.compareTo(other) == 1 ? other : obj
}
if( obj instanceof nextflow.util.Duration ) {
def other = max as nextflow.util.Duration
return obj.compareTo(other) == 1 ? other : obj
}
if( obj instanceof Integer ) {
return Math.min( obj, max as int )
}
println " ### ERROR ### invalid check_max value=$obj"
return obj
}
/*
Several simple experimentally-derived functions for dynamic scaling of memory and time requirements depending on the pinput size
*/
def maxIndexTime(long bytes, limit, attempt=1) {
check_max(Math.ceil(bytes*0.002+3E5) * attempt as nextflow.util.Duration, limit)
}
def maxIndexMem(long bytes, limit, attempt=1) {
check_max(Math.ceil(bytes*7+5E9) * attempt as nextflow.util.MemoryUnit, limit)
}
// def maxMapTime(long nreads, coefficient, constant, limit, attempt=1) {
def maxMapTime(long nreads, limit, attempt=1) {
check_max(Math.ceil(nreads*0.1+2E6) * attempt as nextflow.util.Duration, limit)
}
def maxMapMem(long bytes, limit) {
check_max(Math.ceil(bytes*9+3E9) as nextflow.util.MemoryUnit, limit)
}