Skip to content

change: Rename Predictor.delete_endpoint as Predictor.delete_predictor #2529

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 5 commits into from
Jul 28, 2021
Merged
Show file tree
Hide file tree
Changes from 2 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
4 changes: 3 additions & 1 deletion src/sagemaker/predictor.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def predict(self, *args, **kwargs) -> Any:
"""Perform inference on the provided data and return a prediction."""

@abc.abstractmethod
def delete_endpoint(self, *args, **kwargs) -> None:
def delete_predictor(self, *args, **kwargs) -> None:
"""Destroy resources associated with this predictor."""

@property
Expand Down Expand Up @@ -330,6 +330,8 @@ def delete_endpoint(self, delete_endpoint_config=True):

self.sagemaker_session.delete_endpoint(self.endpoint_name)

delete_predictor = delete_endpoint

def delete_model(self):
"""Deletes the Amazon SageMaker models backing this predictor."""
request_failed = False
Expand Down
2 changes: 1 addition & 1 deletion src/sagemaker/serverless/predictor.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def predict(self, data: dict) -> dict:
response["ResponseMetadata"]["HTTPHeaders"]["content-type"],
)

def delete_endpoint(self) -> None:
def delete_predictor(self) -> None:
"""Destroy the Lambda function specified in the constructor."""
self._client.delete_function(FunctionName=self._function_name)

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/sagemaker/serverless/test_predictor.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def test_predict(mock_client):
def test_delete_endpoint(mock_client):
predictor = LambdaPredictor(FUNCTION_NAME, client=mock_client)

predictor.delete_endpoint()
predictor.delete_predictor()

mock_client.delete_function.assert_called_once()
_, kwargs = mock_client.delete_function.call_args
Expand Down