python/ray/serve/deployment_state.py
def check_ready(self) -> Tuple[ReplicaStartupStatus, Optional[DeploymentVersion]]:
        """
        Check if current replica has started by making ray API calls on
        relevant actor / object ref.

        Returns:
            state (ReplicaStartupStatus):
                PENDING_ALLOCATION:
                    - replica is waiting for a worker to start
                PENDING_INITIALIZATION
                    - replica reconfigure() haven't returned.
                FAILED:
                    - replica __init__() failed.
                SUCCEEDED:
                    - replica __init__() and reconfigure() succeeded.
            version (DeploymentVersion):
                None:
                    - replica reconfigure() haven't returned OR
                    - replica __init__() failed.
                version:
                    - replica __init__() and reconfigure() succeeded.
        """

        # Check whether the replica has been allocated.
        if not self._check_obj_ref_ready(self._allocated_obj_ref):
            return ReplicaStartupStatus.PENDING_ALLOCATION, None

        # Check whether relica initialization has completed.
        replica_ready = self._check_obj_ref_ready(self._ready_obj_ref)
        # In case of deployment constructor failure, ray.get will help to
        # surface exception to each update() cycle.
        if not replica_ready:
            return ReplicaStartupStatus.PENDING_INITIALIZATION, None
        else:
            try:
                # TODO(simon): fully implement reconfigure for Java replicas.
                if self._is_cross_language:
                    return ReplicaStartupStatus.SUCCEEDED, None

                deployment_config, version = ray.get(self._ready_obj_ref)
                self._max_concurrent_queries = deployment_config.max_concurrent_queries
                self._graceful_shutdown_timeout_s = (
                    deployment_config.graceful_shutdown_timeout_s
                )
                self._health_check_period_s = deployment_config.health_check_period_s
                self._health_check_timeout_s = deployment_config.health_check_timeout_s
                self._node_id = ray.get(self._allocated_obj_ref)
            except Exception:
                logger.exception(f"Exception in deployment '{self._deployment_name}'")
                return ReplicaStartupStatus.FAILED, None

        return ReplicaStartupStatus.SUCCEEDED, version

        Check if current replica has started by making ray API calls on
        relevant actor / object ref.

        Returns:
            state (ReplicaStartupStatus):
                PENDING_ALLOCATION:
                    - replica is waiting for a worker to start
                PENDING_INITIALIZATION
                    - replica reconfigure() haven't returned.
                FAILED:
                    - replica __init__() failed.
                SUCCEEDED:
                    - replica __init__() and reconfigure() succeeded.
            version (DeploymentVersion):
                None:
                    - replica reconfigure() haven't returned OR
                    - replica __init__() failed.
                version:
                    - replica __init__() and reconfigure() succeeded.
        
Check if current replica has started by making ray API calls on
relevant actor / object ref.
Check if current replica has started by making ray API calls on relevant actor / object ref .
def check_ready(self) -> Tuple[ReplicaStartupStatus, Optional[DeploymentVersion]]:
        if not self._check_obj_ref_ready(self._allocated_obj_ref):
            return ReplicaStartupStatus.PENDING_ALLOCATION, None
        replica_ready = self._check_obj_ref_ready(self._ready_obj_ref)
        if not replica_ready:
            return ReplicaStartupStatus.PENDING_INITIALIZATION, None
        else:
            try:
                if self._is_cross_language:
                    return ReplicaStartupStatus.SUCCEEDED, None
                deployment_config, version = ray.get(self._ready_obj_ref)
                self._max_concurrent_queries = deployment_config.max_concurrent_queries
                self._graceful_shutdown_timeout_s = (
                    deployment_config.graceful_shutdown_timeout_s
                )
                self._health_check_period_s = deployment_config.health_check_period_s
                self._health_check_timeout_s = deployment_config.health_check_timeout_s
                self._node_id = ray.get(self._allocated_obj_ref)
            except Exception:
                logger.exception(f"Exception in deployment '{self._deployment_name}'")
                return ReplicaStartupStatus.FAILED, None
        return ReplicaStartupStatus.SUCCEEDED, version
def check_ready ( self ) -> Tuple [ ReplicaStartupStatus , Optional [ DeploymentVersion ] ] : if not self . _check_obj_ref_ready ( self . _allocated_obj_ref ) : return ReplicaStartupStatus . PENDING_ALLOCATION , None replica_ready = self . _check_obj_ref_ready ( self . _ready_obj_ref ) if not replica_ready : return ReplicaStartupStatus . PENDING_INITIALIZATION , None else : try : if self . _is_cross_language : return ReplicaStartupStatus . SUCCEEDED , None deployment_config , version = ray . get ( self . _ready_obj_ref ) self . _max_concurrent_queries = deployment_config . max_concurrent_queries self . _graceful_shutdown_timeout_s = ( deployment_config . graceful_shutdown_timeout_s ) self . _health_check_period_s = deployment_config . health_check_period_s self . _health_check_timeout_s = deployment_config . health_check_timeout_s self . _node_id = ray . get ( self . _allocated_obj_ref ) except Exception : logger . exception ( f"Exception in deployment '{self._deployment_name}'" ) return ReplicaStartupStatus . FAILED , None return ReplicaStartupStatus . SUCCEEDED , version
Check if current replica has started by making ray API calls on
relevant actor / object ref.
Check if current replica has started by making ray API calls on relevant actor / object ref .
"""
        Check if current replica has started by making ray API calls on
        relevant actor / object ref.

        Returns:
            state (ReplicaStartupStatus):
                PENDING_ALLOCATION:
                    - replica is waiting for a worker to start
                PENDING_INITIALIZATION
                    - replica reconfigure() haven't returned.
                FAILED:
                    - replica __init__() failed.
                SUCCEEDED:
                    - replica __init__() and reconfigure() succeeded.
            version (DeploymentVersion):
                None:
                    - replica reconfigure() haven't returned OR
                    - replica __init__() failed.
                version:
                    - replica __init__() and reconfigure() succeeded.
        """ # Check whether the replica has been allocated. # Check whether relica initialization has completed. # In case of deployment constructor failure, ray.get will help to # surface exception to each update() cycle. # TODO(simon): fully implement reconfigure for Java replicas.
state (ReplicaStartupStatus):
PENDING_ALLOCATION:
replica is waiting for a worker to start
PENDING_INITIALIZATION
replica reconfigure() haven't returned.
FAILED:
replica __init__() failed.
SUCCEEDED:
replica __init__() and reconfigure() succeeded.
version (DeploymentVersion):
None:
replica reconfigure() haven't returned OR
replica __init__() failed.
version:
replica __init__() and reconfigure() succeeded.
state ( ReplicaStartupStatus ) : PENDING_ALLOCATION : replica is waiting for a worker to start PENDING_INITIALIZATION replica reconfigure () haven ' t returned . FAILED : replica __init__ () failed . SUCCEEDED : replica __init__ () and reconfigure () succeeded . version ( DeploymentVersion ) : None : replica reconfigure () haven ' t returned OR replica __init__ () failed . version : replica __init__ () and reconfigure () succeeded .
self