code: def test_serve_graceful_shutdown(serve_instance):
      signal = SignalActor.remote()
  
      @serve.deployment(
          name="wait",
          max_concurrent_queries=10,
          graceful_shutdown_timeout_s=1000,
          graceful_shutdown_wait_loop_s=0.5,
      )
      class Wait:
          async def __call__(self, signal_actor):
              await signal_actor.wait.remote()
  
      handle = serve.run(Wait.bind())
      responses = [handle.remote(signal) for _ in range(10)]
  
      # Wait for all the queries to be enqueued
      with pytest.raises(TimeoutError):
          responses[0].result(timeout_s=1)
  
      @ray.remote(num_cpus=0)
      def do_blocking_delete():
          serve.delete(SERVE_DEFAULT_APP_NAME)
  
      # Now delete the deployment. This should trigger the shutdown sequence.
      delete_ref = do_blocking_delete.remote()
  
      # The queries should be enqueued but not executed becuase they are blocked
      # by signal actor.
      with pytest.raises(TimeoutError):
          responses[0].result(timeout_s=1)
  
      signal.send.remote()
  
      # All the queries should be drained and executed without error.
      [r.result() for r in responses]
      # Blocking delete should complete.
      ray.get(delete_ref)
  
file_path: ray/python/ray/serve/tests/test_advanced.py
imports: import asyncio
  import time
  import pytest
  import ray
  from ray import serve
  from ray._private.test_utils import SignalActor
  from ray.serve._private.constants import SERVE_DEFAULT_APP_NAME
label_desc: Use image node_id 2 for calling a global function with example usage: test_serve_graceful_shutdown(serve_instance) without return types