in deployment/solution-assistant/src/lambda_function.py [0:0]
def delete_sagemaker_endpoint(endpoint_name):
sagemaker_client = boto3.client("sagemaker")
try:
sagemaker_client.delete_endpoint(EndpointName=endpoint_name)
print(
"Successfully deleted endpoint "
"called '{}'.".format(endpoint_name)
)
except sagemaker_client.exceptions.ClientError as e:
if "Could not find endpoint" in str(e):
print(
"Could not find endpoint called '{}'. "
"Skipping delete.".format(endpoint_name)
)
else:
raise e