code: def test_resource_leak_when_cancel_actor_in_phase_of_creating(
      ray_start_cluster,
  ):
      """Make sure there is no resource leak when cancel an actor in phase of
      creating.
  
      Check https://github.com/ray-project/ray/issues/27743. # noqa
      """
      cluster = ray_start_cluster
      cluster.add_node(num_cpus=2)
      ray.init(address=cluster.address)
      cluster.wait_for_nodes()
  
      @ray.remote(num_cpus=1)
      class Actor:
          def __init__(self, signal_1, signal_2):
              signal_1.send.remote()
              ray.get(signal_2.wait.remote())
              pass
  
      signal_1 = SignalActor.remote()
      signal_2 = SignalActor.remote()
      actor = Actor.remote(signal_1, signal_2)
  
      wait_for_condition(lambda: ray.available_resources()["CPU"] != 2)
  
      # Checking that the constructor of `Actor`` is invoked.
      ready_ids, _ = ray.wait([signal_1.wait.remote()], timeout=3.0)
      assert len(ready_ids) == 1
  
      # Kill the actor which is in the phase of creating.
      ray.kill(actor)
  
      # Ensure there is no resource leak.
      wait_for_condition(lambda: ray.available_resources()["CPU"] == 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 36 for calling a global function with example usage: test_resource_leak_when_cancel_actor_in_phase_of_creating(ray_start_cluster) without return types