python/ray/serve/deployment_state.py
def _check_curr_status(self) -> bool:
        """Check the current deployment status.

        Checks the difference between the target vs. running replica count for
        the target version.

        This will update the current deployment status depending on the state
        of the replicas.

        Returns:
            was_deleted
        """
        # TODO(edoakes): we could make this more efficient in steady-state by
        # having a "healthy" flag that gets flipped if an update or replica
        # failure happens.

        target_version = self._target_version
        target_replica_count = self._target_replicas

        all_running_replica_cnt = self._replicas.count(states=[ReplicaState.RUNNING])
        running_at_target_version_replica_cnt = self._replicas.count(
            states=[ReplicaState.RUNNING], version=target_version
        )

        failed_to_start_count = self._replica_constructor_retry_counter
        failed_to_start_threshold = min(
            MAX_DEPLOYMENT_CONSTRUCTOR_RETRY_COUNT, target_replica_count * 3
        )

        # Got to make a call to complete current deploy() goal after
        # start failure threshold reached, while we might still have
        # pending replicas in current goal.
        if (
            failed_to_start_count >= failed_to_start_threshold
            and failed_to_start_threshold != 0
        ):
            if running_at_target_version_replica_cnt > 0:
                # At least one RUNNING replica at target state, partial
                # success; We can stop tracking constructor failures and
                # leave it to the controller to fully scale to target
                # number of replicas and only return as completed once
                # reached target replica count
                self._replica_constructor_retry_counter = -1
            else:
                self._curr_status_info = DeploymentStatusInfo(
                    status=DeploymentStatus.UNHEALTHY,
                    message=(
                        "The Deployment constructor failed "
                        f"{failed_to_start_count} times in a row. See "
                        "logs for details."
                    ),
                )
                return False

        # If we have pending ops, the current goal is *not* ready.
        if (
            self._replicas.count(
                states=[
                    ReplicaState.STARTING,
                    ReplicaState.UPDATING,
                    ReplicaState.RECOVERING,
                    ReplicaState.STOPPING,
                ]
            )
            == 0
        ):
            # Check for deleting.
            if target_replica_count == 0 and all_running_replica_cnt == 0:
                return True

            # Check for a non-zero number of deployments.
            elif target_replica_count == running_at_target_version_replica_cnt:
                self._curr_status_info = DeploymentStatusInfo(DeploymentStatus.HEALTHY)
                return False

        return False
Check the current deployment status.

        Checks the difference between the target vs. running replica count for
        the target version.

        This will update the current deployment status depending on the state
        of the replicas.

        Returns:
            was_deleted
        
Check the current deployment status.
Checks the difference between the target vs. running replica count for
the target version.

This will update the current deployment status depending on the state
of the replicas.
Check the current deployment status . Checks the difference between the target vs . running replica count for the target version . This will update the current deployment status depending on the state of the replicas .
def _check_curr_status(self) -> bool:
        target_version = self._target_version
        target_replica_count = self._target_replicas
        all_running_replica_cnt = self._replicas.count(states=[ReplicaState.RUNNING])
        running_at_target_version_replica_cnt = self._replicas.count(
            states=[ReplicaState.RUNNING], version=target_version
        )
        failed_to_start_count = self._replica_constructor_retry_counter
        failed_to_start_threshold = min(
            MAX_DEPLOYMENT_CONSTRUCTOR_RETRY_COUNT, target_replica_count * 3
        )
        if (
            failed_to_start_count >= failed_to_start_threshold
            and failed_to_start_threshold != 0
        ):
            if running_at_target_version_replica_cnt > 0:
                self._replica_constructor_retry_counter = -1
            else:
                self._curr_status_info = DeploymentStatusInfo(
                    status=DeploymentStatus.UNHEALTHY,
                    message=(
                        "The Deployment constructor failed "
                        f"{failed_to_start_count} times in a row. See "
                        "logs for details."
                    ),
                )
                return False
        if (
            self._replicas.count(
                states=[
                    ReplicaState.STARTING,
                    ReplicaState.UPDATING,
                    ReplicaState.RECOVERING,
                    ReplicaState.STOPPING,
                ]
            )
            == 0
        ):
            if target_replica_count == 0 and all_running_replica_cnt == 0:
                return True
            elif target_replica_count == running_at_target_version_replica_cnt:
                self._curr_status_info = DeploymentStatusInfo(DeploymentStatus.HEALTHY)
                return False
        return False
def _check_curr_status ( self ) -> bool : target_version = self . _target_version target_replica_count = self . _target_replicas all_running_replica_cnt = self . _replicas . count ( states = [ ReplicaState . RUNNING ] ) running_at_target_version_replica_cnt = self . _replicas . count ( states = [ ReplicaState . RUNNING ] , version = target_version ) failed_to_start_count = self . _replica_constructor_retry_counter failed_to_start_threshold = min ( MAX_DEPLOYMENT_CONSTRUCTOR_RETRY_COUNT , target_replica_count * 3 ) if ( failed_to_start_count >= failed_to_start_threshold and failed_to_start_threshold != 0 ) : if running_at_target_version_replica_cnt > 0 : self . _replica_constructor_retry_counter = - 1 else : self . _curr_status_info = DeploymentStatusInfo ( status = DeploymentStatus . UNHEALTHY , message = ( "The Deployment constructor failed " f"{failed_to_start_count} times in a row. See " "logs for details." ) , ) return False if ( self . _replicas . count ( states = [ ReplicaState . STARTING , ReplicaState . UPDATING , ReplicaState . RECOVERING , ReplicaState . STOPPING , ] ) == 0 ) : if target_replica_count == 0 and all_running_replica_cnt == 0 : return True elif target_replica_count == running_at_target_version_replica_cnt : self . _curr_status_info = DeploymentStatusInfo ( DeploymentStatus . HEALTHY ) return False return False
Check the current deployment status.
Check the current deployment status .
"""Check the current deployment status.

        Checks the difference between the target vs. running replica count for
        the target version.

        This will update the current deployment status depending on the state
        of the replicas.

        Returns:
            was_deleted
        """ # TODO(edoakes): we could make this more efficient in steady-state by # having a "healthy" flag that gets flipped if an update or replica # failure happens. # Got to make a call to complete current deploy() goal after # start failure threshold reached, while we might still have # pending replicas in current goal. # At least one RUNNING replica at target state, partial # success; We can stop tracking constructor failures and # leave it to the controller to fully scale to target # number of replicas and only return as completed once # reached target replica count # If we have pending ops, the current goal is *not* ready. # Check for deleting. # Check for a non-zero number of deployments.
None
self