Skip to content

Increase read timeout for sagemaker runtime #355

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

Merged
merged 5 commits into from
Aug 21, 2018
Merged
Changes from 2 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: 3 additions & 3 deletions src/sagemaker/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
from sagemaker.utils import name_from_image, secondary_training_status_message, secondary_training_status_changed
import sagemaker.logs


logging.basicConfig()
LOGGER = logging.getLogger('sagemaker')
LOGGER.setLevel(logging.INFO)
Expand Down Expand Up @@ -93,7 +92,9 @@ def _initialize(self, boto_session, sagemaker_client, sagemaker_runtime_client):
self.sagemaker_client = sagemaker_client or self.boto_session.client('sagemaker')
prepend_user_agent(self.sagemaker_client)

self.sagemaker_runtime_client = sagemaker_runtime_client or self.boto_session.client('runtime.sagemaker')
config = botocore.config.Config(read_timeout=80)
self.sagemaker_runtime_client = sagemaker_runtime_client or self.boto_session.client('runtime.sagemaker',
config=config)
Copy link
Contributor

Choose a reason for hiding this comment

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

it'd be better to create config only when needed (i.e. only when sagemaker_runtime_client is None), and since there's an awkward line break with this change now, I think I'm more inclined toward

if sagemaker_runtime_client is not None:
    self.sagemaker_runtime_client = sagemaker_runtime_client
else:
    config = botocore.config.Config(read_timeout=80)
    self.sagemaker_runtime_client = self.boto_session.client('runtime.sagemaker', config=config)

personal preference, though, and not a strong one at that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point. Updating.

prepend_user_agent(self.sagemaker_runtime_client)

self.local_mode = False
Expand Down Expand Up @@ -1018,7 +1019,6 @@ def _deployment_entity_exists(describe_fn):


def _train_done(sagemaker_client, job_name, last_desc):

in_progress_statuses = ['InProgress', 'Created']

desc = sagemaker_client.describe_training_job(TrainingJobName=job_name)
Expand Down