diff --git a/conf/pipeline/eager/maestro.config b/conf/pipeline/eager/maestro.config index 01dc96d7c..fd14b4e3e 100644 --- a/conf/pipeline/eager/maestro.config +++ b/conf/pipeline/eager/maestro.config @@ -5,6 +5,12 @@ * nextflow run nf-core/eager -profile maestro,,maestro, (where is long or normal and is nuclear, mitocondrial or unlimitedtime) */ +validation { + ignoreParams = [ + 'eager_maestro_check_max_func' + ] +} + params { config_profile_name = 'nf-core/eager nuclear/mitocondrial - human profiles' @@ -21,41 +27,41 @@ profiles { maxRetries = 2 withName: makeBWAIndex { - cpus = { check_max(8 * task.attempt, 'cpus') } - memory = { check_max(8.GB * task.attempt, 'memory') } - time = { check_max(12.h * task.attempt, 'time') } + cpus = { params.eager_maestro_check_max_func(8 * task.attempt, 'cpus') } + memory = { params.eager_maestro_check_max_func(8.GB * task.attempt, 'memory') } + time = { params.eager_maestro_check_max_func(12.h * task.attempt, 'time') } } withName: adapter_removal { - cpus = { check_max(8 * task.attempt, 'cpus') } - memory = { check_max(16.GB * task.attempt, 'memory') } - time = { check_max(12.h * task.attempt, 'time') } + cpus = { params.eager_maestro_check_max_func(8 * task.attempt, 'cpus') } + memory = { params.eager_maestro_check_max_func(16.GB * task.attempt, 'memory') } + time = { params.eager_maestro_check_max_func(12.h * task.attempt, 'time') } } withName: bwa { - cpus = { check_max(40 * task.attempt, 'cpus') } - memory = { check_max(40.GB * task.attempt, 'memory') } + cpus = { params.eager_maestro_check_max_func(40 * task.attempt, 'cpus') } + memory = { params.eager_maestro_check_max_func(40.GB * task.attempt, 'memory') } time = 24.h cache = 'deep' } withName: markduplicates { errorStrategy = { task.exitStatus in [143, 137, 104, 134, 139] ? 'retry' : 'finish' } - cpus = { check_max(16 * task.attempt, 'cpus') } - memory = { check_max(16.GB * task.attempt, 'memory') } - time = { check_max(12.h * task.attempt, 'time') } + cpus = { params.eager_maestro_check_max_func(16 * task.attempt, 'cpus') } + memory = { params.eager_maestro_check_max_func(16.GB * task.attempt, 'memory') } + time = { params.eager_maestro_check_max_func(12.h * task.attempt, 'time') } } withName: damageprofiler { cpus = 1 - memory = { check_max(8.GB * task.attempt, 'memory') } - time = { check_max(6.h * task.attempt, 'time') } + memory = { params.eager_maestro_check_max_func(8.GB * task.attempt, 'memory') } + time = { params.eager_maestro_check_max_func(6.h * task.attempt, 'time') } } withName: fastp { cpus = 8 - memory = { check_max(8.GB * task.attempt, 'memory') } - time = { check_max(6.h * task.attempt, 'time') } + memory = { params.eager_maestro_check_max_func(8.GB * task.attempt, 'memory') } + time = { params.eager_maestro_check_max_func(6.h * task.attempt, 'time') } } withName: fastqc { cpus = 2 - memory = { check_max(8.GB * task.attempt, 'memory') } - time = { check_max(6.h * task.attempt, 'time') } + memory = { params.eager_maestro_check_max_func(8.GB * task.attempt, 'memory') } + time = { params.eager_maestro_check_max_func(6.h * task.attempt, 'time') } } } } @@ -66,40 +72,40 @@ profiles { maxRetries = 2 withName: makeBWAIndex { - cpus = { check_max(8 * task.attempt, 'cpus') } - memory = { check_max(8.GB * task.attempt, 'memory') } - time = { check_max(12.h * task.attempt, 'time') } + cpus = { params.eager_maestro_check_max_func(8 * task.attempt, 'cpus') } + memory = { params.eager_maestro_check_max_func(8.GB * task.attempt, 'memory') } + time = { params.eager_maestro_check_max_func(12.h * task.attempt, 'time') } } withName: adapter_removal { - cpus = { check_max(8 * task.attempt, 'cpus') } - memory = { check_max(16.GB * task.attempt, 'memory') } - time = { check_max(12.h * task.attempt, 'time') } + cpus = { params.eager_maestro_check_max_func(8 * task.attempt, 'cpus') } + memory = { params.eager_maestro_check_max_func(16.GB * task.attempt, 'memory') } + time = { params.eager_maestro_check_max_func(12.h * task.attempt, 'time') } } withName: bwa { - cpus = { check_max(5 * task.attempt, 'cpus') } - memory = { check_max(5.GB * task.attempt, 'memory') } + cpus = { params.eager_maestro_check_max_func(5 * task.attempt, 'cpus') } + memory = { params.eager_maestro_check_max_func(5.GB * task.attempt, 'memory') } time = 24.h } withName: markduplicates { errorStrategy = { task.exitStatus in [143, 137, 104, 134, 139] ? 'retry' : 'finish' } - cpus = { check_max(5 * task.attempt, 'cpus') } - memory = { check_max(5.GB * task.attempt, 'memory') } - time = { check_max(6.h * task.attempt, 'time') } + cpus = { params.eager_maestro_check_max_func(5 * task.attempt, 'cpus') } + memory = { params.eager_maestro_check_max_func(5.GB * task.attempt, 'memory') } + time = { params.eager_maestro_check_max_func(6.h * task.attempt, 'time') } } withName: damageprofiler { cpus = 1 - memory = { check_max(5.GB * task.attempt, 'memory') } - time = { check_max(3.h * task.attempt, 'time') } + memory = { params.eager_maestro_check_max_func(5.GB * task.attempt, 'memory') } + time = { params.eager_maestro_check_max_func(3.h * task.attempt, 'time') } } withName: fastp { cpus = 8 - memory = { check_max(5.GB * task.attempt, 'memory') } - time = { check_max(3.h * task.attempt, 'time') } + memory = { params.eager_maestro_check_max_func(5.GB * task.attempt, 'memory') } + time = { params.eager_maestro_check_max_func(3.h * task.attempt, 'time') } } withName: fastqc { cpus = 2 - memory = { check_max(8.GB * task.attempt, 'memory') } - time = { check_max(6.h * task.attempt, 'time') } + memory = { params.eager_maestro_check_max_func(8.GB * task.attempt, 'memory') } + time = { params.eager_maestro_check_max_func(6.h * task.attempt, 'time') } } } } @@ -117,31 +123,31 @@ profiles { // Function to ensure that resource requirements don't go beyond // a maximum limit // FOR DSL1 PIPELINE ONLY! -def check_max(obj, type) { +params.eager_maestro_check_max_func = { obj, type -> if (type == 'memory') { try { - if (obj.compareTo(params.max_memory as nextflow.util.MemoryUnit) == 1) - return params.max_memory as nextflow.util.MemoryUnit + if (obj.compareTo(params.max_memory as MemoryUnit) == 1) + return params.max_memory as MemoryUnit else return obj - } catch (all) { + } catch (_) { println " ### ERROR ### Max memory '${params.max_memory}' is not valid! Using default value: $obj" return obj } } else if (type == 'time') { try { - if (obj.compareTo(params.max_time as nextflow.util.Duration) == 1) - return params.max_time as nextflow.util.Duration + if (obj.compareTo(params.max_time as Duration) == 1) + return params.max_time as Duration else return obj - } catch (all) { + } catch (_) { println " ### ERROR ### Max time '${params.max_time}' is not valid! Using default value: $obj" return obj } } else if (type == 'cpus') { try { return Math.min( obj, params.max_cpus as int ) - } catch (all) { + } catch (_) { println " ### ERROR ### Max cpus '${params.max_cpus}' is not valid! Using default value: $obj" return obj }