Skip to content

Commit 8694237

Browse files
committed
fix: double Run create on load_run
fixes #3673
1 parent 4884d18 commit 8694237

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/sagemaker/experiments/run.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,10 @@ def _extract_run_name_from_tc_name(trial_component_name: str, experiment_name: s
633633
Returns:
634634
str: The name of the Run object supplied by a user.
635635
"""
636-
return trial_component_name.replace("{}{}".format(experiment_name, DELIMITER), "", 1)
636+
# TODO: we should revert the lower casting once backend fix reaches prod
637+
return trial_component_name.replace(
638+
"{}{}".format(experiment_name.lower(), DELIMITER), "", 1
639+
)
637640

638641
@staticmethod
639642
def _append_run_tc_label_to_tags(tags: Optional[List[Dict[str, str]]] = None) -> list:
@@ -843,7 +846,6 @@ def list_runs(
843846
created_after: Optional[datetime.datetime] = None,
844847
sagemaker_session: Optional["Session"] = None,
845848
max_results: Optional[int] = None,
846-
next_token: Optional[str] = None,
847849
sort_by: SortByType = SortByType.CREATION_TIME,
848850
sort_order: SortOrderType = SortOrderType.DESCENDING,
849851
) -> list:
@@ -861,14 +863,15 @@ def list_runs(
861863
AWS services needed. If not specified, one is created using the
862864
default AWS configuration chain.
863865
max_results (int): Maximum number of Run objects to retrieve (default: None).
864-
next_token (str): Token for next page of results (default: None).
865866
sort_by (SortByType): The property to sort results by. One of NAME, CREATION_TIME
866867
(default: CREATION_TIME).
867868
sort_order (SortOrderType): One of ASCENDING, or DESCENDING (default: DESCENDING).
868869
869870
Returns:
870871
list: A list of ``Run`` objects.
871872
"""
873+
874+
# all trial components retrieved by default
872875
tc_summaries = _TrialComponent.list(
873876
experiment_name=experiment_name,
874877
created_before=created_before,
@@ -877,7 +880,6 @@ def list_runs(
877880
sort_order=sort_order.value,
878881
sagemaker_session=sagemaker_session,
879882
max_results=max_results,
880-
next_token=next_token,
881883
)
882884
run_list = []
883885
for tc_summary in tc_summaries:

tests/unit/sagemaker/experiments/test_run.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -832,7 +832,6 @@ def test_list(mock_tc_search, mock_tc_list, mock_tc_load, run_obj, sagemaker_ses
832832
sort_order="Ascending",
833833
sagemaker_session=sagemaker_session,
834834
max_results=None,
835-
next_token=None,
836835
)
837836
assert len(run_list) == tc_list_len_half
838837
for i in range(tc_list_len_half):

0 commit comments

Comments
 (0)