class_docstr: Wrapper for a launched run on Kubernetes.
class_docstr_tok: ["Wrapper","for","a","launched","run","on","Kubernetes","."]
docstr: Initialize a KubernetesSubmittedRun.
  
  Other implementations of the AbstractRun interface poll on the run
  when `get_status` is called, but KubernetesSubmittedRun uses
  Kubernetes watch streams to update the run status. One thread handles
  events from the job object and another thread handles events from the
  rank 0 pod. These threads updated the `_status` attributed of the
  KubernetesSubmittedRun object. When `get_status` is called, the
  `_status` attribute is returned.
  
  Arguments:
      batch_api: Kubernetes BatchV1Api object.
      core_api: Kubernetes CoreV1Api object.
      name: Name of the job.
      namespace: Kubernetes namespace.
      secret: Kubernetes secret.
  
  Returns:
      None.
docstr_tok: ["Initialize","a","KubernetesSubmittedRun",".","Other","implementations","of","the","AbstractRun","interface","poll","on","the","run","when","`","get_status","`","is","called",",","but","KubernetesSubmittedRun","uses","Kubernetes","watch","streams","to","update","the","run","status",".","One","thread","handles","events","from","the","job","object","and","another","thread","handles","events","from","the","rank","0","pod",".","These","threads","updated","the","`","_status","`","attributed","of","the","KubernetesSubmittedRun","object",".","When","`","get_status","`","is","called",",","the","`","_status","`","attribute","is","returned",".","Arguments",":","batch_api",":","Kubernetes","BatchV1Api","object",".","core_api",":","Kubernetes","CoreV1Api","object",".","name",":","Name","of","the","job",".","namespace",":","Kubernetes","namespace",".","secret",":","Kubernetes","secret",".","Returns",":","None","."]
code: def __init__(
      self,
      batch_api: "BatchV1Api",
      core_api: "CoreV1Api",
      name: str,
      namespace: Optional[str] = "default",
      secret: Optional["V1Secret"] = None,
  ) -> None:
      """Initialize a KubernetesSubmittedRun.
  
      Other implementations of the AbstractRun interface poll on the run
      when `get_status` is called, but KubernetesSubmittedRun uses
      Kubernetes watch streams to update the run status. One thread handles
      events from the job object and another thread handles events from the
      rank 0 pod. These threads updated the `_status` attributed of the
      KubernetesSubmittedRun object. When `get_status` is called, the
      `_status` attribute is returned.
  
      Arguments:
          batch_api: Kubernetes BatchV1Api object.
          core_api: Kubernetes CoreV1Api object.
          name: Name of the job.
          namespace: Kubernetes namespace.
          secret: Kubernetes secret.
  
      Returns:
          None.
      """
      self.batch_api = batch_api
      self.core_api = core_api
      self.name = name
      self.namespace = namespace
      self._fail_count = 0
      self.secret = secret
  
imports: import asyncio
  import base64
  import json
  import logging
  from typing import Any, Dict, Iterator, List, Optional, Tuple, Union
  import yaml
  import wandb
  from wandb.apis.internal import Api
  from wandb.sdk.launch.agent.agent import LaunchAgent
  from wandb.sdk.launch.environment.abstract import AbstractEnvironment
  from wandb.sdk.launch.registry.abstract import AbstractRegistry
  from wandb.sdk.launch.registry.azure_container_registry import AzureContainerRegistry
  from wandb.sdk.launch.registry.local_registry import LocalRegistry
  from wandb.sdk.launch.runner.abstract import Status
  from wandb.sdk.launch.runner.kubernetes_monitor import WANDB_K8S_LABEL_AGENT, WANDB_K8S_LABEL_MONITOR, WANDB_K8S_RUN_ID, CustomResource, LaunchKubernetesMonitor
  from wandb.util import get_module
  from .._project_spec import EntryPoint, LaunchProject
  from ..builder.build import get_env_vars_dict
  from ..errors import LaunchError
  from ..utils import LOG_PREFIX, MAX_ENV_LENGTHS, PROJECT_SYNCHRONOUS, get_kube_context_and_api_client, make_name_dns_safe
  from .abstract import AbstractRun, AbstractRunner
  import kubernetes_asyncio
  from kubernetes_asyncio import client
  from kubernetes_asyncio.client.api.batch_v1_api import BatchV1Api
  from kubernetes_asyncio.client.api.core_v1_api import CoreV1Api
  from kubernetes_asyncio.client.api.custom_objects_api import CustomObjectsApi
  from kubernetes_asyncio.client.models.v1_secret import V1Secret
  from kubernetes_asyncio.client.rest import ApiException
label_desc: Use image node_id 1 to create a new KubernetesSubmittedRun object from inherited base classes: AbstractRun with example: obj = KubernetesSubmittedRun(batch_api, core_api, name, namespace, secret)