Skip to content

Commit da41bb3

Browse files
committed
fix: remove tag logic from association
1 parent 2efaefd commit da41bb3

File tree

3 files changed

+1
-99
lines changed

3 files changed

+1
-99
lines changed

src/sagemaker/lineage/association.py

-22
Original file line numberDiff line numberDiff line change
@@ -64,28 +64,6 @@ def delete(self):
6464
"""Delete this Association from SageMaker."""
6565
self._invoke_api(self._boto_delete_method, self._boto_delete_members)
6666

67-
def set_tag(self, tag=None):
68-
"""Add a tag to the object.
69-
70-
Args:
71-
tag (obj): Key value pair to set tag.
72-
73-
Returns:
74-
list({str:str}): a list of key value pairs
75-
"""
76-
return self._set_tags(resource_arn=self.source_arn, tags=[tag])
77-
78-
def set_tags(self, tags=None):
79-
"""Add tags to the object.
80-
81-
Args:
82-
tags ([{key:value}]): list of key value pairs.
83-
84-
Returns:
85-
list({str:str}): a list of key value pairs
86-
"""
87-
return self._set_tags(resource_arn=self.source_arn, tags=tags)
88-
8967
@classmethod
9068
def create(
9169
cls,

tests/integ/sagemaker/lineage/test_association.py

+1-37
Original file line numberDiff line numberDiff line change
@@ -57,40 +57,4 @@ def test_list(association_objs, sagemaker_session):
5757
assert association_keys_listed
5858

5959
for listed_asscn in listed:
60-
assert listed_asscn.created_by is None
61-
62-
63-
@pytest.mark.timeout(30)
64-
def test_set_tag(association_obj, sagemaker_session):
65-
tag = {"Key": "foo", "Value": "bar"}
66-
association_obj.set_tag(tag)
67-
68-
while True:
69-
actual_tags = sagemaker_session.sagemaker_client.list_tags(
70-
ResourceArn=association_obj.source_arn
71-
)["Tags"]
72-
if actual_tags:
73-
break
74-
time.sleep(5)
75-
# When sagemaker-client-config endpoint-url is passed as argument to hit some endpoints,
76-
# length of actual tags will be greater than 1
77-
assert len(actual_tags) > 0
78-
assert actual_tags[0] == tag
79-
80-
81-
@pytest.mark.timeout(30)
82-
def test_tags(association_obj, sagemaker_session):
83-
tags = [{"Key": "foo1", "Value": "bar1"}]
84-
association_obj.set_tags(tags)
85-
86-
while True:
87-
actual_tags = sagemaker_session.sagemaker_client.list_tags(
88-
ResourceArn=association_obj.source_arn
89-
)["Tags"]
90-
if actual_tags:
91-
break
92-
time.sleep(5)
93-
# When sagemaker-client-config endpoint-url is passed as argument to hit some endpoints,
94-
# length of actual tags will be greater than 1
95-
assert len(actual_tags) > 0
96-
assert [actual_tags[-1]] == tags
60+
assert listed_asscn.created_by is None

tests/unit/sagemaker/lineage/test_association.py

-40
Original file line numberDiff line numberDiff line change
@@ -37,46 +37,6 @@ def test_create(sagemaker_session):
3737
assert "bar" == obj.destination_arn
3838
assert "test-type" == obj.association_type
3939

40-
41-
def test_set_tag(sagemaker_session):
42-
sagemaker_session.sagemaker_client.add_association.return_value = {
43-
"AssociationArn": "association-arn",
44-
}
45-
obj = association.Association.create(
46-
source_arn="foo",
47-
destination_arn="bar",
48-
association_type="test-type",
49-
sagemaker_session=sagemaker_session,
50-
)
51-
tag = {"Key": "foo", "Value": "bar"}
52-
sagemaker_session.sagemaker_client.add_tags.return_value = {"Tags": tag}
53-
obj.set_tag(tag)
54-
55-
sagemaker_session.sagemaker_client.add_tags.assert_called_with = {
56-
"ResourceArn": "association-arn",
57-
"Tags": [{"Key": "foo", "Value": "bar"}],
58-
}
59-
60-
61-
def test_set_tags(sagemaker_session):
62-
sagemaker_session.sagemaker_client.add_association.return_value = {
63-
"AssociationArn": "association-arn",
64-
}
65-
obj = association.Association.create(
66-
source_arn="foo",
67-
destination_arn="bar",
68-
association_type="test-type",
69-
sagemaker_session=sagemaker_session,
70-
)
71-
tags = [{"Key": "foo1", "Value": "bar1"}, {"Key": "foo2", "Value": "bar2"}]
72-
sagemaker_session.sagemaker_client.add_tags.return_value = {"Tags": tags}
73-
obj.set_tags(tags=tags)
74-
sagemaker_session.sagemaker_client.add_tags.assert_called_with = {
75-
"ResourceArn": "association-arn",
76-
"Tags": [{"Key": "foo1", "Value": "bar1"}, {"Key": "foo2", "Value": "bar2"}],
77-
}
78-
79-
8040
def test_list(sagemaker_session):
8141
creation_time = datetime.datetime.now(datetime.timezone.utc) + datetime.timedelta(hours=3)
8242

0 commit comments

Comments
 (0)