File tree Expand file tree Collapse file tree 4 files changed +40
-0
lines changed Expand file tree Collapse file tree 4 files changed +40
-0
lines changed Original file line number Diff line number Diff line change @@ -826,6 +826,11 @@ def delete_endpoint(self):
826826 Raises:
827827 botocore.exceptions.ClientError: If the endpoint does not exist.
828828 """
829+ logging .warning (
830+ "estimator.delete_endpoint() will be deprecated in SageMaker Python SDK v2. "
831+ "Please use the delete_endpoint() function on your predictor instead."
832+ )
833+
829834 self ._ensure_latest_training_job (error_message = "Endpoint was not created yet" )
830835 self .sagemaker_session .delete_endpoint (self .latest_training_job .name )
831836
Original file line number Diff line number Diff line change @@ -840,6 +840,11 @@ def delete_endpoint(self, endpoint_name=None):
840840 Args:
841841 endpoint_name (str): Name of the endpoint to delete
842842 """
843+ logging .warning (
844+ "HyperparameterTuner.delete_endpoint() will be deprecated in SageMaker Python SDK v2. "
845+ "Please use the delete_endpoint() function on your predictor instead."
846+ )
847+
843848 endpoint_name = endpoint_name or self .best_training_job ()
844849 self .sagemaker_session .delete_endpoint (endpoint_name )
845850
Original file line number Diff line number Diff line change @@ -672,6 +672,25 @@ def test_delete_endpoint_without_endpoint(sagemaker_session):
672672 assert "Endpoint was not created yet" in str (error )
673673
674674
675+ def test_delete_endpoint_deprecation_warning (sagemaker_session , caplog ):
676+ fw = DummyFramework (
677+ entry_point = SCRIPT_PATH ,
678+ role = "DummyRole" ,
679+ sagemaker_session = sagemaker_session ,
680+ train_instance_count = INSTANCE_COUNT ,
681+ train_instance_type = INSTANCE_TYPE ,
682+ )
683+ fw .latest_training_job = Mock (name = "job" )
684+
685+ fw .delete_endpoint ()
686+
687+ expected_warning = (
688+ "estimator.delete_endpoint() will be deprecated in SageMaker Python SDK v2. "
689+ "Please use the delete_endpoint() function on your predictor instead."
690+ )
691+ assert expected_warning in caplog .text
692+
693+
675694def test_enable_cloudwatch_metrics (sagemaker_session ):
676695 fw = DummyFramework (
677696 entry_point = SCRIPT_PATH ,
Original file line number Diff line number Diff line change @@ -911,6 +911,17 @@ def test_delete_endpoint(tuner):
911911 tuner .sagemaker_session .delete_endpoint .assert_called_with (JOB_NAME )
912912
913913
914+ def test_delete_endpoint_deprecation_warning (tuner , caplog ):
915+ tuner .best_training_job = Mock ()
916+ tuner .delete_endpoint ()
917+
918+ expected_warning = (
919+ "HyperparameterTuner.delete_endpoint() will be deprecated in SageMaker Python SDK v2. "
920+ "Please use the delete_endpoint() function on your predictor instead."
921+ )
922+ assert expected_warning in caplog .text
923+
924+
914925def test_fit_no_inputs (tuner , sagemaker_session ):
915926 script_path = os .path .join (DATA_DIR , "mxnet_mnist" , "failure_script.py" )
916927 tuner .estimator = MXNet (
You can’t perform that action at this time.
0 commit comments