params {
    high_memory = 192
    medium_memory = 48
    low_memory = 16
    high_process = 20
    medium_process = 10
    low_process = 4
    high_time = 24
    medium_time = 8
}

process {
    cpus = 1
    time = { 2.h * Math.pow(2, task.attempt - 1) }
    memory = { 8.GB * Math.pow(2, task.attempt - 1) }
    errorStrategy = {
        task.exitStatus in [104, 130, 134, 137, 138, 139, 140, 141, 143, 247, 250] ?
            (task.attempt < 4 ? "retry" : "finish") : (task.attempt < 3 ? "retry" : "finish")
            }
    maxRetries = 4
    queue = { task.time.toHours() > 4 ? "long" : "short" }
}
    
process {
    withLabel: "process_low" {
        cpus = 4
    }
    withLabel: "process_medium" {
        cpus = 10
    }
    withLabel: "process_high" {
        cpus = 20
    }
    withLabel: "memory_low" {
        memory = { 16.GB * Math.pow(2, task.attempt - 1) }
    }
    withLabel: "memory_medium" {
        memory = { 48.GB * Math.pow(2, task.attempt - 1) }
    }
    withLabel: "memory_high" {
        memory = { 192.GB * Math.pow(2, task.attempt - 1) }
    }
    withLabel: "time_medium" {
        time = { 8.h * Math.pow(2, task.attempt - 1) }
    }
    withLabel: "time_long" {
        time = { 24.h * Math.pow(2, task.attempt - 1) }
    }
}

