code: def kill_redundant_log_monitors(redis_address):
      """
      Killing redundant log_monitor.py processes.
      If multiple ray nodes are started on the same machine,
      there will be multiple ray log_monitor.py processes
      monitoring the same log dir. As a result, the logs
      will be replicated multiple times and forwarded to driver.
      See issue https://github.com/ray-project/ray/issues/10392
      """
  
      import psutil
      import subprocess
  
      log_monitor_processes = []
      for proc in psutil.process_iter(["name", "cmdline"]):
          try:
              # Avoid throw exception when listing lwsslauncher in macOS
              if proc.name() is None or proc.name() == "lwsslauncher":
                  continue
              cmdline = subprocess.list2cmdline(proc.cmdline())
              is_log_monitor = "log_monitor.py" in cmdline
              is_same_redis = "--redis-address={}".format(redis_address)
              if is_log_monitor and is_same_redis in cmdline:
                  log_monitor_processes.append(proc)
          except (
              psutil.AccessDenied,
              psutil.ZombieProcess,
              psutil.ProcessLookupError,
          ):
              # psutil may encounter AccessDenied or ZombieProcess exceptions
              # when it's trying to visit some MacOS core services
              if psutil.MACOS:
                  continue
              else:
                  raise Exception(
                      "List process with list2cmdline failed!"
                  )
  
      if len(log_monitor_processes) > 1:
          for proc in log_monitor_processes[1:]:
              proc.kill()
  
imports: import os
  import re
  import subprocess
  import time
  import uuid
  import random
  import warnings
  import tempfile
  import filelock
  import multiprocessing
  from packaging import version
  from zoo.ray.process import session_execute, ProcessMonitor
  from zoo.ray.utils import is_local
  from zoo.ray.utils import resource_to_bytes
  from zoo.ray.utils import get_parent_pid
label_desc: Use image node_id 1 for calling a global function with example usage: kill_redundant_log_monitors(redis_address) without return types