Skip to content

Commit e5155f7

Browse files
authored
infra: wait for DisassociateTrialComponent to take effect in experiment integ test cleanup (#1515)
1 parent f14676a commit e5155f7

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tests/integ/test_experiments_analytics.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ def _delete_resources(sagemaker_client, experiment_name, trials):
138138
for trial, tc in trials.items():
139139
with _ignore_resource_not_found(sagemaker_client):
140140
sagemaker_client.disassociate_trial_component(TrialName=trial, TrialComponentName=tc)
141+
_wait_for_trial_component_disassociation(sagemaker_client, tc)
141142

142143
with _ignore_resource_not_found(sagemaker_client):
143144
sagemaker_client.delete_trial_component(TrialComponentName=tc)
@@ -155,3 +156,14 @@ def _ignore_resource_not_found(sagemaker_client):
155156
yield
156157
except sagemaker_client.exceptions.ResourceNotFound:
157158
pass
159+
160+
161+
def _wait_for_trial_component_disassociation(sagemaker_client, tc):
162+
# Sometimes it can take a bit of waiting for the trial component to be disassociated
163+
for _ in range(5):
164+
# Check that the trial component has been disassociated from the trial
165+
trials = sagemaker_client.list_trials(TrialComponentName=tc)["TrialSummaries"]
166+
if len(trials) == 0:
167+
break
168+
169+
time.sleep(1)

0 commit comments

Comments
 (0)