python/ray/serve/deployment_state.py
def _check_startup_replicas(
        self, original_state: ReplicaState, stop_on_slow=False
    ) -> Tuple[List[Tuple[DeploymentReplica, ReplicaStartupStatus]], bool]:
        """
        Common helper function for startup actions tracking and status
        transition: STARTING, UPDATING and RECOVERING.

        Args:
            stop_on_slow: If we consider a replica failed upon observing it's
                slow to reach running state.
        """
        slow_replicas = []
        transitioned_to_running = False
        for replica in self._replicas.pop(states=[original_state]):
            start_status = replica.check_started()
            if start_status == ReplicaStartupStatus.SUCCEEDED:
                # This replica should be now be added to handle's replica
                # set.
                self._replicas.add(ReplicaState.RUNNING, replica)
                transitioned_to_running = True
            elif start_status == ReplicaStartupStatus.FAILED:
                # Replica reconfigure (deploy / upgrade) failed
                if self._replica_constructor_retry_counter >= 0:
                    # Increase startup failure counter if we're tracking it
                    self._replica_constructor_retry_counter += 1

                replica.stop(graceful=False)
                self._replicas.add(ReplicaState.STOPPING, replica)
            elif start_status in [
                ReplicaStartupStatus.PENDING_ALLOCATION,
                ReplicaStartupStatus.PENDING_INITIALIZATION,
            ]:

                is_slow = time.time() - replica._start_time > SLOW_STARTUP_WARNING_S

                if is_slow:
                    slow_replicas.append((replica, start_status))

                # Does it make sense to stop replicas in PENDING_ALLOCATION
                # state?
                if is_slow and stop_on_slow:
                    replica.stop(graceful=False)
                    self._replicas.add(ReplicaState.STOPPING, replica)
                else:
                    self._replicas.add(original_state, replica)

        return slow_replicas, transitioned_to_running

        Common helper function for startup actions tracking and status
        transition: STARTING, UPDATING and RECOVERING.

        Args:
            stop_on_slow: If we consider a replica failed upon observing it's
                slow to reach running state.
        
Common helper function for startup actions tracking and status
transition: STARTING, UPDATING and RECOVERING.
Common helper function for startup actions tracking and status transition : STARTING UPDATING and RECOVERING .
def _check_startup_replicas(
        self, original_state: ReplicaState, stop_on_slow=False
    ) -> Tuple[List[Tuple[DeploymentReplica, ReplicaStartupStatus]], bool]:
        slow_replicas = []
        transitioned_to_running = False
        for replica in self._replicas.pop(states=[original_state]):
            start_status = replica.check_started()
            if start_status == ReplicaStartupStatus.SUCCEEDED:
                self._replicas.add(ReplicaState.RUNNING, replica)
                transitioned_to_running = True
            elif start_status == ReplicaStartupStatus.FAILED:
                if self._replica_constructor_retry_counter >= 0:
                    self._replica_constructor_retry_counter += 1
                replica.stop(graceful=False)
                self._replicas.add(ReplicaState.STOPPING, replica)
            elif start_status in [
                ReplicaStartupStatus.PENDING_ALLOCATION,
                ReplicaStartupStatus.PENDING_INITIALIZATION,
            ]:
                is_slow = time.time() - replica._start_time > SLOW_STARTUP_WARNING_S
                if is_slow:
                    slow_replicas.append((replica, start_status))
                if is_slow and stop_on_slow:
                    replica.stop(graceful=False)
                    self._replicas.add(ReplicaState.STOPPING, replica)
                else:
                    self._replicas.add(original_state, replica)
        return slow_replicas, transitioned_to_running
def _check_startup_replicas ( self , original_state : ReplicaState , stop_on_slow = False ) -> Tuple [ List [ Tuple [ DeploymentReplica , ReplicaStartupStatus ] ] , bool ] : slow_replicas = [ ] transitioned_to_running = False for replica in self . _replicas . pop ( states = [ original_state ] ) : start_status = replica . check_started ( ) if start_status == ReplicaStartupStatus . SUCCEEDED : self . _replicas . add ( ReplicaState . RUNNING , replica ) transitioned_to_running = True elif start_status == ReplicaStartupStatus . FAILED : if self . _replica_constructor_retry_counter >= 0 : self . _replica_constructor_retry_counter += 1 replica . stop ( graceful = False ) self . _replicas . add ( ReplicaState . STOPPING , replica ) elif start_status in [ ReplicaStartupStatus . PENDING_ALLOCATION , ReplicaStartupStatus . PENDING_INITIALIZATION , ] : is_slow = time . time ( ) - replica . _start_time > SLOW_STARTUP_WARNING_S if is_slow : slow_replicas . append ( ( replica , start_status ) ) if is_slow and stop_on_slow : replica . stop ( graceful = False ) self . _replicas . add ( ReplicaState . STOPPING , replica ) else : self . _replicas . add ( original_state , replica ) return slow_replicas , transitioned_to_running
Common helper function for startup actions tracking and status
transition: STARTING, UPDATING and RECOVERING.
Common helper function for startup actions tracking and status transition : STARTING UPDATING and RECOVERING .
"""
        Common helper function for startup actions tracking and status
        transition: STARTING, UPDATING and RECOVERING.

        Args:
            stop_on_slow: If we consider a replica failed upon observing it's
                slow to reach running state.
        """ # This replica should be now be added to handle's replica # set. # Replica reconfigure (deploy / upgrade) failed # Increase startup failure counter if we're tracking it # Does it make sense to stop replicas in PENDING_ALLOCATION # state?
self
original_state
ReplicaState
stop_on_slow
If we consider a replica failed upon observing it's
slow to reach running state.
If we consider a replica failed upon observing it ' s slow to reach running state .