in cloudformation/solution-assistant/src/lambda_fn.py [0:0]
def delete_sagemaker_model(model_name):
sagemaker_client = boto3.client("sagemaker")
try:
sagemaker_client.delete_model(ModelName=model_name)
print("Successfully deleted model called '{}'.".format(model_name))
except sagemaker_client.exceptions.ClientError as e:
if "Could not find model" in str(e):
print("Could not find model called '{}'. " "Skipping delete.".format(model_name))
else:
raise e