Skip to content

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

Merged
merged 3 commits into from
Dec 5, 2017

Conversation

laurenyu
Copy link
Contributor

@laurenyu laurenyu commented Dec 1, 2017

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.

@laurenyu laurenyu requested review from owen-t and nadiaya December 1, 2017 18:36
Copy link
Contributor

@owen-t owen-t left a 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.


SDK_VERSION = pkg_resources.require('sagemaker')[0].version
OS_NAME = platform.system()
Copy link
Contributor

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

Copy link
Contributor Author

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.

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
Copy link
Contributor

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?

Copy link
Contributor Author

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.

@laurenyu laurenyu merged commit d8c62c4 into aws:master Dec 5, 2017
@laurenyu laurenyu deleted the laurenyu-fix-user-agent-string branch December 5, 2017 21:41
laurenyu referenced this pull request in laurenyu/sagemaker-python-sdk May 31, 2018
Add Pytorch estimator and model
apacker pushed a commit to apacker/sagemaker-python-sdk that referenced this pull request Nov 15, 2018
…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
apacker pushed a commit to apacker/sagemaker-python-sdk that referenced this pull request Nov 15, 2018
apacker pushed a commit to apacker/sagemaker-python-sdk that referenced this pull request Nov 15, 2018
apacker pushed a commit to apacker/sagemaker-python-sdk that referenced this pull request Nov 15, 2018
mchoi8739 pushed a commit to mchoi8739/sagemaker-python-sdk that referenced this pull request Jul 25, 2022
documentation: pytorchddp doc update
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants