Skip to content

Commit 8055a38

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

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

lib/osml/model_endpoint/me_test_endpoints.ts

Lines changed: 40 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
@@ -494,6 +508,32 @@ export class METestEndpoints extends Construct {
494508
this.aircraftModelEndpoint.node.addDependency(this.modelContainer);
495509
}
496510

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

0 commit comments

Comments
 (0)