From 5bb38651e3f87e09dcc8188799264888d440be56 Mon Sep 17 00:00:00 2001 From: Dana Benson <31262102+danabens@users.noreply.github.com> Date: Fri, 9 Dec 2022 23:37:34 -0800 Subject: [PATCH] fix: lowercase run name (#767) --- src/sagemaker/experiments/run.py | 5 +++- tests/unit/sagemaker/experiments/test_run.py | 30 ++++++++++---------- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/src/sagemaker/experiments/run.py b/src/sagemaker/experiments/run.py index fcf392aade..40ccad0bb3 100644 --- a/src/sagemaker/experiments/run.py +++ b/src/sagemaker/experiments/run.py @@ -600,7 +600,10 @@ def _generate_trial_component_name(run_name: str, experiment_name: str) -> str: raise ValueError( err_msg_template.format("experiment_name", len(experiment_name), max_len) ) - return "{}{}{}".format(experiment_name, DELIMITER, run_name) + experiment_scoped_tc_name = "{}{}{}".format(experiment_name, DELIMITER, run_name) + # https://t.corp.amazon.com/P77144351 + lower_cased_tc_name = experiment_scoped_tc_name.lower() + return lower_cased_tc_name @staticmethod def _extract_run_name_from_tc_name(trial_component_name: str, experiment_name: str) -> str: diff --git a/tests/unit/sagemaker/experiments/test_run.py b/tests/unit/sagemaker/experiments/test_run.py index bde74800af..316118460f 100644 --- a/tests/unit/sagemaker/experiments/test_run.py +++ b/tests/unit/sagemaker/experiments/test_run.py @@ -710,10 +710,10 @@ def test_list(mock_tc_search, mock_tc_list, mock_tc_load, run_obj, sagemaker_ses [ TrialComponentSearchResult( trial_component_name=Run._generate_trial_component_name( - "A" + str(i), TEST_EXP_NAME + "a" + str(i), TEST_EXP_NAME ), - trial_component_arn="B" + str(i), - display_name="C" + str(i), + trial_component_arn="b" + str(i), + display_name="c" + str(i), creation_time=creation_time + datetime.timedelta(hours=i), last_modified_time=last_modified_time + datetime.timedelta(hours=i), last_modified_by={}, @@ -724,12 +724,12 @@ def test_list(mock_tc_search, mock_tc_list, mock_tc_load, run_obj, sagemaker_ses ] mock_tc_list.return_value = [ TrialComponentSummary( - trial_component_name=Run._generate_trial_component_name("A" + str(i), TEST_EXP_NAME), - trial_component_arn="B" + str(i), - display_name="C" + str(i), - source_arn="D" + str(i), + trial_component_name=Run._generate_trial_component_name("a" + str(i), TEST_EXP_NAME), + trial_component_arn="b" + str(i), + display_name="c" + str(i), + source_arn="d" + str(i), status=TrialComponentStatus( - primary_status=_TrialComponentStatusType.InProgress.value, message="E" + str(i) + primary_status=_TrialComponentStatusType.InProgress.value, message="e" + str(i) ), start_time=start_time + datetime.timedelta(hours=i), end_time=end_time + datetime.timedelta(hours=i), @@ -743,13 +743,13 @@ def test_list(mock_tc_search, mock_tc_list, mock_tc_load, run_obj, sagemaker_ses ( _TrialComponent( trial_component_name=Run._generate_trial_component_name( - "A" + str(i), TEST_EXP_NAME + "a" + str(i), TEST_EXP_NAME ), - trial_component_arn="B" + str(i), - display_name="C" + str(i), - source_arn="D" + str(i), + trial_component_arn="b" + str(i), + display_name="c" + str(i), + source_arn="d" + str(i), status=TrialComponentStatus( - primary_status=_TrialComponentStatusType.InProgress.value, message="E" + str(i) + primary_status=_TrialComponentStatusType.InProgress.value, message="e" + str(i) ), start_time=start_time + datetime.timedelta(hours=i), end_time=end_time + datetime.timedelta(hours=i), @@ -783,12 +783,12 @@ def test_list(mock_tc_search, mock_tc_list, mock_tc_load, run_obj, sagemaker_ses for i in range(tc_list_len_half): run = run_list[i] assert run.experiment_name == TEST_EXP_NAME - assert run.run_name == "A" + str(i) + assert run.run_name == "a" + str(i) assert run._experiment assert run._trial assert isinstance(run._trial_component, _TrialComponent) assert run._trial_component.trial_component_name == Run._generate_trial_component_name( - "A" + str(i), TEST_EXP_NAME + "a" + str(i), TEST_EXP_NAME ) assert run._in_load is False assert run._inside_load_context is False