code: def main(
      num_replicas: Optional[int],
      num_deployments: Optional[int],
      trial_length: Optional[str],
  ):
      # Give default cluster parameter values based on smoke_test config
      # if user provided values explicitly, use them instead.
      # IS_SMOKE_TEST is set by args of releaser's e2e.py
      if is_smoke_test():
          num_replicas = num_replicas or DEFAULT_SMOKE_TEST_NUM_REPLICA
          num_deployments = (
              num_deployments or DEFAULT_SMOKE_TEST_NUM_DEPLOYMENTS
          )
          trial_length = trial_length or DEFAULT_SMOKE_TEST_TRIAL_LENGTH
          logger.info(
              f"Running smoke test with {num_replicas} replicas, "
              f"{num_deployments} deployments .. \n"
          )
          # Choose cluster setup based on user config. Local test uses Cluster()
          # to mock actors that requires # of nodes to be specified, but ray
          # client doesn't need to
          num_nodes = int(math.ceil(num_replicas / NUM_CPU_PER_NODE))
          logger.info(
              f"Setting up local ray cluster with {num_nodes} nodes .. \n"
          )
          serve_client = setup_local_single_node_cluster(num_nodes)[0]
      else:
          num_replicas = num_replicas or DEFAULT_FULL_TEST_NUM_REPLICA
          num_deployments = (
              num_deployments or DEFAULT_FULL_TEST_NUM_DEPLOYMENTS
          )
          trial_length = trial_length or DEFAULT_FULL_TEST_TRIAL_LENGTH
          logger.info(
              f"Running full test with {num_replicas} replicas, "
              f"{num_deployments} deployments .. \n"
          )
          logger.info("Setting up anyscale ray cluster .. \n")
          serve_client = setup_anyscale_cluster()
  
      http_host = str(serve_client._http_config.host)
      http_port = str(serve_client._http_config.port)
      logger.info(
          f"Ray serve http_host: {http_host}, http_port: {http_port}"
      )
  
      logger.info(
          f"Deploying with {num_replicas} target replicas ....\n"
      )
      all_endpoints = setup_multi_deployment_replicas(
          num_replicas, num_deployments
      )
  
      logger.info("Warming up cluster...\n")
      run_wrk_on_all_nodes(
          DEFAULT_SMOKE_TEST_TRIAL_LENGTH,
          NUM_CONNECTIONS,
          http_host,
          http_port,
          all_endpoints=all_endpoints,
          ignore_output=True,
      )
  
      logger.info(
          f"Starting wrk trial on all nodes for {trial_length} ....\n"
      )
      # For detailed discussion, see https://github.com/wg/wrk/issues/205
      # TODO:(jiaodong) What's the best number to use here ?
      all_metrics, all_wrk_stdout = run_wrk_on_all_nodes(
          trial_length,
          NUM_CONNECTIONS,
          http_host,
          http_port,
          all_endpoints=all_endpoints,
      )
  
      aggregated_metrics = aggregate_all_metrics(all_metrics)
      logger.info("Wrk stdout on each node: ")
      for wrk_stdout in all_wrk_stdout:
          logger.info(wrk_stdout)
      logger.info("Final aggregated metrics: ")
      for key, val in aggregated_metrics.items():
          logger.info(f"{key}: {val}")
      save_test_results(
          aggregated_metrics,
          default_output_file="/tmp/multi_deployment_1k_noop_replica.json",
      )
  
file_path: ray/release/serve_tests/workloads/multi_deployment_1k_noop_replica.py
imports: import click
  import logging
  import math
  import random
  from typing import List, Optional
  from starlette.requests import Request
  from ray import serve
  from serve_test_utils import aggregate_all_metrics, run_wrk_on_all_nodes, save_test_results, is_smoke_test
  from serve_test_cluster_utils import setup_local_single_node_cluster, setup_anyscale_cluster, NUM_CPU_PER_NODE, NUM_CONNECTIONS
label_desc: Use image node_id 2 for calling a global function with example usage: main(num_replicas, num_deployments, trial_length) without return types