code: def test_actor_summary(ray_start_cluster):
      cluster = ray_start_cluster
      cluster.add_node(num_cpus=2)
      ray.init(address=cluster.address)
      cluster.add_node(num_cpus=2)
  
      @ray.remote(num_gpus=1)
      class Infeasible:
          pass
  
      @ray.remote(num_cpus=2)
      class Actor:
          pass
  
      infeasible = Infeasible.remote()  # noqa
      running = [Actor.remote() for _ in range(2)]  # noqa
      pending = Actor.remote()  # noqa
  
      def verify():
          summary = summarize_actors()
          summary = summary["cluster"]["summary"]
          actor_summary = None
          infeasible_summary = None
          for actor_class_name, s in summary.items():
              if ".Actor" in actor_class_name:
                  actor_summary = s
              elif ".Infeasible" in actor_class_name:
                  infeasible_summary = s
  
          assert actor_summary["state_counts"]["PENDING_CREATION"] == 1
          assert actor_summary["state_counts"]["ALIVE"] == 2
          assert (
              infeasible_summary["state_counts"]["PENDING_CREATION"]
              == 1
          )
          return True
  
      wait_for_condition(verify)
  
      """
      Test CLI
      """
      runner = CliRunner()
      result = runner.invoke(summary_state_cli_group, ["actors"])
      assert "Infeasible" in result.output
      assert result.exit_code == 0
  
imports: import time
  import json
  import pytest
  import ray
  from unittest.mock import MagicMock, AsyncMock
  import random
  import sys
  from dataclasses import asdict
  from ray.util.state import summarize_tasks, summarize_actors, summarize_objects
  from ray._private.test_utils import wait_for_condition
  from ray._raylet import ActorID, TaskID, ObjectID
  from ray.core.generated.common_pb2 import TaskStatus, TaskType, WorkerType
  from ray.core.generated.node_manager_pb2 import GetObjectsInfoReply
  from ray.tests.test_state_api import generate_task_data, generate_task_event, generate_actor_data, generate_object_info
  from ray.util.state.common import DEFAULT_RPC_TIMEOUT, SummaryApiOptions, Link, NestedTaskSummary, TaskSummaries, DRIVER_TASK_ID_PREFIX
  from ray.core.generated.gcs_service_pb2 import GetAllActorInfoReply
  from ray.core.generated.gcs_pb2 import ActorTableData
  from click.testing import CliRunner
  from ray.util.state.state_cli import summary_state_cli_group
  from ray.dashboard.state_aggregator import StateAPIManager
  from ray.util.state.state_manager import StateDataSourceClient
label_desc: Use image node_id 4 for calling a global function with example usage: test_actor_summary(ray_start_cluster) and returns: True