Skip to content

Commit 23fe126

Browse files
author
Yi-Ting Lee
committed
sleep time before clean_all added (avoid race condition)
1 parent c1169be commit 23fe126

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

tests/integ/sagemaker/lineage/helpers.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,10 @@ def create_association(self, source_arn, dest_arn, association_type="AssociatedW
142142
return False
143143

144144
def clean_all(self):
145+
# clean all lineage data created by LineageResourceHelper
146+
147+
time.sleep(1) # avoid GSI race condition between create & delete
148+
145149
for source, dest in self.associations:
146150
try:
147151
self.client.delete_association(SourceArn=source, DestinationArn=dest)

tests/integ/sagemaker/lineage/test_lineage_visualize.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,11 @@ def test_LineageResourceHelper(sagemaker_session):
2929
art1 = lineage_resource_helper.create_artifact(artifact_name=name())
3030
art2 = lineage_resource_helper.create_artifact(artifact_name=name())
3131
lineage_resource_helper.create_association(source_arn=art1, dest_arn=art2)
32-
lineage_resource_helper.clean_all()
3332
except Exception as e:
3433
print(e)
3534
assert False
35+
finally:
36+
lineage_resource_helper.clean_all()
3637

3738

3839
@pytest.mark.skip("visualizer load test")
@@ -46,7 +47,7 @@ def test_wide_graph_visualize(sagemaker_session):
4647
# \ \--> Artifact
4748
# \---> ...
4849
try:
49-
for i in range(200):
50+
for i in range(150):
5051
artifact_arn = lineage_resource_helper.create_artifact(artifact_name=name())
5152
lineage_resource_helper.create_association(
5253
source_arn=wide_graph_root_arn, dest_arn=artifact_arn
@@ -56,6 +57,10 @@ def test_wide_graph_visualize(sagemaker_session):
5657
lq_result = lq.query(start_arns=[wide_graph_root_arn])
5758
lq_result.visualize(path="wideGraph.html")
5859

60+
print("vertex len = ")
61+
print(len(lq_result.vertices))
62+
assert False
63+
5964
except Exception as e:
6065
print(e)
6166
assert False

0 commit comments

Comments
 (0)