python/ray/tests/kuberay/utils.py
def wait_for_ray_health(
    pod_name_filter: str,
    namespace: str,
    tries=60,
    backoff_s=5,
    ray_container="ray-head",
) -> None:
    """Waits until a Ray pod passes `ray health-check`.

    More precisely, waits until a Ray pod whose name includes the string
    `pod_name_filter` passes `ray health-check`.
    (Ensures Ray has completely started in the pod.)

    Use case: Wait until there is a Ray head pod with Ray running on it.
    """
    for i in range(tries):
        try:
            pod = get_pod(pod_name_filter=pod_name_filter, namespace="default")
            assert pod, f"Couldn't find a pod matching {pod_name_filter}."
            # `ray health-check` yields 0 exit status iff it succeeds
            kubectl_exec(
                ["ray", "health-check"], pod, namespace, container=ray_container
            )
            logger.info(f"ray health check passes for pod {pod}")
            return
        except subprocess.CalledProcessError as e:
            logger.info(f"Failed ray health check for pod {pod}.")
            if i < tries - 1:
                logger.info("Trying again.")
                time.sleep(backoff_s)
            else:
                logger.info("Giving up.")
                raise e from None
Waits until a Ray pod passes `ray health-check`.

    More precisely, waits until a Ray pod whose name includes the string
    `pod_name_filter` passes `ray health-check`.
    (Ensures Ray has completely started in the pod.)

    Use case: Wait until there is a Ray head pod with Ray running on it.
    
Waits until a Ray pod passes `ray health-check`.
More precisely, waits until a Ray pod whose name includes the string
`pod_name_filter` passes `ray health-check`.
(Ensures Ray has completely started in the pod.)

Use case: Wait until there is a Ray head pod with Ray running on it.
Waits until a Ray pod passes ` ray health - check ` . More precisely waits until a Ray pod whose name includes the string ` pod_name_filter ` passes ` ray health - check ` . ( Ensures Ray has completely started in the pod . ) Use case : Wait until there is a Ray head pod with Ray running on it .
def wait_for_ray_health(
    pod_name_filter: str,
    namespace: str,
    tries=60,
    backoff_s=5,
    ray_container="ray-head",
) -> None:
    for i in range(tries):
        try:
            pod = get_pod(pod_name_filter=pod_name_filter, namespace="default")
            assert pod, f"Couldn't find a pod matching {pod_name_filter}."
            kubectl_exec(
                ["ray", "health-check"], pod, namespace, container=ray_container
            )
            logger.info(f"ray health check passes for pod {pod}")
            return
        except subprocess.CalledProcessError as e:
            logger.info(f"Failed ray health check for pod {pod}.")
            if i < tries - 1:
                logger.info("Trying again.")
                time.sleep(backoff_s)
            else:
                logger.info("Giving up.")
                raise e from None
def wait_for_ray_health ( pod_name_filter : str , namespace : str , tries = 60 , backoff_s = 5 , ray_container = "ray-head" , ) -> None : for i in range ( tries ) : try : pod = get_pod ( pod_name_filter = pod_name_filter , namespace = "default" ) assert pod , f"Couldn't find a pod matching {pod_name_filter}." kubectl_exec ( [ "ray" , "health-check" ] , pod , namespace , container = ray_container ) logger . info ( f"ray health check passes for pod {pod}" ) return except subprocess . CalledProcessError as e : logger . info ( f"Failed ray health check for pod {pod}." ) if i < tries - 1 : logger . info ( "Trying again." ) time . sleep ( backoff_s ) else : logger . info ( "Giving up." ) raise e from None
Waits until a Ray pod passes `ray health-check`.
Waits until a Ray pod passes ` ray health - check ` .
"""Waits until a Ray pod passes `ray health-check`.

    More precisely, waits until a Ray pod whose name includes the string
    `pod_name_filter` passes `ray health-check`.
    (Ensures Ray has completely started in the pod.)

    Use case: Wait until there is a Ray head pod with Ray running on it.
    """ # `ray health-check` yields 0 exit status iff it succeeds
pod_name_filter
str
namespace
str
tries
backoff_s
ray_container