File tree 4 files changed +31
-0
lines changed
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(
1722
1722
LOGGER .debug ("tune request: %s" , json .dumps (tune_request , indent = 4 ))
1723
1723
self .sagemaker_client .create_hyper_parameter_tuning_job (** tune_request )
1724
1724
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
+
1725
1739
@classmethod
1726
1740
def _map_tuning_config (
1727
1741
cls ,
Original file line number Diff line number Diff line change @@ -750,6 +750,10 @@ def stop_tuning_job(self):
750
750
self ._ensure_last_tuning_job ()
751
751
self .latest_tuning_job .stop ()
752
752
753
+ def describe (self ):
754
+ """Returns a response from the DescribrHyperParameterTuningJob API call."""
755
+ return self .sagemaker_session .describe_tuning_job (self ._current_job_name )
756
+
753
757
def wait (self ):
754
758
"""Wait for latest hyperparameter tuning job to finish."""
755
759
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):
2125
2125
sagemaker_session .sagemaker_client .list_candidates_for_auto_ml_job .assert_called_with (
2126
2126
** COMPLETE_EXPECTED_LIST_CANDIDATES_ARGS
2127
2127
)
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(
1423
1423
assert tuner .warm_start_config .parents == additional_parents
1424
1424
1425
1425
1426
+ def test_describe (tuner ):
1427
+ tuner .describe ()
1428
+ tuner .sagemaker_session .describe_tuning_job .assert_called_once ()
1429
+
1430
+
1426
1431
def _convert_tuning_job_details (job_details , estimator_name ):
1427
1432
"""Convert a tuning job description using the 'TrainingJobDefinition' field into a new one using a single-item
1428
1433
'TrainingJobDefinitions' field (list).
You can’t perform that action at this time.
0 commit comments