Skip to content

Add tags on endpoints #253

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 2 commits into from
Jun 25, 2018
Merged

Add tags on endpoints #253

merged 2 commits into from
Jun 25, 2018

Conversation

pm3310
Copy link
Contributor

@pm3310 pm3310 commented Jun 24, 2018

Issue #, if available:

Description of changes:

Option to add Tags on SageMaker Endpoints. I'd like this option so that to tag endpoints for auditing and linking IDs of trained models to endpoints. The latter is very important because I can know which models are dpeloyed in production.

Merge Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your pull request.

  • I have read the CONTRIBUTING doc
  • I have added tests that prove my fix is effective or that my feature works (if appropriate)
  • I have updated the changelog with a description of my changes (if appropriate)
  • I have updated any necessary documentation (if appropriate)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@codecov-io
Copy link

codecov-io commented Jun 24, 2018

Codecov Report

Merging #253 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #253      +/-   ##
==========================================
+ Coverage   92.27%   92.27%   +<.01%     
==========================================
  Files          49       49              
  Lines        3261     3264       +3     
==========================================
+ Hits         3009     3012       +3     
  Misses        252      252
Impacted Files Coverage Δ
src/sagemaker/model.py 95.52% <100%> (ø) ⬆️
src/sagemaker/session.py 86.82% <100%> (+0.11%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b458d3d...3e24528. Read the comment docs.

laurenyu
laurenyu previously approved these changes Jun 25, 2018
Copy link
Contributor

@laurenyu laurenyu left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution!

@laurenyu
Copy link
Contributor

the integ tests are failing with this error:

        with timeout_and_delete_endpoint_by_name(endpoint_name, sagemaker_session):
            estimator = Estimator.attach(training_job_name=training_job_name, sagemaker_session=sagemaker_session)
            model = estimator.create_model()
>           predictor = model.deploy(1, 'ml.m4.xlarge', endpoint_name=endpoint_name)

tests/integ/test_byo_estimator.py:154: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
.tox/py27/lib/python2.7/site-packages/sagemaker/model.py:102: in deploy
    self.sagemaker_session.endpoint_from_production_variants(self.endpoint_name, [production_variant], tags)
.tox/py27/lib/python2.7/site-packages/sagemaker/session.py:665: in endpoint_from_production_variants
    EndpointConfigName=name, ProductionVariants=production_variants, Tags=tags)
.tox/py27/lib/python2.7/site-packages/botocore/client.py:314: in _api_call
    return self._make_api_call(operation_name, kwargs)
.tox/py27/lib/python2.7/site-packages/botocore/client.py:586: in _make_api_call
    api_params, operation_model, context=request_context)
.tox/py27/lib/python2.7/site-packages/botocore/client.py:621: in _convert_to_request_dict
    api_params, operation_model)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <botocore.validate.ParamValidationDecorator object at 0x7fa197e2bb50>
parameters = {'EndpointConfigName': 'byo-2018-06-25-16-42-17-111', 'ProductionVariants': [{'InitialInstanceCount': 1, 'InitialVaria... 1, 'InstanceType': 'ml.m4.xlarge', 'ModelName': 'factorization-machines-2018-06-25-16-46-03-730', ...}], 'Tags': None}
operation_model = OperationModel(name=CreateEndpointConfig)

    def serialize_to_request(self, parameters, operation_model):
        input_shape = operation_model.input_shape
        if input_shape is not None:
            report = self._param_validator.validate(parameters,
                                                    operation_model.input_shape)
            if report.has_errors():
>               raise ParamValidationError(report=report.generate_report())
E               ParamValidationError: Parameter validation failed:
E               Invalid type for parameter Tags, value: None, type: <type 'NoneType'>, valid types: <type 'list'>, <type 'tuple'>

Can you modify your change to not pass along tags to the SageMaker call if it's None?

@pm3310 pm3310 force-pushed the add-tags-on-endpoints branch 2 times, most recently from d3eadbd to d9697b4 Compare June 25, 2018 20:09
@pm3310
Copy link
Contributor Author

pm3310 commented Jun 25, 2018

Hey @laurenyu , I fixed it :-)

EndpointConfigName=name, ProductionVariants=production_variants, Tags=tags)
else:
self.sagemaker_client.create_endpoint_config(
EndpointConfigName=name, ProductionVariants=production_variants)
Copy link
Contributor

Choose a reason for hiding this comment

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

what do you think of doing it this way?

config_options = {'EndpointConfigName': name, 'ProductionVariants': production_variants}

if tags:
    config_options['Tags'] = tags

self.sagemaker_client.create_endpoint_config(**config_options)

@pm3310 pm3310 force-pushed the add-tags-on-endpoints branch from d9697b4 to 3e24528 Compare June 25, 2018 21:10
@pm3310
Copy link
Contributor Author

pm3310 commented Jun 25, 2018

@laurenyu great idea. Done!

laurenyu
laurenyu previously approved these changes Jun 25, 2018
@laurenyu laurenyu merged commit 1e4c545 into aws:master Jun 25, 2018
@pm3310 pm3310 deleted the add-tags-on-endpoints branch June 26, 2018 19:59
apacker pushed a commit to apacker/sagemaker-python-sdk that referenced this pull request Nov 15, 2018
Fixed: pip install pandas in container
knakad pushed a commit to knakad/sagemaker-python-sdk that referenced this pull request Nov 26, 2019
* Add get_rule_container_image_uri and rename container_local_path parameter
* Fix bug with merging rule parameters
* Remove syntax incompatible with Python 2.7
* Add more detail to RuntimeError message
* Remove rule evaluator ECR repo from mapping
* Do not pass instance type and volume size for 1P rules
* Default CollectionConfig.parameters to None
* Temporarily comment out Debugger integ tests until API changes are in Prod
* Fix linting violations
* Fix unit tests to account for changes in S3OutputPath
* Minor change to trigger a new build
* Remove sagemaker_gamma_session
* Remove instance type and volume size from Sagemaker.rule classmethod
* Add fixtures to test_processing to fix cross-region errors
knakad pushed a commit to knakad/sagemaker-python-sdk that referenced this pull request Dec 4, 2019
* Add get_rule_container_image_uri and rename container_local_path parameter
* Fix bug with merging rule parameters
* Remove syntax incompatible with Python 2.7
* Add more detail to RuntimeError message
* Remove rule evaluator ECR repo from mapping
* Do not pass instance type and volume size for 1P rules
* Default CollectionConfig.parameters to None
* Temporarily comment out Debugger integ tests until API changes are in Prod
* Fix linting violations
* Fix unit tests to account for changes in S3OutputPath
* Minor change to trigger a new build
* Remove sagemaker_gamma_session
* Remove instance type and volume size from Sagemaker.rule classmethod
* Add fixtures to test_processing to fix cross-region errors
knakad pushed a commit that referenced this pull request Dec 4, 2019
* Add get_rule_container_image_uri and rename container_local_path parameter
* Fix bug with merging rule parameters
* Remove syntax incompatible with Python 2.7
* Add more detail to RuntimeError message
* Remove rule evaluator ECR repo from mapping
* Do not pass instance type and volume size for 1P rules
* Default CollectionConfig.parameters to None
* Temporarily comment out Debugger integ tests until API changes are in Prod
* Fix linting violations
* Fix unit tests to account for changes in S3OutputPath
* Minor change to trigger a new build
* Remove sagemaker_gamma_session
* Remove instance type and volume size from Sagemaker.rule classmethod
* Add fixtures to test_processing to fix cross-region errors
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