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):
826
826
Raises:
827
827
botocore.exceptions.ClientError: If the endpoint does not exist.
828
828
"""
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
+
829
834
self ._ensure_latest_training_job (error_message = "Endpoint was not created yet" )
830
835
self .sagemaker_session .delete_endpoint (self .latest_training_job .name )
831
836
Original file line number Diff line number Diff line change @@ -840,6 +840,11 @@ def delete_endpoint(self, endpoint_name=None):
840
840
Args:
841
841
endpoint_name (str): Name of the endpoint to delete
842
842
"""
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
+
843
848
endpoint_name = endpoint_name or self .best_training_job ()
844
849
self .sagemaker_session .delete_endpoint (endpoint_name )
845
850
Original file line number Diff line number Diff line change @@ -672,6 +672,25 @@ def test_delete_endpoint_without_endpoint(sagemaker_session):
672
672
assert "Endpoint was not created yet" in str (error )
673
673
674
674
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
+
675
694
def test_enable_cloudwatch_metrics (sagemaker_session ):
676
695
fw = DummyFramework (
677
696
entry_point = SCRIPT_PATH ,
Original file line number Diff line number Diff line change @@ -911,6 +911,17 @@ def test_delete_endpoint(tuner):
911
911
tuner .sagemaker_session .delete_endpoint .assert_called_with (JOB_NAME )
912
912
913
913
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
+
914
925
def test_fit_no_inputs (tuner , sagemaker_session ):
915
926
script_path = os .path .join (DATA_DIR , "mxnet_mnist" , "failure_script.py" )
916
927
tuner .estimator = MXNet (
You can’t perform that action at this time.
0 commit comments