python/ray/serve/deployment_state.py
def _check_active_health_check(self) -> ReplicaHealthCheckResponse:
        """Check the active health check (if any).

        self._health_check_ref will be reset to `None` when the active health
        check is deemed to have succeeded or failed. This method *does not*
        start a new health check, that's up to the caller.

        Returns:
            - NONE if there's no active health check, or it hasn't returned
              yet and the timeout is not up.
            - SUCCEEDED if the active health check succeeded.
            - APP_FAILURE if the active health check failed (or didn't return
              before the timeout).
            - ACTOR_CRASHED if the underlying actor crashed.
        """
        if self._health_check_ref is None:
            # There is no outstanding health check.
            response = ReplicaHealthCheckResponse.NONE
        elif self._check_obj_ref_ready(self._health_check_ref):
            # Object ref is ready, ray.get it to check for exceptions.
            try:
                ray.get(self._health_check_ref)
                # Health check succeeded without exception.
                response = ReplicaHealthCheckResponse.SUCCEEDED
            except RayActorError:
                # Health check failed due to actor crashing.
                response = ReplicaHealthCheckResponse.ACTOR_CRASHED
            except RayError as e:
                # Health check failed due to application-level exception.
                logger.info(f"Health check for replica {self._replica_tag} failed: {e}")
                response = ReplicaHealthCheckResponse.APP_FAILURE
        elif time.time() - self._last_health_check_time > self._health_check_timeout_s:
            # Health check hasn't returned and the timeout is up, consider it failed.
            logger.info(
                "Didn't receive health check response for replica "
                f"{self._replica_tag} after "
                f"{self._health_check_timeout_s}s, marking it unhealthy."
            )
            response = ReplicaHealthCheckResponse.APP_FAILURE
        else:
            # Health check hasn't returned and the timeout isn't up yet.
            response = ReplicaHealthCheckResponse.NONE

        if response is not ReplicaHealthCheckResponse.NONE:
            self._health_check_ref = None

        return response
Check the active health check (if any).

        self._health_check_ref will be reset to `None` when the active health
        check is deemed to have succeeded or failed. This method *does not*
        start a new health check, that's up to the caller.

        Returns:
            - NONE if there's no active health check, or it hasn't returned
              yet and the timeout is not up.
            - SUCCEEDED if the active health check succeeded.
            - APP_FAILURE if the active health check failed (or didn't return
              before the timeout).
            - ACTOR_CRASHED if the underlying actor crashed.
        
Check the active health check (if any).
self._health_check_ref will be reset to `None` when the active health
check is deemed to have succeeded or failed. This method *does not
start a new health check, that's up to the caller.
Check the active health check ( if any ) . self . _health_check_ref will be reset to ` None ` when the active health check is deemed to have succeeded or failed . This method * does not start a new health check that ' s up to the caller .
def _check_active_health_check(self) -> ReplicaHealthCheckResponse:
        if self._health_check_ref is None:
            response = ReplicaHealthCheckResponse.NONE
        elif self._check_obj_ref_ready(self._health_check_ref):
            try:
                ray.get(self._health_check_ref)
                response = ReplicaHealthCheckResponse.SUCCEEDED
            except RayActorError:
                response = ReplicaHealthCheckResponse.ACTOR_CRASHED
            except RayError as e:
                logger.info(f"Health check for replica {self._replica_tag} failed: {e}")
                response = ReplicaHealthCheckResponse.APP_FAILURE
        elif time.time() - self._last_health_check_time > self._health_check_timeout_s:
            logger.info(
                "Didn't receive health check response for replica "
                f"{self._replica_tag} after "
                f"{self._health_check_timeout_s}s, marking it unhealthy."
            )
            response = ReplicaHealthCheckResponse.APP_FAILURE
        else:
            response = ReplicaHealthCheckResponse.NONE
        if response is not ReplicaHealthCheckResponse.NONE:
            self._health_check_ref = None
        return response
def _check_active_health_check ( self ) -> ReplicaHealthCheckResponse : if self . _health_check_ref is None : response = ReplicaHealthCheckResponse . NONE elif self . _check_obj_ref_ready ( self . _health_check_ref ) : try : ray . get ( self . _health_check_ref ) response = ReplicaHealthCheckResponse . SUCCEEDED except RayActorError : response = ReplicaHealthCheckResponse . ACTOR_CRASHED except RayError as e : logger . info ( f"Health check for replica {self._replica_tag} failed: {e}" ) response = ReplicaHealthCheckResponse . APP_FAILURE elif time . time ( ) - self . _last_health_check_time > self . _health_check_timeout_s : logger . info ( "Didn't receive health check response for replica " f"{self._replica_tag} after " f"{self._health_check_timeout_s}s, marking it unhealthy." ) response = ReplicaHealthCheckResponse . APP_FAILURE else : response = ReplicaHealthCheckResponse . NONE if response is not ReplicaHealthCheckResponse . NONE : self . _health_check_ref = None return response
Check the active health check (if any).
Check the active health check ( if any ) .
"""Check the active health check (if any).

        self._health_check_ref will be reset to `None` when the active health
        check is deemed to have succeeded or failed. This method *does not*
        start a new health check, that's up to the caller.

        Returns:
            - NONE if there's no active health check, or it hasn't returned
              yet and the timeout is not up.
            - SUCCEEDED if the active health check succeeded.
            - APP_FAILURE if the active health check failed (or didn't return
              before the timeout).
            - ACTOR_CRASHED if the underlying actor crashed.
        """ # There is no outstanding health check. # Object ref is ready, ray.get it to check for exceptions. # Health check succeeded without exception. # Health check failed due to actor crashing. # Health check failed due to application-level exception. # Health check hasn't returned and the timeout is up, consider it failed. # Health check hasn't returned and the timeout isn't up yet.
NONE if there's no active health check, or it hasn't returned
yet and the timeout is not up.
SUCCEEDED if the active health check succeeded.
APP_FAILURE if the active health check failed (or didn't return
before the timeout).
ACTOR_CRASHED if the underlying actor crashed.
NONE if there ' s no active health check or it hasn ' t returned yet and the timeout is not up . SUCCEEDED if the active health check succeeded . APP_FAILURE if the active health check failed ( or didn ' t return before the timeout ) . ACTOR_CRASHED if the underlying actor crashed .
self