process {
    executor = 'awsbatch'
    queue = "${params.queue}"

    // Resource mods
    withName: 'fastq_status|qc_original_summary|qc_final_summary|mapping_query' {
        memory = {check_max(2.GB * task.attempt, MAX_MEMORY, 'memory' )}
    }

    withName: 'mapping_query' {
        memory = {check_max(3.GB * task.attempt, MAX_MEMORY, 'memory' )}
    }

    withName: qc_reads {
        memory = {check_max(16.GB * task.attempt, MAX_MEMORY, 'memory')}
    }

    withName: 'assemble_genome|assembly_qc' {
        memory = {check_max(32.GB * task.attempt, MAX_MEMORY, 'memory' )}
    }

    maxRetries = params.aws_max_retry
}

aws {
    region = "${params.aws_region}"

    client {
        uploadStorageClass = "${params.aws_upload_storage_class}"
    }

    batch {
        volumes = "${params.aws_volumes}"
        cliPath = "${params.aws_cli_path}"
        maxParallelTransfers = params.aws_max_parallel_transfers
        delayBetweenAttempts = params.aws_delay_between_attempts
        maxTransferAttempts = params.aws_max_transfer_attempts
    }
}
