code: def test_recover_start_from_replica_actor_names(serve_instance):
      """Test controller is able to recover starting -> running replicas from
      actor names.
      """
  
      # Test failed to deploy with total of 2 replicas,
      # but first constructor call fails.
      @serve.deployment(
          name="recover_start_from_replica_actor_names", num_replicas=2
      )
      class TransientConstructorFailureDeployment:
          def __init__(self):
              return True
  
          def __call__(self, *args):
              return "hii"
  
      serve.run(
          TransientConstructorFailureDeployment.bind(), name="app"
      )
      for _ in range(10):
          response = request_with_retries(
              "/recover_start_from_replica_actor_names/", timeout=30
          )
          assert response.text == "hii"
      # Assert 2 replicas are running in deployment deployment after partially
      # successful deploy() call with transient error
      deployment_dict = ray.get(
          serve_instance._controller._all_running_replicas.remote()
      )
      id = DeploymentID("recover_start_from_replica_actor_names", "app")
      assert len(deployment_dict[id]) == 2
  
      replica_version_hash = None
      for replica in deployment_dict[id]:
          ref = replica.actor_handle._get_metadata.remote()
          _, version = ray.get(ref)
          if replica_version_hash is None:
              replica_version_hash = hash(version)
          assert replica_version_hash == hash(version), (
              "Replica version hash should be the same for "
              "same code version and user config."
          )
  
      # Sample: [
      # 'TransientConstructorFailureDeployment#xlituP',
      # 'SERVE_CONTROLLER_ACTOR',
      # 'TransientConstructorFailureDeployment#NosHNA',
      # 'SERVE_CONTROLLER_ACTOR:SERVE_PROXY_ACTOR-node:192.168.86.165-0']
      actor_infos = list_actors(filters=[("state", "=", "ALIVE")])
      replica_names = [
          actor_info["name"]
          for actor_info in actor_infos
          if (
              SERVE_CONTROLLER_NAME not in actor_info["name"]
              and SERVE_PROXY_NAME not in actor_info["name"]
          )
      ]
      assert (
          len(replica_names) == 2
      ), "Should have two running replicas fetched from ray API."
  
      # Kill controller and wait for endpoint to be available again
      ray.kill(
          serve.context._global_client._controller, no_restart=False
      )
      for _ in range(10):
          response = request_with_retries(
              "/recover_start_from_replica_actor_names/", timeout=30
          )
          assert response.text == "hii"
  
      # Ensure recovered replica names are the same
      recovered_actor_infos = list_actors(
          filters=[("state", "=", "ALIVE")]
      )
      recovered_replica_names = [
          actor_info["name"]
          for actor_info in recovered_actor_infos
          if (
              SERVE_CONTROLLER_NAME not in actor_info["name"]
              and SERVE_PROXY_NAME not in actor_info["name"]
          )
      ]
      assert (
          recovered_replica_names == replica_names
      ), "Running replica actor names after recovery must match"
  
      # Ensure recovered replica version has are the same
      for replica_name in recovered_replica_names:
          actor_handle = ray.get_actor(
              replica_name, namespace=SERVE_NAMESPACE
          )
          ref = actor_handle._get_metadata.remote()
          _, version = ray.get(ref)
          assert replica_version_hash == hash(
              version
          ), "Replica version hash should be the same after recover from actor names"
  
imports: import asyncio
  import logging
  import os
  import re
  import sys
  import time
  from collections import defaultdict
  import pytest
  import requests
  import ray
  from ray import serve
  from ray._private.test_utils import SignalActor, wait_for_condition
  from ray.exceptions import RayTaskError
  from ray.serve._private.common import DeploymentID, ReplicaState
  from ray.serve._private.constants import SERVE_CONTROLLER_NAME, SERVE_DEFAULT_APP_NAME, SERVE_NAMESPACE, SERVE_PROXY_NAME
  from ray.serve._private.utils import get_random_string
  from ray.serve.schema import LoggingConfig
  from ray.serve.tests.test_failure import request_with_retries
  from ray.util.state import list_actors
label_desc: Use image node_id 1 for calling a global function with example usage: test_recover_start_from_replica_actor_names(serve_instance) and returns: True, str