python/ray/_private/test_utils.py
async def async_wait_for_condition(
    condition_predictor, timeout=10, retry_interval_ms=100, **kwargs: Any
):
    """Wait until a condition is met or time out with an exception.

    Args:
        condition_predictor: A function that predicts the condition.
        timeout: Maximum timeout in seconds.
        retry_interval_ms: Retry interval in milliseconds.

    Raises:
        RuntimeError: If the condition is not met before the timeout expires.
    """
    start = time.time()
    last_ex = None
    while time.time() - start <= timeout:
        try:
            if condition_predictor(**kwargs):
                return
        except Exception as ex:
            last_ex = ex
        await asyncio.sleep(retry_interval_ms / 1000.0)
    message = "The condition wasn't met before the timeout expired."
    if last_ex is not None:
        message += f" Last exception: {last_ex}"
    raise RuntimeError(message)
Wait until a condition is met or time out with an exception.

    Args:
        condition_predictor: A function that predicts the condition.
        timeout: Maximum timeout in seconds.
        retry_interval_ms: Retry interval in milliseconds.

    Raises:
        RuntimeError: If the condition is not met before the timeout expires.
    
Wait until a condition is met or time out with an exception.
Wait until a condition is met or time out with an exception .
async def async_wait_for_condition(
    condition_predictor, timeout=10, retry_interval_ms=100, **kwargs: Any
):
    start = time.time()
    last_ex = None
    while time.time() - start <= timeout:
        try:
            if condition_predictor(**kwargs):
                return
        except Exception as ex:
            last_ex = ex
        await asyncio.sleep(retry_interval_ms / 1000.0)
    message = "The condition wasn't met before the timeout expired."
    if last_ex is not None:
        message += f" Last exception: {last_ex}"
    raise RuntimeError(message)
async def async_wait_for_condition ( condition_predictor , timeout = 10 , retry_interval_ms = 100 , ** kwargs : Any ) : start = time . time ( ) last_ex = None while time . time ( ) - start <= timeout : try : if condition_predictor ( ** kwargs ) : return except Exception as ex : last_ex = ex await asyncio . sleep ( retry_interval_ms / 1000.0 ) message = "The condition wasn't met before the timeout expired." if last_ex is not None : message += f" Last exception: {last_ex}" raise RuntimeError ( message )
Wait until a condition is met or time out with an exception.
Wait until a condition is met or time out with an exception .
"""Wait until a condition is met or time out with an exception.

    Args:
        condition_predictor: A function that predicts the condition.
        timeout: Maximum timeout in seconds.
        retry_interval_ms: Retry interval in milliseconds.

    Raises:
        RuntimeError: If the condition is not met before the timeout expires.
    """
If the condition is not met before the timeout expires.
If the condition is not met before the timeout expires .
RuntimeError
condition_predictor
A function that predicts the condition.
A function that predicts the condition .
timeout
Maximum timeout in seconds.
Maximum timeout in seconds .
retry_interval_ms
Retry interval in milliseconds.
Retry interval in milliseconds .
kwargs
Any