MCPcopy Create free account
hub / github.com/It4innovations/hyperqueue / wait_until

Function wait_until

benchmarks/src/utils/timing.py:15–23  ·  view source on GitHub ↗
(fn, sleep_s=0.5, timeout_s=DEFAULT_TIMEOUT)

Source from the content-addressed store, hash-verified

13
14
15def wait_until(fn, sleep_s=0.5, timeout_s=DEFAULT_TIMEOUT):
16 end = time.time() + timeout_s
17
18 while time.time() < end:
19 value = fn()
20 if value is not None and value is not False:
21 return value
22 time.sleep(sleep_s)
23 raise TimeoutException(f"Wait timeouted after {timeout_s} seconds")
24
25
26TIMEOUT_POOL = None

Callers 2

_wait_for_workersMethod · 0.50

Calls 4

timeMethod · 0.80
sleepMethod · 0.80
TimeoutExceptionClass · 0.70
fnFunction · 0.50

Tested by

no test coverage detected