class_docstr: An orchestrator implmentation which uses Kubernetes to deploy the components such as training and rollout workers
  and Redis Pub/Sub in Coach when used in the distributed mode.
class_docstr_tok: ["An","orchestrator","implmentation","which","uses","Kubernetes","to","deploy","the","components","such","as","training","and","rollout","workers","and","Redis","Pub\/Sub","in","Coach","when","used","in","the","distributed","mode","."]
docstr: Undeploy all the components, such as trainer and rollout worker(s), Redis pub/sub and data store, when required.
docstr_tok: ["Undeploy","all","the","components",",","such","as","trainer","and","rollout","worker","(","s",")",",","Redis","pub\/sub","and","data","store",",","when","required","."]
code: def undeploy(self):
      """
      Undeploy all the components, such as trainer and rollout worker(s), Redis pub/sub and data store, when required.
      """
  
      trainer_params = self.params.run_type_params.get(
          str(RunType.TRAINER), None
      )
      api_client = k8sclient.BatchV1Api()
      delete_options = k8sclient.V1DeleteOptions(
          propagation_policy="Foreground"
      )
  
      if trainer_params:
          try:
              api_client.delete_namespaced_job(
                  trainer_params.orchestration_params["job_name"],
                  self.params.namespace,
                  delete_options,
              )
          except k8sclient.rest.ApiException as e:
              screen.print(
                  "Got exception: %s\n while deleting trainer", e
              )
      worker_params = self.params.run_type_params.get(
          str(RunType.ROLLOUT_WORKER), None
      )
      if worker_params:
          try:
              api_client.delete_namespaced_job(
                  worker_params.orchestration_params["job_name"],
                  self.params.namespace,
                  delete_options,
              )
          except k8sclient.rest.ApiException as e:
              screen.print(
                  "Got exception: %s\n while deleting workers", e
              )
      self.memory_backend.undeploy()
      self.data_store.undeploy()
  
imports: import os
  import uuid
  import json
  import time
  import sys
  from enum import Enum
  from typing import List
  from configparser import ConfigParser, Error
  from multiprocessing import Process
  from rl_coach.base_parameters import RunType
  from rl_coach.orchestrators.deploy import Deploy, DeployParameters
  from kubernetes import client, config
  from rl_coach.memories.backend.memory import MemoryBackendParameters
  from rl_coach.memories.backend.memory_impl import get_memory_backend
  from rl_coach.data_stores.data_store import DataStoreParameters
  from rl_coach.data_stores.data_store_impl import get_data_store
  from rl_coach.logger import screen
label_desc: Use image node_id 9 for calling the Kubernetes obj's underlying member method code with example usage: obj.undeploy() without return types