Skip to content

Commit

Permalink
yarn lint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
MABatin committed Sep 14, 2024
1 parent 41ca8ad commit 563440e
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions model_deploy/customResources/pipelineModel/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: MIT-0
import { SageMaker } from '@aws-sdk/client-sagemaker';

const sagemaker = new SageMaker( { region: process.env.AWS_REGION } );
const sagemaker = new SageMaker({ region: process.env.AWS_REGION });

interface CustomResourceEvent {
RequestType: string;
Expand All @@ -18,21 +18,19 @@ const createModel = async (projectName: string, modelPackageName: string, execut
const date = new Date();
const modelName = `${projectName}-${date.getUTCFullYear()}-${date.getUTCMonth()}-${date.getUTCDate()}-${date.getUTCHours()}-${date.getUTCMinutes()}-${date.getUTCSeconds()}-${date.getUTCMilliseconds()}`;
console.log(`Creating model ${modelName} for modelPackageName: ${modelPackageName} with role ${executionRoleArn}`);
const modelPackage = await sagemaker
.describeModelPackage({
ModelPackageName: modelPackageName,
});
const modelPackage = await sagemaker.describeModelPackage({
ModelPackageName: modelPackageName,
});

await sagemaker
.createModel({
ModelName: modelName,
Containers: modelPackage.InferenceSpecification?.Containers?.map((c) => ({
Image: c.Image,
ModelDataUrl: c.ModelDataUrl,
Environment: c.Environment,
})),
ExecutionRoleArn: executionRoleArn,
});
await sagemaker.createModel({
ModelName: modelName,
Containers: modelPackage.InferenceSpecification?.Containers?.map((c) => ({
Image: c.Image,
ModelDataUrl: c.ModelDataUrl,
Environment: c.Environment,
})),
ExecutionRoleArn: executionRoleArn,
});

return {
PhysicalResourceId: modelName,
Expand Down

0 comments on commit 563440e

Please sign in to comment.