class_docstr: A model server runner that launches model server in kubernetes cluster.
class_docstr_tok: ["A","model","server","runner","that","launches","model","server","in","kubernetes","cluster","."]
code: def WaitUntilRunning(self, deadline: float) -> None:
      assert (
          self._pod_name
      ), "Pod has not been created yet. You should call Start() first."
  
      while time.time() < deadline:
          try:
              pod = self._k8s_core_api.read_namespaced_pod(
                  name=self._pod_name, namespace=self._namespace
              )
          except rest.ApiException as e:
              logging.info(
                  "Continue polling after getting ApiException(%s)", e
              )
              time.sleep(_DEFAULT_POLLING_INTERVAL_SEC)
              continue
          # Pod phase is one of Pending, Running, Succeeded, Failed, or Unknown.
          # Succeeded and Failed indicates the pod lifecycle has reached its end,
          # while we expect the job to be running and hanging. Phase is Unknown if
          # the state of the pod could not be obtained, thus we can wait until we
          # confirm the phase.
          pod_phase = _PodPhase(pod.status.phase)
          if pod_phase == _PodPhase.RUNNING and pod.status.pod_ip:
              self._endpoint = "{}:{}".format(
                  pod.status.pod_ip, self._serving_binary.container_port
              )
              return
          if pod_phase.is_done:
              raise error_types.JobAborted(
                  "Job has been aborted. (phase={})".format(pod_phase)
              )
          logging.info(
              "Waiting for the pod to be running. (phase=%s)", pod_phase
          )
          time.sleep(_DEFAULT_POLLING_INTERVAL_SEC)
  
      raise error_types.DeadlineExceeded(
          "Deadline exceeded while waiting for pod to be running."
      )
  
imports: import datetime
  import os
  import time
  from typing import Optional
  from absl import logging
  from apache_beam.utils import retry
  from kubernetes import client
  from kubernetes.client import rest
  from tfx.components.infra_validator import error_types
  from tfx.components.infra_validator import serving_bins
  from tfx.components.infra_validator.model_server_runners import base_runner
  from tfx.proto import infra_validator_pb2
  from tfx.utils import kube_utils
label_desc: Use image node_id 5 for calling the KubernetesRunner obj's underlying member method code with example usage: obj.WaitUntilRunning(deadline) without return types