docstr: Kills all processes associated with worker node.
  
  Args:
      node: Worker node of which all associated processes
          will be removed.
docstr_tok: ["Kills","all","processes","associated","with","worker","node",".","Args",":","node",":","Worker","node","of","which","all","associated","processes","will","be","removed","."]
code: def remove_node(self, node, allow_graceful=True):
      """Kills all processes associated with worker node.
  
      Args:
          node: Worker node of which all associated processes
              will be removed.
      """
      global_node = ray._private.worker._global_node
      if global_node is not None:
          if (
              node._raylet_socket_name
              == global_node._raylet_socket_name
          ):
              ray.shutdown()
              raise ValueError(
                  "Removing a node that is connected to this Ray client "
                  "is not allowed because it will break the driver."
                  "You can use the get_other_node utility to avoid removing"
                  "a node that the Ray client is connected."
              )
  
      if self.head_node == node:
          # We have to wait to prevent the raylet becomes a zombie which will prevent
          # worker from exiting
          self.head_node.kill_all_processes(
              check_alive=False,
              allow_graceful=allow_graceful,
              wait=True,
          )
          self.head_node = None
          # TODO(rliaw): Do we need to kill all worker processes?
      else:
          # We have to wait to prevent the raylet becomes a zombie which will prevent
          # worker from exiting
          node.kill_all_processes(
              check_alive=False,
              allow_graceful=allow_graceful,
              wait=True,
          )
          self.worker_nodes.remove(node)
  
      assert (
          not node.any_processes_alive()
      ), "There are zombie processes left over after killing."
  
imports: import copy
  import json
  import logging
  import os
  import subprocess
  import tempfile
  import time
  from typing import Dict, Optional
  import yaml
  import ray
  import ray._private.services
  from ray._private import ray_constants
  from ray._private.client_mode_hook import disable_client_hook
  from ray._raylet import GcsClientOptions
  from ray.util.annotations import DeveloperAPI
label_desc: Use image node_id 6 for calling the Cluster obj's underlying member method code with example usage: obj.remove_node(node, allow_graceful) without return types