@@ -1818,16 +1818,13 @@ export class Cluster extends ClusterBase {
1818
1818
* @param options options for creating a new nodegroup
1819
1819
*/
1820
1820
public addNodegroupCapacity ( id : string , options ?: NodegroupOptions ) : Nodegroup {
1821
- const hasInferentiaInstanceType = [
1821
+ const hasInferentiaOrTraniumInstanceType = [
1822
1822
options ?. instanceType ,
1823
1823
...options ?. instanceTypes ?? [ ] ,
1824
- ] . some ( i => i && nodeTypeForInstanceType ( i ) === NodeType . INFERENTIA ) ;
1825
- const hasTrainiumInstanceType = [
1826
- options ?. instanceType ,
1827
- ...options ?. instanceTypes ?? [ ] ,
1828
- ] . some ( i => i && nodeTypeForInstanceType ( i ) === NodeType . TRAINIUM ) ;
1824
+ ] . some ( i => i && ( nodeTypeForInstanceType ( i ) === NodeType . INFERENTIA ||
1825
+ nodeTypeForInstanceType ( i ) === NodeType . TRAINIUM ) ) ;
1829
1826
1830
- if ( hasInferentiaInstanceType || hasTrainiumInstanceType ) {
1827
+ if ( hasInferentiaOrTraniumInstanceType ) {
1831
1828
this . addNeuronDevicePlugin ( ) ;
1832
1829
}
1833
1830
return new Nodegroup ( this , `Nodegroup${ id } ` , {
@@ -2483,10 +2480,14 @@ export enum MachineImageType {
2483
2480
}
2484
2481
2485
2482
function nodeTypeForInstanceType ( instanceType : ec2 . InstanceType ) {
2486
- return INSTANCE_TYPES . gpu . includes ( instanceType . toString ( ) . substring ( 0 , 2 ) ) ? NodeType . GPU :
2487
- INSTANCE_TYPES . inferentia . includes ( instanceType . toString ( ) . substring ( 0 , 4 ) ) ? NodeType . INFERENTIA :
2488
- INSTANCE_TYPES . trainium . includes ( instanceType . toString ( ) . substring ( 0 , 4 ) ) ? NodeType . TRAINIUM :
2489
- NodeType . STANDARD ;
2483
+ if ( INSTANCE_TYPES . gpu . includes ( instanceType . toString ( ) . substring ( 0 , 2 ) ) ) {
2484
+ return NodeType . GPU ;
2485
+ } else if ( INSTANCE_TYPES . inferentia . includes ( instanceType . toString ( ) . substring ( 0 , 4 ) ) ) {
2486
+ return NodeType . INFERENTIA ;
2487
+ } else if ( INSTANCE_TYPES . trainium . includes ( instanceType . toString ( ) . substring ( 0 , 4 ) ) ) {
2488
+ return NodeType . TRAINIUM ;
2489
+ }
2490
+ return NodeType . STANDARD ;
2490
2491
}
2491
2492
2492
2493
function cpuArchForInstanceType ( instanceType : ec2 . InstanceType ) {
0 commit comments