Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add schedulingPriority option to aws batch (use with shareIdentifier) #3505

Merged
merged 3 commits into from
Dec 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,9 @@ delayBetweenAttempts Delay between download attempts from S3 (default `10
maxParallelTransfers Max parallel upload/download transfer operations *per job* (default: ``4``).
maxTransferAttempts Max number of downloads attempts from S3 (default: `1`).
maxSpotAttempts Max number of execution attempts of a job interrupted by a EC2 spot reclaim event (default: ``5``, requires ``22.04.0`` or later)
shareIdentifier The share identifier for all tasks when using `fair-share scheduling for AWS Batch <https://aws.amazon.com/blogs/hpc/introducing-fair-share-scheduling-for-aws-batch/>`_ (requires ``22.09.0-edge`` or later)
retryMode The retry mode configuration setting, to accommodate rate-limiting on `AWS services <https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-retries.html>`_ (default: ``standard``)
schedulingPriority The scheduling priority for all tasks when using `fair-share scheduling for AWS Batch <https://aws.amazon.com/blogs/hpc/introducing-fair-share-scheduling-for-aws-batch/>`_ (default: ``0``, requires ``23.01.0-edge`` or later)
shareIdentifier The share identifier for all tasks when using `fair-share scheduling for AWS Batch <https://aws.amazon.com/blogs/hpc/introducing-fair-share-scheduling-for-aws-batch/>`_ (requires ``22.09.0-edge`` or later)
=========================== ================


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -662,8 +662,10 @@ class AwsBatchTaskHandler extends TaskHandler implements BatchHandler<String,Job
result.setPropagateTags(true)
}
// set the share identifier
if( this.getAwsOptions().shareIdentifier )
if( this.getAwsOptions().shareIdentifier ) {
result.setShareIdentifier(this.getAwsOptions().shareIdentifier)
result.setSchedulingPriorityOverride(this.getAwsOptions().schedulingPriority)
}

/*
* retry on spot reclaim
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ class AwsOptions implements CloudTransferOptions {
*/
String shareIdentifier

/**
* The scheduling priority for all tasks when using fair-share scheduling (0 to 9999)
*/
int schedulingPriority

/**
* @return A list of volume mounts using the docker cli convention ie. `/some/path` or `/some/path:/container/path` or `/some/path:/container/path:ro`
*/
Expand Down Expand Up @@ -121,6 +126,7 @@ class AwsOptions implements CloudTransferOptions {
fetchInstanceType = session.config.navigate('aws.batch.fetchInstanceType')
retryMode = session.config.navigate('aws.batch.retryMode', 'standard')
shareIdentifier = session.config.navigate('aws.batch.shareIdentifier')
schedulingPriority = session.config.navigate('aws.batch.schedulingPriority', 0) as int
if( retryMode == 'built-in' )
retryMode = null // this force falling back on NF built-in retry mode instead of delegating to AWS CLI tool
if( retryMode && retryMode !in VALID_RETRY_MODES )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ class AwsBatchTaskHandlerTest extends Specification {
then:
1 * handler.getSubmitCommand() >> ['bash', '-c', 'something']
1 * handler.maxSpotAttempts() >> 5
_ * handler.getAwsOptions() >> { new AwsOptions(cliPath: '/bin/aws', storageEncryption: 'AES256', debug: true, shareIdentifier: 'priority/high') }
_ * handler.getAwsOptions() >> { new AwsOptions(cliPath: '/bin/aws', storageEncryption: 'AES256', debug: true, shareIdentifier: 'priority/high', schedulingPriority: 9999) }
1 * handler.getJobQueue(task) >> 'queue1'
1 * handler.getJobDefinition(task) >> 'job-def:1'
1 * handler.getEnvironmentVars() >> []
Expand All @@ -168,6 +168,7 @@ class AwsBatchTaskHandlerTest extends Specification {
req2.getContainerOverrides().getResourceRequirements().find { it.type=='MEMORY'}.getValue() == '8192'
req2.getContainerOverrides().getCommand() ==['bash', '-c', 'something']
req2.getShareIdentifier() == 'priority/high'
req2.getSchedulingPriority() == 9999

}

Expand Down