Skip to content

fix: timeout_and_delete_endpoint_by_name swallows assertions errors #841

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

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 5 additions & 1 deletion src/sagemaker/local/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,11 @@ def run(self):
raise RuntimeError(msg)

def down(self):
self.process.terminate()
try:
self.process.terminate()
except ProcessLookupError:
# The process terminated already
pass


class _Volume(object):
Expand Down
12 changes: 10 additions & 2 deletions tests/integ/timeout.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
from awslogs.core import AWSLogs
from botocore.exceptions import ClientError

import sagemaker

LOGGER = logging.getLogger('timeout')


Expand Down Expand Up @@ -74,7 +76,7 @@ def timeout_and_delete_endpoint_by_name(endpoint_name, sagemaker_session, second
_show_logs(endpoint_name, 'Endpoints', sagemaker_session)
if no_errors:
_cleanup_logs(endpoint_name, 'Endpoints', sagemaker_session)
return
break
except ClientError as ce:
if ce.response['Error']['Code'] == 'ValidationException':
# avoids the inner exception to be overwritten
Expand Down Expand Up @@ -102,14 +104,17 @@ def timeout_and_delete_model_with_transformer(transformer, sagemaker_session, se
_show_logs(transformer.model_name, 'Models', sagemaker_session)
if no_errors:
_cleanup_logs(transformer.model_name, 'Models', sagemaker_session)
return
break
except ClientError as ce:
if ce.response['Error']['Code'] == 'ValidationException':
pass
sleep(10)


def _show_logs(resource_name, resource_type, sagemaker_session):
if isinstance(sagemaker_session, sagemaker.LocalSession):
return

log_group = '/aws/sagemaker/{}/{}'.format(resource_type, resource_name)
try:
# print out logs before deletion for debuggability
Expand All @@ -123,6 +128,9 @@ def _show_logs(resource_name, resource_type, sagemaker_session):


def _cleanup_logs(resource_name, resource_type, sagemaker_session):
if isinstance(sagemaker_session, sagemaker.LocalSession):
return

log_group = '/aws/sagemaker/{}/{}'.format(resource_type, resource_name)
try:
# print out logs before deletion for debuggability
Expand Down