Skip to content

Commit c7979c1

Browse files
committed
feat: implement ship model endpoint
1 parent d73ae2b commit c7979c1

File tree

3 files changed

+60
-18
lines changed

3 files changed

+60
-18
lines changed

lib/osml/model_endpoint/me_test_endpoints.ts

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,12 @@ export class METestEndpointsConfig extends BaseConfig {
7373
*/
7474
public DEPLOY_SM_FLOOD_ENDPOINT: boolean;
7575

76+
/**
77+
* Whether to deploy the SageMaker ship model endpoint.
78+
* @default true
79+
*/
80+
public DEPLOY_SM_SHIP_ENDPOINT: boolean;
81+
7682
/**
7783
* Whether to deploy the SageMaker multi-container model endpoint.
7884
* @default true
@@ -162,6 +168,12 @@ export class METestEndpointsConfig extends BaseConfig {
162168
*/
163169
public SM_FLOOD_MODEL: string;
164170

171+
/**
172+
* The name of the SageMaker endpoint for the flood model.
173+
* @default "ship"
174+
*/
175+
public SM_SHIP_MODEL: string;
176+
165177
/**
166178
* The SageMaker GPU instance type.
167179
*/
@@ -188,6 +200,7 @@ export class METestEndpointsConfig extends BaseConfig {
188200
DEPLOY_SM_AIRCRAFT_ENDPOINT: true,
189201
DEPLOY_SM_CENTERPOINT_ENDPOINT: true,
190202
DEPLOY_SM_FLOOD_ENDPOINT: true,
203+
DEPLOY_SM_SHIP_ENDPOINT: false,
191204
DEPLOY_MULTI_CONTAINER_ENDPOINT: true,
192205
HTTP_ENDPOINT_CPU: 4096,
193206
HTTP_ENDPOINT_CONTAINER_PORT: 8080,
@@ -199,6 +212,7 @@ export class METestEndpointsConfig extends BaseConfig {
199212
SM_AIRCRAFT_MODEL: "aircraft",
200213
SM_CENTER_POINT_MODEL: "centerpoint",
201214
SM_FLOOD_MODEL: "flood",
215+
SM_SHIP_MODEL: "ship",
202216
SM_MULTI_CONTAINER_ENDPOINT: "multi-container",
203217
SM_CPU_INSTANCE_TYPE: "ml.m5.xlarge",
204218
...config
@@ -285,6 +299,11 @@ export class METestEndpoints extends Construct {
285299
*/
286300
public aircraftModelEndpoint?: MESMEndpoint;
287301

302+
/**
303+
* SM model endpoint for the aircraft model.
304+
*/
305+
public shipModelEndpoint?: MESMEndpoint;
306+
288307
/**
289308
* SM endpoint for testing a multi-container configuration.
290309
*/
@@ -494,6 +513,29 @@ export class METestEndpoints extends Construct {
494513
this.aircraftModelEndpoint.node.addDependency(this.modelContainer);
495514
}
496515

516+
if (this.config.DEPLOY_SM_SHIP_ENDPOINT) {
517+
this.shipModelEndpoint = new MESMEndpoint(this, "OSMLShipModelEndpoint", {
518+
containerImageUri: this.modelContainer.containerUri,
519+
modelName: this.config.SM_SHIP_MODEL,
520+
roleArn: this.smRole.roleArn,
521+
instanceType:
522+
this.config.SM_GPU_INSTANCE_TYPE ??
523+
regionConfig.sageMakerGpuEndpointInstanceType,
524+
subnetIds: props.osmlVpc.selectedSubnets.subnetIds,
525+
config: [
526+
new MESMEndpointConfig({
527+
CONTAINER_ENV: {
528+
MODEL_SELECTION: this.config.SM_SHIP_MODEL
529+
},
530+
SECURITY_GROUP_ID: this.securityGroupId,
531+
REPOSITORY_ACCESS_MODE: this.modelContainer.repositoryAccessMode
532+
})
533+
]
534+
});
535+
536+
this.shipModelEndpoint.node.addDependency(this.modelContainer);
537+
}
538+
497539
// Build a multi-container endpoint
498540
if (this.config.DEPLOY_MULTI_CONTAINER_ENDPOINT) {
499541
this.multiContainerModelEndpoint = new MESMEndpoint(

package-lock.json

Lines changed: 16 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
"@types/node": "^24.2.1",
2121
"@typescript-eslint/eslint-plugin": "^8.39.1",
2222
"@typescript-eslint/parser": "^8.39.1",
23-
"aws-cdk": "^2.1024.0",
24-
"aws-cdk-lib": "^2.210.0",
23+
"aws-cdk": "^2.1026.0",
24+
"aws-cdk-lib": "^2.212.0",
2525
"cdk-nag": "^2.37.1",
2626
"constructs": "^10.4.2",
2727
"eslint": "^9.33.0",

0 commit comments

Comments
 (0)