code: def test_destroy_actors_from_driver(monkeypatch, shutdown_only):
      with monkeypatch.context() as m:
          # Dead actors are not cached.
          m.setenv("RAY_maximum_gcs_destroyed_actor_cached_count", 5)
          driver = """
  import ray
  ray.init("auto")
  @ray.remote(num_cpus=0)
  class Actor:
      def ready(self):
          pass
  actors = [Actor.remote() for _ in range(10)]
  ray.get([actor.ready.remote() for actor in actors])
  """
          info = ray.init(num_cpus=3, _system_config=_SYSTEM_CONFIG)
  
          output = run_string_as_driver(driver)
          print(output)
  
          expected = {
              "DEAD": 10,
          }
          wait_for_condition(
              lambda: actors_by_state(info) == expected,
              timeout=20,
              retry_interval_ms=500,
          )
  
          """
          Make sure even after the actor entries are deleted from GCS by GC
          the metrics are correct.
          """
          # Wait until the state API returns the # of actors are 0
          # becasue entries are GC'ed by GCS.
          wait_for_condition(lambda: len(list_actors()) == 5)
          # DEAD count shouldn't be changed.
          wait_for_condition(
              lambda: actors_by_state(info) == expected,
              timeout=20,
              retry_interval_ms=500,
          )
  
imports: import asyncio
  from collections import defaultdict
  import pytest
  import time
  from typing import Dict
  import ray
  from ray.util.state import list_actors
  from ray._private.test_utils import raw_metrics, wait_for_condition, run_string_as_driver
  from ray._private.worker import RayContext
label_desc: Use image node_id 5 for calling a global function with example usage: test_destroy_actors_from_driver(monkeypatch, shutdown_only) without return types