Skip to content

Commit

Permalink
fix(batch): make instanceType optional on multinode jobs (#27223)
Browse files Browse the repository at this point in the history
Make `instanceType` optional. It used to be required. It will default to a batch optimal instance type.

The breaking change is for `MultiNodeJobDefinition.instanceType`, which is now optional. This is not truly breaking because everyone has this property explicitly set now, and will continue to have it set after this change. 

Closes #27185.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
comcalvi committed Sep 26, 2023
1 parent acd0ace commit 6616026
Show file tree
Hide file tree
Showing 8 changed files with 156 additions and 92 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@
]
},
"Image": "amazon/amazon-ecs-sample",
"InstanceType": "r4.large",
"ReadonlyRootFilesystem": false,
"ResourceRequirements": [
{
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ const app = new App();
const stack = new Stack(app, 'stack');

new batch.MultiNodeJobDefinition(stack, 'SingleContainerMultiNodeJob', {
instanceType: InstanceType.of(InstanceClass.R4, InstanceSize.LARGE),
containers: [{
startNode: 0,
endNode: 10,
Expand Down
2 changes: 1 addition & 1 deletion packages/aws-cdk-lib/aws-batch/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ In particular, the environment variable that tells the containers which one is t

```ts
const multiNodeJob = new batch.MultiNodeJobDefinition(this, 'JobDefinition', {
instanceType: ec2.InstanceType.of(ec2.InstanceClass.R4, ec2.InstanceSize.LARGE),
instanceType: ec2.InstanceType.of(ec2.InstanceClass.R4, ec2.InstanceSize.LARGE), // optional, omit to let Batch choose the type for you
containers: [{
container: new batch.EcsEc2ContainerDefinition(this, 'mainMPIContainer', {
image: ecs.ContainerImage.fromRegistry('yourregsitry.com/yourMPIImage:latest'),
Expand Down
Loading

0 comments on commit 6616026

Please sign in to comment.