Skip to content

Commit

Permalink
fix: lowercase run name (aws#767)
Browse files Browse the repository at this point in the history
  • Loading branch information
danabens authored and qidewenwhen committed Dec 14, 2022
1 parent a946640 commit 68d9d11
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 16 deletions.
5 changes: 4 additions & 1 deletion src/sagemaker/experiments/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
30 changes: 15 additions & 15 deletions tests/unit/sagemaker/experiments/test_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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={},
Expand All @@ -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),
Expand All @@ -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),
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 68d9d11

Please sign in to comment.