class_docstr: Monitors kubernetes resources managed by the launch agent.
  
  Note: this class is forced to be a singleton in order to prevent multiple
  threads from being created that monitor the same kubernetes resources.
docstr: Initialize the LaunchKubernetesMonitor.
docstr_tok: ["Initialize","the","LaunchKubernetesMonitor","."]
code: def __init__(
      self,
      core_api: CoreV1Api,
      batch_api: BatchV1Api,
      custom_api: CustomObjectsApi,
      label_selector: str,
  ):
      """Initialize the LaunchKubernetesMonitor."""
      self._core_api: CoreV1Api = core_api
      self._batch_api: BatchV1Api = batch_api
      self._custom_api: CustomObjectsApi = custom_api
  
      self._label_selector: str = label_selector
  
      # Dict mapping a tuple of (namespace, resource_type) to an
      # asyncio.Task that is monitoring that resource type in that namespace.
      self._monitor_tasks: Dict[
          Tuple[str, Union[str, CustomResource]], asyncio.Task
      ] = dict()
  
      # Map from job name to job state.
      self._job_states: Dict[str, Status] = dict()
  
imports: import asyncio
  import logging
  import sys
  import traceback
  from typing import Any, Dict, List, Optional, Tuple, Union
  import kubernetes_asyncio
  import urllib3
  from kubernetes_asyncio import watch
  from kubernetes_asyncio.client import ApiException, BatchV1Api, CoreV1Api, CustomObjectsApi, V1PodStatus
  import wandb
  from wandb.sdk.launch.agent import LaunchAgent
  from wandb.sdk.launch.errors import LaunchError
  from wandb.sdk.launch.runner.abstract import State, Status
  from wandb.sdk.launch.utils import get_kube_context_and_api_client
label_desc: Use image node_id 2 to create a new LaunchKubernetesMonitor object  with example: obj = LaunchKubernetesMonitor(core_api, batch_api, custom_api, label_selector)