Skip to content
This repository was archived by the owner on Sep 20, 2025. It is now read-only.
2 changes: 1 addition & 1 deletion src/emd/cfn/codepipeline/template.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
AWSTemplateFormatVersion: '2010-09-09'
Description: CodePipeline for model deployment
Description: EMD bootstrap environment for model deployment
Parameters:
ArtifactBucketName:
Type: String
Expand Down
10 changes: 3 additions & 7 deletions src/emd/commands/destroy.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from rich.console import Console
from rich.panel import Panel

from emd.constants import MODEL_DEFAULT_TAG, VERSION_MODIFY
from emd.constants import MODEL_DEFAULT_TAG
from typing_extensions import Annotated
from emd.sdk.destroy import destroy as sdk_destroy
from emd.utils.decorators import catch_aws_credential_errors,check_emd_env_exist,load_aws_profile
Expand All @@ -25,11 +25,7 @@ def destroy(
],
model_tag: Annotated[
str, typer.Argument(help="Model tag")
] = MODEL_DEFAULT_TAG,
model_deploy_version: Annotated[
str, typer.Option("-v", "--deploy-version", help="The version of the model deployment to destroy"),
] = VERSION_MODIFY
] = MODEL_DEFAULT_TAG
):
model_deploy_version = convert_version_name_to_stack_name(model_deploy_version)
# console.print("[bold blue]Checking AWS environment...[/bold blue]")
sdk_destroy(model_id,model_tag=model_tag,waiting_until_complete=True, model_deploy_version=model_deploy_version)
sdk_destroy(model_id,model_tag=model_tag,waiting_until_complete=True)
3 changes: 1 addition & 2 deletions src/emd/constants.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from .revision import VERSION, convert_version_name_to_stack_name
VERSION_MODIFY = convert_version_name_to_stack_name(VERSION)
ENV_STACK_NAME = f'EMD-Env-{VERSION_MODIFY}'
ENV_STACK_NAME = f'EMD-Env'
MODEL_STACK_NAME_PREFIX = f"EMD-Model"
ENV_BUCKET_NAME_PREFIX = "emd-env-artifactbucket"
CODEPIPELINE_NAME = f"{ENV_STACK_NAME}-Pipeline"
Expand Down
7 changes: 3 additions & 4 deletions src/emd/models/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
from .utils.text_utilities import normalize
from emd.constants import (
MODEL_STACK_NAME_PREFIX,
MODEL_DEFAULT_TAG,
VERSION_MODIFY
MODEL_DEFAULT_TAG
)

from emd.revision import convert_stack_name_to_version_name
Expand Down Expand Up @@ -355,11 +354,11 @@ def normalize_model_id(cls,model_id):
return normalize(model_id).lower()

@classmethod
def get_model_stack_name_prefix(cls,model_id,model_tag=MODEL_DEFAULT_TAG, model_deploy_version=VERSION_MODIFY):
def get_model_stack_name_prefix(cls,model_id,model_tag=MODEL_DEFAULT_TAG):
model_id_with_tag = model_id
if model_tag and model_tag != MODEL_DEFAULT_TAG:
model_id_with_tag = f"{model_id_with_tag}-{model_tag}"
return f"{MODEL_STACK_NAME_PREFIX}-{model_deploy_version}-{cls.normalize_model_id(model_id_with_tag)}"
return f"{MODEL_STACK_NAME_PREFIX}-{cls.normalize_model_id(model_id_with_tag)}"

@classmethod
def get_deploy_version_from_stack_name(cls,stack_name):
Expand Down
5 changes: 2 additions & 3 deletions src/emd/sdk/destroy.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
get_stack_info
)
from emd.models.utils.constants import ServiceType
from emd.constants import VERSION_MODIFY
from emd.models import Model

logger = get_logger(__name__)
Expand Down Expand Up @@ -64,9 +63,9 @@ def destroy_ecs(model_id,model_tag,stack_name):
cf_client.delete_stack(StackName=stack_name)
logger.warning(f"model: {model_id}, model_tag: {model_tag} is a ECS service, if the destruction fails, please destroy it manually using the guide at https://amzn-chn.feishu.cn/docx/YjTadv82Po7IBXxmS1RcmMGHndg")

def destroy(model_id:str,model_tag=MODEL_DEFAULT_TAG,waiting_until_complete=True, model_deploy_version=VERSION_MODIFY):
def destroy(model_id:str,model_tag=MODEL_DEFAULT_TAG,waiting_until_complete=True):
check_env_stack_exist_and_complete()
stack_name = Model.get_model_stack_name_prefix(model_id,model_tag=model_tag,model_deploy_version=model_deploy_version)
stack_name = Model.get_model_stack_name_prefix(model_id,model_tag=model_tag)
if not check_stack_exists(stack_name):
stop_pipeline_execution(model_id,model_tag,waiting_until_complete=waiting_until_complete)
return
Expand Down