Skip to content

Commit 6b245bd

Browse files
authored
Increase unit test stability (#926)
* Increase unit test stability by waiting longer for the server to process run traces, and by querying the server less frequently for new run traces. * Make test stricter actually, we only wait for evaluations to ensure that the trace is processed by the server. Therefore, we can also simply wait for the trace being available instead of relying on the proxy indicator of evaluations being available. * fix stricter test
1 parent 368700e commit 6b245bd

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

tests/test_runs/test_run_functions.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,19 @@ def _wait_for_processed_run(self, run_id, max_waiting_time_seconds):
8181
start_time = time.time()
8282
while time.time() - start_time < max_waiting_time_seconds:
8383
run = openml.runs.get_run(run_id, ignore_cache=True)
84-
if len(run.evaluations) > 0:
85-
return
86-
else:
87-
time.sleep(3)
84+
85+
try:
86+
openml.runs.get_run_trace(run_id)
87+
except openml.exceptions.OpenMLServerException:
88+
time.sleep(10)
89+
continue
90+
91+
if len(run.evaluations) == 0:
92+
time.sleep(10)
93+
continue
94+
95+
return
96+
8897
raise RuntimeError(
8998
"Could not find any evaluations! Please check whether run {} was "
9099
"evaluated correctly on the server".format(run_id)
@@ -915,7 +924,7 @@ def test_get_run_trace(self):
915924
run = run.publish()
916925
TestBase._mark_entity_for_removal("run", run.run_id)
917926
TestBase.logger.info("collected from test_run_functions: {}".format(run.run_id))
918-
self._wait_for_processed_run(run.run_id, 200)
927+
self._wait_for_processed_run(run.run_id, 400)
919928
run_id = run.run_id
920929
except openml.exceptions.OpenMLRunsExistError as e:
921930
# The only error we expect, should fail otherwise.

0 commit comments

Comments
 (0)