code: def test_basic_states(shutdown_only):
      info = ray.init(num_cpus=3, _system_config=_SYSTEM_CONFIG)
  
      @ray.remote(num_cpus=1)
      class Actor:
          def ping(self):
              pass
  
          def sleep(self):
              time.sleep(999)
  
          def get(self):
              @ray.remote
              def sleep():
                  time.sleep(999)
  
              ray.get(sleep.remote())
  
          def wait(self):
              @ray.remote
              def sleep():
                  time.sleep(999)
  
              ray.wait([sleep.remote()])
  
      a = Actor.remote()
      b = Actor.remote()
      c = Actor.remote()
      ray.get(a.ping.remote())
      ray.get(b.ping.remote())
      ray.get(c.ping.remote())
      d = Actor.remote()
  
      # Test creation states.
      expected = {
          "ALIVE": 3,
          "PENDING_CREATION": 1,
      }
      wait_for_condition(
          lambda: actors_by_state(info) == expected,
          timeout=20,
          retry_interval_ms=500,
      )
  
      # Test running states.
      a.sleep.remote()
      b.get.remote()
      c.wait.remote()
      expected = {
          "RUNNING_TASK": 1,
          "RUNNING_IN_RAY_GET": 1,
          "RUNNING_IN_RAY_WAIT": 1,
          "PENDING_CREATION": 1,
      }
      wait_for_condition(
          lambda: actors_by_state(info) == expected,
          timeout=20,
          retry_interval_ms=500,
      )
      del d
  
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 3 for calling a global function with example usage: test_basic_states(shutdown_only) without return types