File tree Expand file tree Collapse file tree 4 files changed +31
-0
lines changed Expand file tree Collapse file tree 4 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -1722,6 +1722,20 @@ def create_tuning_job(
17221722 LOGGER .debug ("tune request: %s" , json .dumps (tune_request , indent = 4 ))
17231723 self .sagemaker_client .create_hyper_parameter_tuning_job (** tune_request )
17241724
1725+ def describe_tuning_job (self , job_name ):
1726+ """Calls the DescribeHyperParameterTuningJob API for the given job name
1727+ and returns the response.
1728+
1729+ Args:
1730+ job_name (str): The name of the hyperparameter tuning job to describe.
1731+
1732+ Returns:
1733+ dict: A dictionary response with the hyperparameter tuning job description.
1734+ """
1735+ return self .sagemaker_client .describe_hyper_parameter_tuning_job (
1736+ HyperParameterTuningJobName = job_name
1737+ )
1738+
17251739 @classmethod
17261740 def _map_tuning_config (
17271741 cls ,
Original file line number Diff line number Diff line change @@ -750,6 +750,10 @@ def stop_tuning_job(self):
750750 self ._ensure_last_tuning_job ()
751751 self .latest_tuning_job .stop ()
752752
753+ def describe (self ):
754+ """Returns a response from the DescribeHyperParameterTuningJob API call."""
755+ return self .sagemaker_session .describe_tuning_job (self ._current_job_name )
756+
753757 def wait (self ):
754758 """Wait for latest hyperparameter tuning job to finish."""
755759 self ._ensure_last_tuning_job ()
Original file line number Diff line number Diff line change @@ -2125,3 +2125,11 @@ def test_list_candidates_for_auto_ml_job_with_optional_args(sagemaker_session):
21252125 sagemaker_session .sagemaker_client .list_candidates_for_auto_ml_job .assert_called_with (
21262126 ** COMPLETE_EXPECTED_LIST_CANDIDATES_ARGS
21272127 )
2128+
2129+
2130+ def test_describe_tuning_Job (sagemaker_session ):
2131+ job_name = "hyper-parameter-tuning"
2132+ sagemaker_session .describe_tuning_job (job_name = job_name )
2133+ sagemaker_session .sagemaker_client .describe_hyper_parameter_tuning_job .assert_called_with (
2134+ HyperParameterTuningJobName = job_name
2135+ )
Original file line number Diff line number Diff line change @@ -1423,6 +1423,11 @@ def test_create_warm_start_tuner_with_single_estimator_dict(
14231423 assert tuner .warm_start_config .parents == additional_parents
14241424
14251425
1426+ def test_describe (tuner ):
1427+ tuner .describe ()
1428+ tuner .sagemaker_session .describe_tuning_job .assert_called_once ()
1429+
1430+
14261431def _convert_tuning_job_details (job_details , estimator_name ):
14271432 """Convert a tuning job description using the 'TrainingJobDefinition' field into a new one using a single-item
14281433 'TrainingJobDefinitions' field (list).
You can’t perform that action at this time.
0 commit comments