python/ray/serve/deployment_state.py
def count(
        self,
        exclude_version: Optional[DeploymentVersion] = None,
        version: Optional[DeploymentVersion] = None,
        states: Optional[List[ReplicaState]] = None,
    ):
        """Get the total count of replicas of the given states.

        Args:
            exclude_version(DeploymentVersion): version to exclude. If not
                specified, all versions are considered.
            version(DeploymentVersion): version to filter to. If not specified,
                all versions are considered.
            states (str): states to consider. If not specified, all replicas
                are considered.
        """
        if states is None:
            states = ALL_REPLICA_STATES
        assert isinstance(states, list)
        assert exclude_version is None or isinstance(exclude_version, DeploymentVersion)
        assert version is None or isinstance(version, DeploymentVersion)
        if exclude_version is None and version is None:
            return sum(len(self._replicas[state]) for state in states)
        elif exclude_version is None and version is not None:
            return sum(
                len(list(filter(lambda r: r.version == version, self._replicas[state])))
                for state in states
            )
        elif exclude_version is not None and version is None:
            return sum(
                len(
                    list(
                        filter(
                            lambda r: r.version != exclude_version,
                            self._replicas[state],
                        )
                    )
                )
                for state in states
            )
        else:
            raise ValueError(
                "Only one of `version` or `exclude_version` may be provided."
            )
Get the total count of replicas of the given states.

        Args:
            exclude_version(DeploymentVersion): version to exclude. If not
                specified, all versions are considered.
            version(DeploymentVersion): version to filter to. If not specified,
                all versions are considered.
            states (str): states to consider. If not specified, all replicas
                are considered.
        
Get the total count of replicas of the given states.
Get the total count of replicas of the given states .
def count(
        self,
        exclude_version: Optional[DeploymentVersion] = None,
        version: Optional[DeploymentVersion] = None,
        states: Optional[List[ReplicaState]] = None,
    ):
        if states is None:
            states = ALL_REPLICA_STATES
        assert isinstance(states, list)
        assert exclude_version is None or isinstance(exclude_version, DeploymentVersion)
        assert version is None or isinstance(version, DeploymentVersion)
        if exclude_version is None and version is None:
            return sum(len(self._replicas[state]) for state in states)
        elif exclude_version is None and version is not None:
            return sum(
                len(list(filter(lambda r: r.version == version, self._replicas[state])))
                for state in states
            )
        elif exclude_version is not None and version is None:
            return sum(
                len(
                    list(
                        filter(
                            lambda r: r.version != exclude_version,
                            self._replicas[state],
                        )
                    )
                )
                for state in states
            )
        else:
            raise ValueError(
                "Only one of `version` or `exclude_version` may be provided."
            )
def count ( self , exclude_version : Optional [ DeploymentVersion ] = None , version : Optional [ DeploymentVersion ] = None , states : Optional [ List [ ReplicaState ] ] = None , ) : if states is None : states = ALL_REPLICA_STATES assert isinstance ( states , list ) assert exclude_version is None or isinstance ( exclude_version , DeploymentVersion ) assert version is None or isinstance ( version , DeploymentVersion ) if exclude_version is None and version is None : return sum ( len ( self . _replicas [ state ] ) for state in states ) elif exclude_version is None and version is not None : return sum ( len ( list ( filter ( lambda r : r . version == version , self . _replicas [ state ] ) ) ) for state in states ) elif exclude_version is not None and version is None : return sum ( len ( list ( filter ( lambda r : r . version != exclude_version , self . _replicas [ state ] , ) ) ) for state in states ) else : raise ValueError ( "Only one of `version` or `exclude_version` may be provided." )
Get the total count of replicas of the given states.
Get the total count of replicas of the given states .
"""Get the total count of replicas of the given states.

        Args:
            exclude_version(DeploymentVersion): version to exclude. If not
                specified, all versions are considered.
            version(DeploymentVersion): version to filter to. If not specified,
                all versions are considered.
            states (str): states to consider. If not specified, all replicas
                are considered.
        """
self
exclude_version
Optional[DeploymentVersion]
version to exclude. If not
specified, all versions are considered.
version to exclude . If not specified all versions are considered .
version
Optional[DeploymentVersion]
version to filter to. If not specified,
all versions are considered.
version to filter to . If not specified all versions are considered .
states
Optional[List[ReplicaState]]
states to consider. If not specified, all replicas
are considered.
states to consider . If not specified all replicas are considered .