code: def test_remote_cancel(ray_start_regular):
      @ray.remote
      class Actor:
          async def sleep(self):
              await asyncio.sleep(1000)
  
      @ray.remote
      def f(refs):
          ref = refs[0]
          ray.cancel(ref)
  
      a = Actor.remote()
      sleep_ref = a.sleep.remote()
      wait_for_condition(
          lambda: list_tasks(filters=[("name", "=", "Actor.sleep")])
      )
      ref = f.remote([sleep_ref])  # noqa
  
      with pytest.raises(ray.exceptions.TaskCancelledError):
          ray.get(sleep_ref)
  
imports: import asyncio
  import os
  import sys
  import time
  from collections import defaultdict
  import pytest
  import ray
  from ray._private.test_utils import SignalActor, wait_for_condition
  from ray.exceptions import TaskCancelledError
  from ray.util.state import list_tasks
label_desc: Use image node_id 8 for calling a global function with example usage: test_remote_cancel(ray_start_regular) without return types