process {

    cpus   = { check_max( 1    * task.attempt, 'cpus'   ) }
    memory = { check_max( 6.GB * task.attempt, 'memory' ) }
    time   = { check_max( 2.h  * task.attempt, 'time'   ) }

    errorStrategy = { task.exitStatus in ((130..145) + 104) ? 'retry' : 'finish' }
    maxRetries    = 3
    maxErrors     = '-1'

    withLabel:process_single {
        cpus   = { check_max( 1                    , 'cpus'  ) }
        memory = { check_max( 6.GB   * task.attempt, 'memory') }
        time   = { check_max( 2.h    * task.attempt, 'time'  ) }
    }
    withLabel:process_low {
        cpus   = { check_max( 4      * task.attempt, 'cpus'  ) }
        memory = { check_max( 12.GB  * task.attempt, 'memory') }
        time   = { check_max( 4.h    * task.attempt, 'time'  ) }
    }
    withLabel:process_medium {
        cpus   = { check_max( 10     * task.attempt, 'cpus'  ) }
        memory = { check_max( 42.GB  * task.attempt, 'memory') }
        time   = { check_max( 6.h    * task.attempt, 'time'  ) }
    }
    withLabel:process_medium_high {
        cpus   = { check_max( 20     * task.attempt, 'cpus'  ) }
        memory = { check_max( 90.GB  * task.attempt, 'memory') }
        time   = { check_max( 12.h   * task.attempt, 'time'  ) }
    }
    withLabel:process_high {
        cpus   = { check_max( 30     * task.attempt, 'cpus'  ) }
        memory = { check_max( 120.GB * task.attempt, 'memory') }
        time   = { check_max( 24.h   * task.attempt, 'time'  ) }
    }
    withLabel:process_long {
        time   = { check_max( 48.h   * task.attempt, 'time'  ) }
    }
    withLabel:single_cpu {
        cpus   = { check_max( 1                    , 'cpus'  ) }
    }
    withLabel:process_medium_memory {
        memory = { check_max( 50.GB * task.attempt, 'memory') }
    }
    withLabel:process_high_memory {
        memory = { check_max( 200.GB * task.attempt, 'memory') }
    }
    withLabel:process_high_cpus {
        cpus   = { check_max( 36     * task.attempt, 'cpus'  ) }
    }
    withLabel:error_ignore {
        errorStrategy = 'ignore'
    }
    withLabel:error_retry {
        errorStrategy = 'retry'
        maxRetries    = 3
    }
}
