Skip to content

fix endpoint bug #2772

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 1 commit into from
Dec 6, 2021
Merged
Changes from all 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
24 changes: 11 additions & 13 deletions src/sagemaker/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -3556,19 +3556,17 @@ def endpoint_from_production_variants(
Returns:
str: The name of the created ``Endpoint``.
"""
if not _deployment_entity_exists(
lambda: self.sagemaker_client.describe_endpoint_config(EndpointConfigName=name)
):
config_options = {"EndpointConfigName": name, "ProductionVariants": production_variants}
tags = _append_project_tags(tags)
if tags:
config_options["Tags"] = tags
if kms_key:
config_options["KmsKeyId"] = kms_key
if data_capture_config_dict is not None:
config_options["DataCaptureConfig"] = data_capture_config_dict

self.sagemaker_client.create_endpoint_config(**config_options)
config_options = {"EndpointConfigName": name, "ProductionVariants": production_variants}
tags = _append_project_tags(tags)
if tags:
config_options["Tags"] = tags
if kms_key:
config_options["KmsKeyId"] = kms_key
if data_capture_config_dict is not None:
config_options["DataCaptureConfig"] = data_capture_config_dict

self.sagemaker_client.create_endpoint_config(**config_options)

Comment on lines +3568 to +3569
Copy link
Contributor

Choose a reason for hiding this comment

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

How are you checking if the endpoint exists or not
How are you notifying customers if endpoint config already exists

Copy link
Contributor

Choose a reason for hiding this comment

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

your coverage is reducing. Please add unit tests

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 endpoint check happens in the create_endpoint_config call in the boto3 layer. It is raised in that method call on line 3565 and propagates up the call stack to the endpoint_from_production_variants() method

return self.create_endpoint(endpoint_name=name, config_name=name, tags=tags, wait=wait)

def expand_role(self, role):
Expand Down