code: def run_kuberay_autoscaler(cluster_name: str, cluster_namespace: str):
      """Wait until the Ray head container is ready. Then start the autoscaler."""
      head_ip = get_node_ip_address()
      ray_address = f"{head_ip}:6379"
      while True:
          try:
              # Autoscaler Ray version might not exactly match GCS version, so skip the
              # version check when checking GCS status.
              subprocess.check_call(
                  [
                      "ray",
                      "health-check",
                      "--address",
                      ray_address,
                      "--skip-version-check",
                  ]
              )
              # Logging is not ready yet. Print to stdout for now.
              print("The Ray head is ready. Starting the autoscaler.")
              break
          except subprocess.CalledProcessError:
              print("The Ray head is not yet ready.")
              print(f"Will check again in {BACKOFF_S} seconds.")
              time.sleep(BACKOFF_S)
  
      # The Ray head container sets up the log directory. Thus, we set up logging
      # only after the Ray head is ready.
      _setup_logging()
  
      # autoscaling_config_producer reads the RayCluster CR from K8s and uses the CR
      # to output an autoscaling config.
      autoscaling_config_producer = AutoscalingConfigProducer(
          cluster_name, cluster_namespace
      )
  
      Monitor(
          address=ray_address,
          # The `autoscaling_config` arg can be a dict or a `Callable: () -> dict`.
          # In this case, it's a callable.
          autoscaling_config=autoscaling_config_producer,
          monitor_ip=head_ip,
          # Let the autoscaler process exit after it hits 5 exceptions.
          # (See ray.autoscaler._private.constants.AUTOSCALER_MAX_NUM_FAILURES.)
          # Kubernetes will then restart the autoscaler container.
          retry_on_failure=False,
      ).run()
  
file_path: ray/python/ray/autoscaler/_private/kuberay/run_autoscaler.py
imports: import logging
  import os
  import subprocess
  import time
  import ray
  from ray._private import ray_constants
  from ray._private.ray_logging import setup_component_logger
  from ray._private.services import get_node_ip_address
  from ray._private.utils import try_to_create_directory
  from ray.autoscaler._private.kuberay.autoscaling_config import AutoscalingConfigProducer
  from ray.autoscaler._private.monitor import Monitor
label_desc: Use image node_id 1 for calling a global function with example usage: run_kuberay_autoscaler(cluster_name, cluster_namespace) without return types