code: def test_named_but_not_detached(ray_start_regular):
      address = ray_start_regular["address"]
  
      driver_script = """
  import ray
  ray.init(address="{}")
  
  @ray.remote
  class NotDetached:
      def ping(self):
          return "pong"
  
  actor = NotDetached.options(name="actor").remote()
  assert ray.get(actor.ping.remote()) == "pong"
  handle = ray.get_actor("actor")
  assert ray.util.list_named_actors() == ["actor"]
  assert ray.get(handle.ping.remote()) == "pong"
  """.format(
          address
      )
  
      # Creates and kills actor once the driver exits.
      run_string_as_driver(driver_script)
  
      # Must raise an exception since lifetime is not detached.
      with pytest.raises(Exception):
          assert not ray.util.list_named_actors()
          detached_actor = ray.get_actor("actor")
          ray.get(detached_actor.ping.remote())
  
      # Check that the names are reclaimed after actors die.
  
      def check_name_available(name):
          try:
              ray.get_actor(name)
              return False
          except ValueError:
              return True
  
      @ray.remote
      class A:
          pass
  
      a = A.options(name="my_actor_1").remote()
      ray.kill(a, no_restart=True)
      wait_for_condition(lambda: check_name_available("my_actor_1"))
  
      b = A.options(name="my_actor_2").remote()
      del b
      wait_for_condition(lambda: check_name_available("my_actor_2"))
  
imports: import os
  import sys
  import time
  import numpy
  import pytest
  import ray
  import ray._private.gcs_utils
  from ray.util.state import list_actors
  import ray.cluster_utils
  from ray._private.test_utils import SignalActor, convert_actor_state, kill_actor_and_wait_for_failure, make_global_state_accessor, run_string_as_driver, wait_for_condition, wait_for_pid_to_exit
  from ray._private.ray_constants import gcs_actor_scheduling_enabled
  from ray.experimental.internal_kv import _internal_kv_get, _internal_kv_put
label_desc: Use image node_id 16 for calling a global function with example usage: test_named_but_not_detached(ray_start_regular) and returns: False, True