-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Use custom user agent string at all times #1
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
Conversation
…ssion or SageMaker client
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The user agent string construction should be in its own module. It's right to construct it at import time though.
The module could expose a function that returns the user agent string, built at line 84 and 85 of session.py in this PR.
src/sagemaker/session.py
Outdated
|
||
SDK_VERSION = pkg_resources.require('sagemaker')[0].version | ||
OS_NAME = platform.system() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If no OS name can be resolved, platform.system()
will return an empty string. Can this be something like:
OS_NAME = platform.system() or 'UnresolvedOS'
Same for OS_VERSION
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done. Also moved everything to a new module.
src/sagemaker/session.py
Outdated
botocore_session.user_agent_extra = 'Boto3/{} Botocore/{}'.format(boto3.__version__, | ||
botocore_session.user_agent_version) | ||
self.sagemaker_client = sagemaker_client or self.boto_session.client('sagemaker') | ||
self.sagemaker_client._client_config.user_agent = user_agent_string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason we don't preserve the original user agent string as well. Why not just append the SageMaker string to the end?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default user agent string is 'Boto3/1.4.8 Python/3.6.3 Darwin/15.6.0 Botocore/1.8.6', which is why I just added the Boto and Botocore versions to the end. It needs to start with 'AWS-SageMaker' and be followed by 'language/version OS/version' for parsing. Appending the original user agent string here is a good call, though.
Add Pytorch estimator and model
…ws#1) * Added client libraries notebooks + kmeans notebooks * Fixed delete endpoint cell in mxnet notebook * Removed leftover debugging cells from kmeans high level * Reset IOBytes buffer after writing in KMeans low-level * kmeans lowlevel notebook fixes * Move examples into im-python-sdk directory
Sync with AWS repo
merge from master branch
documentation: pytorchddp doc update
The previous implementation allowed for our user agent string to be overridden if the user supplied a boto3 session, SageMaker client, or SageMaker runtime client.