code: def test_actor_creation_task_crash(ray_start_regular):
      # Test actor death in constructor.
      @ray.remote(max_restarts=0)
      class Actor:
          def __init__(self):
              print("crash")
              os._exit(0)
  
          def f(self):
              return "ACTOR OK"
  
      # Verify an exception is thrown.
      a = Actor.remote()
      with pytest.raises(ray.exceptions.RayActorError) as excinfo:
          ray.get(a.f.remote())
      assert excinfo.value.actor_id == a._actor_id.hex()
  
      # Test an actor can be restarted successfully
      # afte it dies in its constructor.
      @ray.remote(max_restarts=3)
      class RestartableActor:
          def __init__(self):
              count = self.get_count()
              count += 1
              # Make it die for the first 2 times.
              if count < 3:
                  self.set_count(count)
                  print("crash: " + str(count))
                  os._exit(0)
              else:
                  print("no crash")
  
          def f(self):
              return "ACTOR OK"
  
          def get_count(self):
              value = _internal_kv_get("count")
              if value is None:
                  count = 0
              else:
                  count = int(value)
              return count
  
          def set_count(self, count):
              _internal_kv_put("count", str(count), True)
  
      # Verify we can get the object successfully.
      ra = RestartableActor.remote()
      ray.get(ra.f.remote())
  
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 22 for calling a global function with example usage: test_actor_creation_task_crash(ray_start_regular) and returns: str, str, count