python/ray/serve/deployment_state.py
def check_health(self) -> bool:
        """Check if the actor is healthy.

        self._healthy should *only* be modified in this method.

        This is responsible for:
            1) Checking the outstanding health check (if any).
            2) Determining the replica health based on the health check results.
            3) Kicking off a new health check if needed.
        """
        response: ReplicaHealthCheckResponse = self._check_active_health_check()
        if response is ReplicaHealthCheckResponse.NONE:
            # No info; don't update replica health.
            pass
        elif response is ReplicaHealthCheckResponse.SUCCEEDED:
            # Health check succeeded. Reset the consecutive failure counter
            # and mark the replica healthy.
            self._consecutive_health_check_failures = 0
            self._healthy = True
        elif response is ReplicaHealthCheckResponse.APP_FAILURE:
            # Health check failed. If it has failed more than N times in a row,
            # mark the replica unhealthy.
            self._consecutive_health_check_failures += 1
            if (
                self._consecutive_health_check_failures
                >= REPLICA_HEALTH_CHECK_UNHEALTHY_THRESHOLD
            ):
                logger.info(
                    f"Replica {self._replica_tag} failed the health "
                    f"check {self._consecutive_health_check_failures}"
                    "times in a row, marking it unhealthy."
                )
                self._healthy = False
        elif response is ReplicaHealthCheckResponse.ACTOR_CRASHED:
            # Actor crashed, mark the replica unhealthy immediately.
            logger.info(
                f"Actor for replica {self._replica_tag} crashed, marking "
                "it unhealthy immediately."
            )
            self._healthy = False
        else:
            assert False, f"Unknown response type: {response}."

        if self._should_start_new_health_check():
            self._last_health_check_time = time.time()
            self._health_check_ref = self._actor_handle.check_health.remote()

        return self._healthy
Check if the actor is healthy.

        self._healthy should *only* be modified in this method.

        This is responsible for:
            1) Checking the outstanding health check (if any).
            2) Determining the replica health based on the health check results.
            3) Kicking off a new health check if needed.
        
Check if the actor is healthy.
self._healthy should *only* be modified in this method.

This is responsible for:
1) Checking the outstanding health check (if any).
2) Determining the replica health based on the health check results.
3) Kicking off a new health check if needed.
Check if the actor is healthy . self . _healthy should * only * be modified in this method . This is responsible for : 1 ) Checking the outstanding health check ( if any ) . 2 ) Determining the replica health based on the health check results . 3 ) Kicking off a new health check if needed .
def check_health(self) -> bool:
        response: ReplicaHealthCheckResponse = self._check_active_health_check()
        if response is ReplicaHealthCheckResponse.NONE:
            pass
        elif response is ReplicaHealthCheckResponse.SUCCEEDED:
            self._consecutive_health_check_failures = 0
            self._healthy = True
        elif response is ReplicaHealthCheckResponse.APP_FAILURE:
            self._consecutive_health_check_failures += 1
            if (
                self._consecutive_health_check_failures
                >= REPLICA_HEALTH_CHECK_UNHEALTHY_THRESHOLD
            ):
                logger.info(
                    f"Replica {self._replica_tag} failed the health "
                    f"check {self._consecutive_health_check_failures}"
                    "times in a row, marking it unhealthy."
                )
                self._healthy = False
        elif response is ReplicaHealthCheckResponse.ACTOR_CRASHED:
            logger.info(
                f"Actor for replica {self._replica_tag} crashed, marking "
                "it unhealthy immediately."
            )
            self._healthy = False
        else:
            assert False, f"Unknown response type: {response}."
        if self._should_start_new_health_check():
            self._last_health_check_time = time.time()
            self._health_check_ref = self._actor_handle.check_health.remote()
        return self._healthy
def check_health ( self ) -> bool : response : ReplicaHealthCheckResponse = self . _check_active_health_check ( ) if response is ReplicaHealthCheckResponse . NONE : pass elif response is ReplicaHealthCheckResponse . SUCCEEDED : self . _consecutive_health_check_failures = 0 self . _healthy = True elif response is ReplicaHealthCheckResponse . APP_FAILURE : self . _consecutive_health_check_failures += 1 if ( self . _consecutive_health_check_failures >= REPLICA_HEALTH_CHECK_UNHEALTHY_THRESHOLD ) : logger . info ( f"Replica {self._replica_tag} failed the health " f"check {self._consecutive_health_check_failures}" "times in a row, marking it unhealthy." ) self . _healthy = False elif response is ReplicaHealthCheckResponse . ACTOR_CRASHED : logger . info ( f"Actor for replica {self._replica_tag} crashed, marking " "it unhealthy immediately." ) self . _healthy = False else : assert False , f"Unknown response type: {response}." if self . _should_start_new_health_check ( ) : self . _last_health_check_time = time . time ( ) self . _health_check_ref = self . _actor_handle . check_health . remote ( ) return self . _healthy
Check if the actor is healthy.
Check if the actor is healthy .
"""Check if the actor is healthy.

        self._healthy should *only* be modified in this method.

        This is responsible for:
            1) Checking the outstanding health check (if any).
            2) Determining the replica health based on the health check results.
            3) Kicking off a new health check if needed.
        """ # No info; don't update replica health. # Health check succeeded. Reset the consecutive failure counter # and mark the replica healthy. # Health check failed. If it has failed more than N times in a row, # mark the replica unhealthy. # Actor crashed, mark the replica unhealthy immediately.
self