python/ray/tests/kuberay/utils.py
def wait_for_pod_to_start(
    pod_name_filter: str, namespace: str, tries=60, backoff_s=5
) -> None:
    """Waits for a pod to have Running status.phase.

    More precisely, waits until there is a pod with name containing `pod_name_filter`
    and the pod has Running status.phase."""
    for i in range(tries):
        pod = get_pod(pod_name_filter=pod_name_filter, namespace=namespace)
        if not pod:
            # We didn't get a matching pod.
            continue
        pod_status = (
            subprocess.check_output(
                [
                    "kubectl",
                    "-n",
                    namespace,
                    "get",
                    "pod",
                    pod,
                    "-o",
                    "custom-columns=POD:status.phase",
                    "--no-headers",
                ]
            )
            .decode()
            .strip()
        )
        # "not found" is part of the kubectl output if the pod's not there.
        if "not found" in pod_status:
            raise Exception(f"Pod {pod} not found.")
        elif pod_status == "Running":
            logger.info(f"Confirmed pod {pod} is Running.")
            return
        elif i < tries - 1:
            logger.info(
                f"Pod {pod} has status {pod_status}. Waiting for the pod to enter "
                "Running status."
            )
            time.sleep(backoff_s)
        else:
            raise Exception(f"Timed out waiting for pod {pod} to enter Running status.")
Waits for a pod to have Running status.phase.

    More precisely, waits until there is a pod with name containing `pod_name_filter`
    and the pod has Running status.phase.
Waits for a pod to have Running status.phase.
More precisely, waits until there is a pod with name containing `pod_name_filter`
and the pod has Running status.phase.
Waits for a pod to have Running status . phase . More precisely waits until there is a pod with name containing ` pod_name_filter ` and the pod has Running status . phase .
def wait_for_pod_to_start(
    pod_name_filter: str, namespace: str, tries=60, backoff_s=5
) -> None:
    for i in range(tries):
        pod = get_pod(pod_name_filter=pod_name_filter, namespace=namespace)
        if not pod:
            continue
        pod_status = (
            subprocess.check_output(
                [
                    "kubectl",
                    "-n",
                    namespace,
                    "get",
                    "pod",
                    pod,
                    "-o",
                    "custom-columns=POD:status.phase",
                    "--no-headers",
                ]
            )
            .decode()
            .strip()
        )
        if "not found" in pod_status:
            raise Exception(f"Pod {pod} not found.")
        elif pod_status == "Running":
            logger.info(f"Confirmed pod {pod} is Running.")
            return
        elif i < tries - 1:
            logger.info(
                f"Pod {pod} has status {pod_status}. Waiting for the pod to enter "
                "Running status."
            )
            time.sleep(backoff_s)
        else:
            raise Exception(f"Timed out waiting for pod {pod} to enter Running status.")
def wait_for_pod_to_start ( pod_name_filter : str , namespace : str , tries = 60 , backoff_s = 5 ) -> None : for i in range ( tries ) : pod = get_pod ( pod_name_filter = pod_name_filter , namespace = namespace ) if not pod : continue pod_status = ( subprocess . check_output ( [ "kubectl" , "-n" , namespace , "get" , "pod" , pod , "-o" , "custom-columns=POD:status.phase" , "--no-headers" , ] ) . decode ( ) . strip ( ) ) if "not found" in pod_status : raise Exception ( f"Pod {pod} not found." ) elif pod_status == "Running" : logger . info ( f"Confirmed pod {pod} is Running." ) return elif i < tries - 1 : logger . info ( f"Pod {pod} has status {pod_status}. Waiting for the pod to enter " "Running status." ) time . sleep ( backoff_s ) else : raise Exception ( f"Timed out waiting for pod {pod} to enter Running status." )
Waits for a pod to have Running status.phase.
Waits for a pod to have Running status . phase .
"""Waits for a pod to have Running status.phase.

    More precisely, waits until there is a pod with name containing `pod_name_filter`
    and the pod has Running status.phase.""" # We didn't get a matching pod. # "not found" is part of the kubectl output if the pod's not there.
pod_name_filter
str
namespace
str
tries
backoff_s