code: def test_global_state_actor_table(ray_start_regular):
      @ray.remote
      class Actor:
          def ready(self):
              return os.getpid()
  
      # actor table should be empty at first
      assert len(ray._private.state.actors()) == 0
  
      # actor table should contain only one entry
      def get_actor_table_data(field):
          return list(ray._private.state.actors().values())[0][field]
  
      a = Actor.remote()
      pid = ray.get(a.ready.remote())
      assert len(ray._private.state.actors()) == 1
      assert get_actor_table_data("Pid") == pid
  
      # actor table should contain only this entry
      # even when the actor goes out of scope
      del a
  
      dead_state = convert_actor_state(gcs_utils.ActorTableData.DEAD)
      for _ in range(10):
          if get_actor_table_data("State") == dead_state:
              break
          else:
              time.sleep(0.5)
      assert get_actor_table_data("State") == dead_state
  
imports: import os
  import time
  import pytest
  import ray
  import ray._private.gcs_utils
  import ray._private.ray_constants
  from ray._raylet import GcsClient
  from ray.core.generated import autoscaler_pb2
  from ray._private.test_utils import convert_actor_state, make_global_state_accessor, wait_for_condition
label_desc: Use image node_id 4 for calling a global function with example usage: test_global_state_actor_table(ray_start_regular) and returns: list, os