code: def test_only_relevant_task_is_cancelled(serve_instance):
      """Test cancelling one request doesn't affect others."""
      signal_actor = SignalActor.remote()
  
      @serve.deployment
      class Ingress:
          async def __call__(self, *args):
              await signal_actor.wait.remote()
              return "ok"
  
      h = serve.run(Ingress.bind()).options(use_new_handle_api=True)
  
      r1 = h.remote()
      r2 = h.remote()
  
      # Wait for both requests to be executing.
      wait_for_condition(
          lambda: ray.get(signal_actor.cur_num_waiters.remote()) == 2
      )
  
      r1.cancel()
      with pytest.raises(ray.exceptions.TaskCancelledError):
          r1.result()
  
      # Now signal r2 to run to completion and check that it wasn't cancelled.
      ray.get(signal_actor.send.remote())
      assert r2.result() == "ok"
  
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 9 for calling a global function with example usage: test_only_relevant_task_is_cancelled(serve_instance) and returns: str