process {
    // Defaults
    cpus = {check_max(1, 'cpus' )}
    memory = {check_max( 8.GB * task.attempt, 'memory' )}
    time = {check_max( (params.min_time).m * task.attempt, 'time' )}
    errorStrategy = 'retry'
    maxRetries = 2

    withName: 'reconstruct_16s' {
        cpus = {check_max(Math.min(4 * task.attempt, params.cpus), 'cpus')}
        time = {check_max((Math.max(params.min_time, 300)).m * task.attempt, 'time')}
    }

    withName: 'download_phyloflash|align_16s|create_phylogeny' {
        cpus = {check_max(params.cpus, 'cpus')}
        time = {check_max((params.max_time).m, 'time')}
    }
}
