code: def test_proxy_state_update_restarts_unhealthy_proxies(all_nodes):
      """Test the update method in ProxyStateManager would
         kill and restart unhealthy proxies.
  
      Set up a ProxyState with UNHEALTHY status. Calls the update method on the
      ProxyStateManager object. Expects the unhealthy proxy being replaced
      by a new proxy with STARTING status.
      The unhealthy proxy state is also shutting down.
      """
  
      (
          proxy_state_manager,
          cluster_node_info_cache,
      ) = _create_proxy_state_manager()
      cluster_node_info_cache.alive_nodes = all_nodes
      proxy_state_manager.update()
  
      old_proxy_state = proxy_state_manager._proxy_states[HEAD_NODE_ID]
      old_proxy = old_proxy_state.actor_handle
  
      # Make the old proxy unhealthy.
      old_proxy_state.set_status(ProxyStatus.UNHEALTHY)
  
      # Continuously trigger update and wait for status to be changed to HEALTHY.
      wait_for_condition(
          condition_predictor=_update_and_check_proxy_state_manager,
          proxy_state_manager=proxy_state_manager,
          node_ids=[HEAD_NODE_ID],
          statuses=[ProxyStatus.HEALTHY],
      )
  
      new_proxy = proxy_state_manager._proxy_states[
          HEAD_NODE_ID
      ].actor_handle
  
      # Ensure the old proxy is getting shutdown.
      assert old_proxy_state._shutting_down
  
      # Ensure the new proxy is completely different object than old proxy.
      assert new_proxy != old_proxy
  
imports: import json
  import time
  from typing import List, Tuple
  from unittest.mock import patch
  import pytest
  from ray._private.test_utils import wait_for_condition
  from ray.serve._private.cluster_node_info_cache import ClusterNodeInfoCache
  from ray.serve._private.common import ProxyStatus
  from ray.serve._private.constants import PROXY_HEALTH_CHECK_UNHEALTHY_THRESHOLD
  from ray.serve._private.proxy_state import ProxyState, ProxyStateManager, ProxyWrapper, ProxyWrapperCallStatus
  from ray.serve._private.test_utils import MockTimer
  from ray.serve._private.utils import Timer
  from ray.serve.config import DeploymentMode, HTTPOptions
  from ray.serve.schema import LoggingConfig
label_desc: Use image node_id 8 for calling a global function with example usage: test_proxy_state_update_restarts_unhealthy_proxies(all_nodes) without return types