Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sagemaker deployment - handle endpoint not found for sagemaker delete #522

Merged
merged 3 commits into from
Feb 11, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion bentoml/deployment/sagemaker/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,15 @@ def delete(self, deployment_pb):
"AWS delete endpoint response: %s", delete_endpoint_response
)
except ClientError as e:
raise _aws_client_error_to_bentoml_exception(e)
# If Sagemaker endpoint doesnt exist, we won't need to raise exception.
error_response = e.response.get('Error', {})
error_code = error_response.get('Code', 'Unknown')
error_message = error_response.get('Message', 'Unknown')
if (
not error_code == 'ValidationException'
or 'Could not find endpoint' not in error_message
):
raise _aws_client_error_to_bentoml_exception(e)

_try_clean_up_sagemaker_deployment_resource(deployment_pb)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as discussed offline, let's add function delete_sagemaker_endpoint_if_exist, and call this function in _try_clean_up_sagemaker_deployment_resource.

rename _try_clean_up_sagemaker_deployment_resource to _delete_sagemaker_deployment_resource_if_exist


Expand Down