code: def test_proxy_starting_timeout_longer_than_env(
      number_of_worker_nodes, all_nodes
  ):
      """Test update method on ProxyStateManager when the proxy state is STARTING and
      when the ready call takes longer than PROXY_READY_CHECK_TIMEOUT_S.
  
      The proxy state started with STARTING. After update is called, ready calls takes
      some time to finish. The proxy state manager will restart the proxy state after
      PROXY_READY_CHECK_TIMEOUT_S. After the next period of check_health call,
      the proxy state manager will check on backoff timeout, not immediately
      restarting the proxy states, and eventually set the proxy state to HEALTHY.
      """
      fake_time = MockTimer()
      (
          proxy_state_manager,
          cluster_node_info_cache,
      ) = _create_proxy_state_manager(
          http_options=HTTPOptions(location=DeploymentMode.EveryNode),
          timer=fake_time,
      )
      cluster_node_info_cache.alive_nodes = all_nodes
  
      node_ids = {node[0] for node in all_nodes}
  
      # Run update to create proxy states.
      proxy_state_manager.update(proxy_nodes=node_ids)
      old_proxy_states = {
          node_id: state
          for node_id, state in proxy_state_manager._proxy_states.items()
      }
  
      # Ensure 2 proxies are created, one for the head node and another for the worker.
      assert len(proxy_state_manager._proxy_states) == len(node_ids)
  
      # Ensure the proxy state statuses before update are STARTING. Also, setting the
      # ready call status to be pending to simulate the call never respond.
      def check_proxy_state_starting(
          _proxy_state_manager: ProxyStateManager,
      ):
          for (
              proxy_state
          ) in _proxy_state_manager._proxy_states.values():
              assert proxy_state.status == ProxyStatus.STARTING
              proxy_state._actor_proxy_wrapper.ready = (
                  ProxyWrapperCallStatus.PENDING
              )
  
      # Trigger update and ensure proxy states are restarted due to time advanced
      # longer than PROXY_READY_CHECK_TIMEOUT_S of 0.1s.
      check_proxy_state_starting(
          _proxy_state_manager=proxy_state_manager
      )
      fake_time.advance(0.11)
      proxy_state_manager.update(proxy_nodes=node_ids)
      assert all(
          [
              proxy_state_manager._proxy_states[node_id]
              != old_proxy_states[node_id]
              for node_id in node_ids
          ]
      )
  
      # Trigger another update with the same advance time and this time the
      # proxy states should not be restarted again with the backoff timeout.
      old_proxy_states = {
          node_id: state
          for node_id, state in proxy_state_manager._proxy_states.items()
      }
      check_proxy_state_starting(
          _proxy_state_manager=proxy_state_manager
      )
      fake_time.advance(0.11)
      proxy_state_manager.update(proxy_nodes=node_ids)
      assert all(
          [
              proxy_state_manager._proxy_states[node_id]
              == old_proxy_states[node_id]
              for node_id in node_ids
          ]
      )
  
      # Ensure the proxy states turns healthy after the ready call is unblocked.
      for proxy_state in proxy_state_manager._proxy_states.values():
          proxy_state._actor_proxy_wrapper.ready = (
              ProxyWrapperCallStatus.FINISHED_SUCCEED
          )
      proxy_state_manager.update(proxy_nodes=node_ids)
      assert all(
          [
              proxy_state_manager._proxy_states[node_id].status
              == ProxyStatus.HEALTHY
              for node_id in node_ids
          ]
      )
  
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 26 for calling a global function with example usage: test_proxy_starting_timeout_longer_than_env(number_of_worker_nodes, all_nodes) without return types