-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feature: adding resourcekey and tags for api in config for SDK defaults #3915
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
feature: adding resourcekey and tags for api in config for SDK defaults #3915
Conversation
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
4bb64d7
to
bb683d0
Compare
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Codecov Report
@@ Coverage Diff @@
## master #3915 +/- ##
==========================================
- Coverage 90.07% 89.38% -0.70%
==========================================
Files 1156 271 -885
Lines 106844 26420 -80424
==========================================
- Hits 96245 23616 -72629
+ Misses 10599 2804 -7795
|
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
tests/data/config/config.yaml
Outdated
RoleArn: 'arn:aws:iam::555555555555:role/IMRole' | ||
ResourceKey: 'kmskeyid1' | ||
PythonSDK: |
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.
Why this is needed here?
This is already in the file from line 3:28.
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.
Thanks - Yes. it is not needed, got incorrectly added as part of a git merge conflict resolve. Will remove it in the next commit
@@ -3102,7 +3109,7 @@ def test_endpoint_from_production_variants_with_sagemaker_config_injection( | |||
sagemaker_session.sagemaker_client.create_endpoint.assert_called_with( | |||
EndpointConfigName="some-endpoint", | |||
EndpointName="some-endpoint", | |||
Tags=expected_tags, # from config | |||
Tags=[], |
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.
Can you write a unit-test when both CreateEndpoint
and CreateEndpointConfig
is passed with some Tags Config and see respective configs are applied?
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.
Added a new UT with the combination in the next commit :)
src/sagemaker/session.py
Outdated
log_group, | ||
dot, | ||
color_wrap, | ||
) = _logs_init(self.boto_session, description, job="AutoML") |
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 are moving every single param to next line? Is it a best practice for Python code development?
If not, let's remove this formatting since it will just increase the number of lines in this huge file(~7K lines). AFAIK, we have a line length limit of 100, if it satisfies that, lets keep it as original.
If there are any black-check or pylint errors we need to resolve, we can move them to next line.
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.
Thanks I believe this was the result of the black-format
command to auto fix the file, I can double check and revert this
Kindly follow this and write a meaningful header for this PR? |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
bb683d0
to
31dd5da
Compare
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
…t defaults Adding ResourceKey to the Config schema for the createEdgePackaging Job API Adding a new entry into the Config Schema for CreateEndpoint API with the addition of tags attribute
… intelligent defaults Added Unit tests to test the config injection for SAGEMAKER_CONFIG_ENDPOINT Fixed a couple of unit tests
Making changes wrt formatting to fix tox issues
fixed comments on PR, added UTs, style changes
31dd5da
to
dacac74
Compare
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
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.
/bot run pr
@@ -48,6 +48,7 @@ | |||
COMPILATION_JOB_VPC_CONFIG_PATH, | |||
COMPILATION_JOB, | |||
EDGE_PACKAGING_ROLE_ARN_PATH, | |||
EDGE_PACKAGING_RESOURCE_KEY_PATH, |
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.
/bot run pr
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
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.
Looks good! Just a couple minor comments
@@ -300,7 +314,9 @@ def __init__( | |||
self._base_name = None | |||
self.sagemaker_session = sagemaker_session | |||
self.role = resolve_value_from_config( | |||
role, MODEL_EXECUTION_ROLE_ARN_PATH, sagemaker_session=self.sagemaker_session | |||
role, |
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.
qq: did some configuration change recently for how we do spacing? Odd that non-touched things are changing
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.
True - I think this is a result of tox -e black-format
@@ -4026,6 +4033,9 @@ def create_endpoint(self, endpoint_name, config_name, tags=None, wait=True): | |||
|
|||
tags = tags or [] | |||
tags = _append_project_tags(tags) | |||
tags = self._append_sagemaker_config_tags( | |||
tags, "{}.{}.{}".format(SAGEMAKER, ENDPOINT, TAGS) |
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.
nit: Can use ENDPOINT_TAGS_PATH right?
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.
Yeah, will make the change in a quick follow up PR
endpoint_config_tags = _append_project_tags(tags) | ||
endpoint_tags = _append_project_tags(tags) | ||
endpoint_config_tags = self._append_sagemaker_config_tags( | ||
endpoint_config_tags, "{}.{}.{}".format(SAGEMAKER, ENDPOINT_CONFIG, TAGS) |
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.
nit: can use the path directly here also
endpoint_tags = _append_project_tags(tags) | ||
endpoint_config_tags = self._append_sagemaker_config_tags( | ||
endpoint_config_tags, "{}.{}.{}".format(SAGEMAKER, ENDPOINT_CONFIG, TAGS) | ||
) |
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.
not injecting endpoint tags from config here because that is in create_endpoint right? That makes sense. (optional) Could have a small comment here mentioning that
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.
Makes sense, will make the change in a quick follow up PR
|
||
Returns: | ||
str: Name of the ``Endpoint`` that is created. | ||
""" | ||
model_environment_vars = model_environment_vars or {} | ||
name = name or name_from_image(image_uri) | ||
model_vpc_config = vpc_utils.sanitize(model_vpc_config) | ||
|
||
endpoint_config_tags = _append_project_tags(tags) | ||
endpoint_tags = _append_project_tags(tags) |
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.
Should this line be skipped if its also in create_endpoint? (also, does calling this function twice cause issues, or is it smart enough to handle that scenario?)
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.
Thanks for this comment :) - You're right, we can omit it - the _append_project_tags
will boot out similar values so it wouldn't be an issue. Although it is not as smart as _append_sagemaker_config_tags
which explicitly checks keys. Will update to skip it as a follow up along with the integ test change
endpoint_config_tags = _append_project_tags(tags) | ||
endpoint_tags = _append_project_tags(tags) |
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.
There should be an integ test for sagemaker_config where EndpointConfig tags are passed in thru the config (dont remember which Session method they end up calling). Can we add Endpoint tags to that test as well and verify that Endpoint and EndpointConfig end up with different tag values?
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.
Will add this as part of a new PR 👍
Issue #, if available:
Description of changes:
adding resourcekey and tags for api in config for intelligent defaults
Testing done:
unit tests
tested in greygoose
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.General
Tests
unique_name_from_base
to create resource names in integ tests (if appropriate)By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.