code: def test_cancel_on_http_client_disconnect_during_execution(
      serve_instance, use_fastapi: bool
  ):
      """Test the client disconnecting while the handler is executing."""
      inner_signal_actor = SignalActor.remote()
      outer_signal_actor = SignalActor.remote()
  
      @serve.deployment
      async def inner():
          await send_signal_on_cancellation(inner_signal_actor)
  
      if use_fastapi:
          app = FastAPI()
  
          @serve.deployment
          @serve.ingress(app)
          class Ingress:
              def __init__(self, handle):
                  self._handle = handle.options(use_new_handle_api=True)
  
              @app.get("/")
              async def wait_for_cancellation(self):
                  await self._handle.remote()._to_object_ref()
                  await send_signal_on_cancellation(outer_signal_actor)
  
      else:
  
          @serve.deployment
          class Ingress:
              def __init__(self, handle):
                  self._handle = handle.options(use_new_handle_api=True)
  
              async def __call__(self, request: Request):
                  await self._handle.remote()._to_object_ref()
                  await send_signal_on_cancellation(outer_signal_actor)
  
      serve.run(Ingress.bind(inner.bind()))
  
      # Intentionally time out on the client, causing it to disconnect.
      with pytest.raises(requests.exceptions.ReadTimeout):
          requests.get("http://localhost:8000", timeout=0.5)
  
      # Both the HTTP handler and the inner deployment handle call should be cancelled.
      ray.get(inner_signal_actor.wait.remote(), timeout=10)
      ray.get(outer_signal_actor.wait.remote(), timeout=10)
  
imports: import asyncio
  import concurrent.futures
  import sys
  import pytest
  import requests
  from fastapi import FastAPI
  from starlette.requests import Request
  import ray
  from ray import serve
  from ray._private.test_utils import SignalActor, async_wait_for_condition, wait_for_condition
  from ray.serve._private.test_utils import send_signal_on_cancellation
label_desc: Use image node_id 1 for calling a global function with example usage: test_cancel_on_http_client_disconnect_during_execution(serve_instance, use_fastapi) without return types