code: def setup_local_single_node_cluster(
      num_nodes: int,
      num_cpu_per_node=NUM_CPU_PER_NODE,
      namespace="serve",
  ):
      """Setup ray cluster locally via ray.init() and Cluster()
  
      Each actor is simulated in local process on single node,
      thus smaller scale by default.
      """
      cluster = Cluster()
      for i in range(num_nodes):
          cluster.add_node(
              redis_port=6380 if i == 0 else None,
              num_cpus=num_cpu_per_node,
              num_gpus=0,
              resources={str(i): 2, "proxy": 1},
          )
      ray.init(
          address=cluster.address,
          dashboard_host="0.0.0.0",
          namespace=namespace,
      )
      serve.start(proxy_location=DeploymentMode.EveryNode)
  
      return _get_global_client(), cluster
  
file_path: ray/release/serve_tests/workloads/serve_test_cluster_utils.py
imports: import logging
  import ray
  import requests
  from ray._private.test_utils import monitor_memory_usage
  from ray.cluster_utils import Cluster
  from ray import serve
  from ray.serve.config import DeploymentMode
  from ray.serve.context import _get_global_client
label_desc: Use image node_id 1 for calling a global function with example usage: setup_local_single_node_cluster(num_nodes, num_cpu_per_node, namespace) and returns: _get_global_client,  cluster