Skip to content

Commit 99b8c5d

Browse files
committed
fix(experiments/run.py): added conditional to only append RUN_TC_TAG to tags only if it doesn't exist in the tags in the _append_run_tc_label_to_tags function
This change is to stop the RUN_TC_TAG from being duplicated if you run multiple experiments using the same variable for your tags
1 parent 5cb00a4 commit 99b8c5d

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/sagemaker/experiments/run.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,8 @@ def _append_run_tc_label_to_tags(tags: Optional[List[Dict[str, str]]] = None) ->
648648
"""
649649
if not tags:
650650
tags = []
651-
tags.append(RUN_TC_TAG)
651+
if RUN_TC_TAG not in tags:
652+
tags.append(RUN_TC_TAG)
652653
return tags
653654

654655
def __enter__(self):

tests/unit/sagemaker/experiments/test_run.py

+5
Original file line numberDiff line numberDiff line change
@@ -911,6 +911,11 @@ def test_append_run_tc_label_to_tags():
911911
ret = Run._append_run_tc_label_to_tags(tags)
912912
assert len(ret) == 2
913913
assert expected_tc_tag in ret
914+
915+
tags = [expected_tc_tag]
916+
ret = Run._append_run_tc_label_to_tags(tags)
917+
assert len(ret) == 1
918+
assert expected_tc_tag in ret
914919

915920

916921
def _verify_tc_status_before_enter_init(trial_component):

0 commit comments

Comments
 (0)