code: def serve_instance(_shared_serve_instance):
      yield _shared_serve_instance
      # Clear all state for 2.x applications and deployments.
      _shared_serve_instance.delete_all_apps()
      # Clear all state for 1.x deployments.
      _shared_serve_instance.delete_deployments(
          _private_api.list_deployments().keys()
      )
      # Clear the ServeHandle cache between tests to avoid them piling up.
      _shared_serve_instance.shutdown_cached_handles()
  
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 7 for calling a global function with example usage: serve_instance(_shared_serve_instance) without return types