code: def test_async_actor_cancel_after_task_finishes(shutdown_only):
      @ray.remote
      class Actor:
          async def f(self):
              await asyncio.sleep(5)
  
          async def empty(self):
              pass
  
      # Cancel after task finishes
      a = Actor.options(max_concurrency=1).remote()
      ref = a.empty.remote()
      ref2 = a.empty.remote()
      ray.get([ref, ref2])
      ray.cancel(ref)
      ray.cancel(ref2)
      # Exceptions shouldn't be raised.
      ray.get([ref, ref2])
  
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 6 for calling a global function with example usage: test_async_actor_cancel_after_task_finishes(shutdown_only) without return types