code: def _shared_serve_instance():
      # Note(simon):
      # This line should be not turned on on master because it leads to very
      # spammy and not useful log in case of a failure in CI.
      # To run locally, please use this instead.
      # SERVE_DEBUG_LOG=1 pytest -v -s test_api.py
      # os.environ["SERVE_DEBUG_LOG"] = "1" <- Do not uncomment this.
  
      # Overriding task_retry_delay_ms to relaunch actors more quickly
      ray.init(
          num_cpus=36,
          namespace="default_test_namespace",
          _metrics_export_port=9999,
          _system_config={
              "metrics_report_interval_ms": 1000,
              "task_retry_delay_ms": 50,
          },
      )
      serve.start(http_options={"host": "0.0.0.0"})
      yield _get_global_client()
  
imports: import os
  import random
  import subprocess
  import tempfile
  import pytest
  import requests
  import ray
  from ray import serve
  from ray._private.test_utils import wait_for_condition
  from ray._private.usage import usage_lib
  from ray.cluster_utils import AutoscalingCluster, Cluster
  from ray.serve._private import api
  from ray.serve._private.test_utils import TELEMETRY_ROUTE_PREFIX, check_ray_stopped
  from ray.serve.context import _get_global_client
  from ray.tests.conftest import propagate_logs, pytest_runtest_makereport
label_desc: Use image node_id 6 for calling a global function with example usage: _shared_serve_instance() without return types