id int64 0 328k | repository_name stringlengths 7 58 | file_path stringlengths 9 302 | class_name stringlengths 5 256 | human_written_code stringlengths 16 2.16M | class_skeleton stringlengths 18 1.49M ⌀ | total_program_units int64 1 1.76k | total_doc_str int64 0 771 | AvgCountLine float64 0 7.89k | AvgCountLineBlank float64 0 297 | AvgCountLineCode float64 0 7.89k | AvgCountLineComment float64 0 7.89k | AvgCyclomatic float64 0 130 | CommentToCodeRatio float64 0 168 | CountClassBase float64 0 40 | CountClassCoupled float64 0 583 | CountClassCoupledModified float64 0 575 | CountClassDerived float64 0 5.35k | CountDeclInstanceMethod float64 0 529 | CountDeclInstanceVariable float64 0 296 | CountDeclMethod float64 0 599 | CountDeclMethodAll float64 0 1.12k | CountLine float64 1 40.4k | CountLineBlank float64 0 8.16k | CountLineCode float64 1 25.7k | CountLineCodeDecl float64 1 8.15k | CountLineCodeExe float64 0 24.2k | CountLineComment float64 0 16.5k | CountStmt float64 1 9.71k | CountStmtDecl float64 1 8.15k | CountStmtExe float64 0 9.69k | MaxCyclomatic float64 0 759 | MaxInheritanceTree float64 0 16 | MaxNesting float64 0 34 | SumCyclomatic float64 0 2.9k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
10,400 | ray-project/ray | python/ray/serve/_private/common.py | ray.serve._private.common.ServeDeployMode | from enum import Enum
class ServeDeployMode(str, Enum):
MULTI_APP = 'MULTI_APP' |
class ServeDeployMode(str, Enum):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 115 | 2 | 0 | 2 | 2 | 1 | 0 | 2 | 2 | 1 | 0 | 4 | 0 | 0 |
10,401 | ray-project/ray | python/ray/serve/_private/common.py | ray.serve._private.common.StreamingHTTPRequest | from starlette.types import Scope
import ray
from ray.actor import ActorHandle
from typing import Any, Awaitable, Callable, Dict, List, Optional
from ray.serve._private.constants import SERVE_DEFAULT_APP_NAME, SERVE_NAMESPACE
class StreamingHTTPRequest:
"""Sent from the HTTP proxy to replicas on the streaming code... |
class StreamingHTTPRequest:
'''Sent from the HTTP proxy to replicas on the streaming codepath.'''
def __init__(self, asgi_scope: Scope, *, proxy_actor_name: Optional[str]=None, receive_asgi_messages: Optional[Callable[[RequestMetadata], Awaitable[bytes]]]=None):
pass
@property
def asgi_scope(s... | 6 | 1 | 12 | 1 | 10 | 1 | 2 | 0.15 | 0 | 5 | 2 | 0 | 3 | 4 | 3 | 3 | 44 | 6 | 33 | 18 | 19 | 5 | 15 | 8 | 11 | 2 | 0 | 1 | 5 |
10,402 | ray-project/ray | python/ray/serve/_private/common.py | ray.serve._private.common.TargetCapacityDirection | from enum import Enum
class TargetCapacityDirection(str, Enum):
"""Determines what direction the target capacity is scaling."""
UP = 'UP'
DOWN = 'DOWN' |
class TargetCapacityDirection(str, Enum):
'''Determines what direction the target capacity is scaling.'''
pass | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.33 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 115 | 5 | 1 | 3 | 3 | 2 | 1 | 3 | 3 | 2 | 0 | 4 | 0 | 0 |
10,403 | ray-project/ray | python/ray/serve/_private/common.py | ray.serve._private.common.gRPCRequest | from typing import Any, Awaitable, Callable, Dict, List, Optional
from dataclasses import asdict, dataclass, field
@dataclass
class gRPCRequest:
"""Sent from the GRPC proxy to replicas on both unary and streaming codepaths."""
user_request_proto: Any | @dataclass
class gRPCRequest:
'''Sent from the GRPC proxy to replicas on both unary and streaming codepaths.'''
pass | 2 | 1 | 0 | 0 | 0 | 0 | 0 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 | 1 | 2 | 1 | 1 | 1 | 2 | 1 | 1 | 0 | 0 | 0 | 0 |
10,404 | ray-project/ray | python/ray/serve/_private/config.py | ray.serve._private.config.DeploymentConfig | from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Union
import json
from ray.serve._private.utils import DEFAULT, DeploymentOptionUpdateType
from ray.serve.config import AutoscalingConfig, RequestRouterConfig
from ray._common.pydantic_compat import BaseModel, Field, NonNegativeFloat, NonNegativeInt, P... |
class DeploymentConfig(BaseModel):
'''Internal datastructure wrapping config options for a deployment.
Args:
num_replicas: The number of processes to start up that
handles requests to this deployment. Defaults to 1.
max_ongoing_requests: The maximum number of queries
tha... | 17 | 2 | 15 | 2 | 13 | 1 | 4 | 0.26 | 1 | 12 | 3 | 0 | 6 | 0 | 9 | 9 | 244 | 34 | 167 | 44 | 149 | 43 | 103 | 37 | 91 | 17 | 1 | 3 | 40 |
10,405 | ray-project/ray | python/ray/serve/_private/config.py | ray.serve._private.config.ReplicaConfig | from ray.serve.generated.serve_pb2 import AutoscalingConfig as AutoscalingConfigProto, DeploymentConfig as DeploymentConfigProto, DeploymentLanguage, EncodingType as EncodingTypeProto, LoggingConfig as LoggingConfigProto, ReplicaConfig as ReplicaConfigProto, RequestRouterConfig as RequestRouterConfigProto
from ray.serv... |
class ReplicaConfig:
'''Internal datastructure wrapping config options for a deployment's replicas.
Provides five main properties (see property docstrings for more info):
deployment_def: the code, or a reference to the code, that this
replica should run.
init_args: the deployment_de... | 21 | 6 | 23 | 3 | 18 | 2 | 4 | 0.21 | 0 | 12 | 0 | 0 | 11 | 13 | 14 | 14 | 364 | 55 | 256 | 74 | 208 | 53 | 120 | 41 | 105 | 13 | 0 | 3 | 53 |
10,406 | ray-project/ray | python/ray/serve/_private/controller.py | ray.serve._private.controller.ServeController | from ray.serve._private.constants import CONTROL_LOOP_INTERVAL_S, RAY_SERVE_CONTROLLER_CALLBACK_IMPORT_PATH, RAY_SERVE_RPC_LATENCY_WARNING_THRESHOLD_MS, RECOVERING_LONG_POLL_BROADCAST_TIMEOUT_S, SERVE_CONTROLLER_NAME, SERVE_DEFAULT_APP_NAME, SERVE_LOGGER_NAME, SERVE_NAMESPACE, SERVE_ROOT_URL_ENV_KEY
from ray.actor impo... |
class ServeController:
'''Responsible for managing the state of the serving system.
The controller implements fault tolerance by persisting its state in
a new checkpoint each time a state change is made. If the actor crashes,
the latest checkpoint is loaded and the state is recovered. Checkpoints
a... | 56 | 40 | 18 | 2 | 13 | 4 | 2 | 0.3 | 0 | 38 | 28 | 0 | 50 | 29 | 50 | 50 | 982 | 141 | 645 | 180 | 565 | 196 | 340 | 142 | 289 | 14 | 0 | 4 | 110 |
10,407 | ray-project/ray | python/ray/serve/_private/deployment_info.py | ray.serve._private.deployment_info.DeploymentInfo | from ray.serve._private.config import DeploymentConfig, ReplicaConfig
from ray.serve.generated.serve_pb2 import DeploymentInfo as DeploymentInfoProto, TargetCapacityDirection as TargetCapacityDirectionProto
from ray.serve._private.common import TargetCapacityDirection
import ray
from typing import Any, Dict, Optional
... |
class DeploymentInfo:
def __init__(self, deployment_config: DeploymentConfig, replica_config: ReplicaConfig, start_time_ms: int, deployer_job_id: str, actor_name: Optional[str]=None, version: Optional[str]=None, end_time_ms: Optional[int]=None, route_prefix: str=None, ingress: bool=False, target_capacity: Optiona... | 12 | 0 | 17 | 1 | 15 | 1 | 2 | 0.04 | 0 | 9 | 2 | 0 | 8 | 14 | 9 | 9 | 161 | 18 | 137 | 57 | 100 | 6 | 57 | 31 | 46 | 8 | 0 | 1 | 21 |
10,408 | ray-project/ray | python/ray/serve/_private/deployment_node.py | ray.serve._private.deployment_node.DeploymentNode | from typing import Any, Dict, List, Optional, Tuple
from ray.serve.deployment import Deployment
from ray.dag import DAGNode
from ray.serve.handle import DeploymentHandle
from ray.dag.format_utils import get_dag_node_str
class DeploymentNode(DAGNode):
"""Represents a deployment node in a DAG authored Ray DAG API.""... |
class DeploymentNode(DAGNode):
'''Represents a deployment node in a DAG authored Ray DAG API.'''
def __init__(self, deployment: Deployment, app_name: str, deployment_init_args: Tuple[Any], deployment_init_kwargs: Dict[str, Any], ray_actor_options: Dict[str, Any], other_args_to_resolve: Optional[Dict[str, Any]... | 5 | 1 | 11 | 0 | 10 | 1 | 1 | 0.1 | 1 | 5 | 2 | 0 | 4 | 3 | 4 | 32 | 48 | 4 | 40 | 22 | 21 | 4 | 12 | 8 | 7 | 1 | 2 | 0 | 4 |
10,409 | ray-project/ray | python/ray/serve/_private/deployment_scheduler.py | ray.serve._private.deployment_scheduler.DefaultDeploymentScheduler | from ray.serve._private.common import CreatePlacementGroupRequest, DeploymentID, ReplicaID
from ray.serve._private.constants import RAY_SERVE_HIGH_PRIORITY_CUSTOM_RESOURCES, RAY_SERVE_USE_COMPACT_SCHEDULING_STRATEGY, SERVE_LOGGER_NAME
from typing import Any, Callable, Dict, List, Optional, Set, Tuple
import sys
class ... |
class DefaultDeploymentScheduler(DeploymentScheduler):
def schedule(self, upscales: Dict[DeploymentID, List[ReplicaSchedulingRequest]], downscales: Dict[DeploymentID, DeploymentDownscaleRequest]) -> Dict[DeploymentID, Set[ReplicaID]]:
'''Called for each update cycle to do batch scheduling.
Args:
... | 6 | 3 | 34 | 4 | 24 | 6 | 4 | 0.25 | 1 | 11 | 5 | 0 | 4 | 1 | 4 | 38 | 167 | 23 | 115 | 40 | 97 | 29 | 53 | 27 | 47 | 9 | 5 | 3 | 22 |
10,410 | ray-project/ray | python/ray/serve/_private/deployment_scheduler.py | ray.serve._private.deployment_scheduler.DeploymentDownscaleRequest | from dataclasses import dataclass
from ray.serve._private.common import CreatePlacementGroupRequest, DeploymentID, ReplicaID
@dataclass
class DeploymentDownscaleRequest:
"""Request to stop a certain number of replicas.
The scheduler is responsible for
choosing the replicas to stop.
"""
deployment_... | @dataclass
class DeploymentDownscaleRequest:
'''Request to stop a certain number of replicas.
The scheduler is responsible for
choosing the replicas to stop.
'''
pass | 2 | 1 | 0 | 0 | 0 | 0 | 0 | 1.33 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 9 | 2 | 3 | 1 | 2 | 4 | 3 | 1 | 2 | 0 | 0 | 0 | 0 |
10,411 | ray-project/ray | python/ray/serve/_private/deployment_scheduler.py | ray.serve._private.deployment_scheduler.DeploymentScheduler | import ray
import copy
from collections import defaultdict
from ray.util.scheduling_strategies import LabelMatchExpressionsT, NodeAffinitySchedulingStrategy, NodeLabelSchedulingStrategy, PlacementGroupSchedulingStrategy
from ray.serve._private.common import CreatePlacementGroupRequest, DeploymentID, ReplicaID
from typi... |
class DeploymentScheduler(ABC):
'''A centralized scheduler for all Serve deployments.
It makes a batch of scheduling decisions in each update cycle.
'''
def __init__(self, cluster_node_info_cache: ClusterNodeInfoCache, head_node_id: str, create_placement_group_fn: Callable):
pass
def on_d... | 18 | 11 | 24 | 2 | 16 | 5 | 3 | 0.35 | 1 | 22 | 14 | 1 | 14 | 8 | 14 | 34 | 368 | 52 | 234 | 91 | 182 | 82 | 142 | 55 | 126 | 10 | 4 | 3 | 40 |
10,412 | ray-project/ray | python/ray/serve/_private/deployment_scheduler.py | ray.serve._private.deployment_scheduler.DeploymentSchedulingInfo | from dataclasses import dataclass
from ray.serve._private.common import CreatePlacementGroupRequest, DeploymentID, ReplicaID
from typing import Any, Callable, Dict, List, Optional, Set, Tuple
import ray
@dataclass
class DeploymentSchedulingInfo:
deployment_id: DeploymentID
scheduling_policy: Any
actor_reso... | @dataclass
class DeploymentSchedulingInfo:
@property
def required_resources(self) -> Resources:
'''The resources required to schedule a replica of this deployment on a node.
If this replicas uses a strict pack placement group, the
required resources is the sum of the placement group bun... | 5 | 1 | 16 | 2 | 10 | 4 | 2 | 0.29 | 0 | 2 | 1 | 0 | 2 | 0 | 2 | 2 | 42 | 6 | 28 | 10 | 24 | 8 | 17 | 9 | 14 | 3 | 0 | 2 | 4 |
10,413 | ray-project/ray | python/ray/serve/_private/deployment_scheduler.py | ray.serve._private.deployment_scheduler.LaunchingReplicaInfo | from dataclasses import dataclass
from typing import Any, Callable, Dict, List, Optional, Set, Tuple
@dataclass
class LaunchingReplicaInfo:
"""Describes a replica for which a schedule request has been sent to
core but has not been scheduled (placed on a node) yet.
Args:
target_node_id: The exact n... | @dataclass
class LaunchingReplicaInfo:
'''Describes a replica for which a schedule request has been sent to
core but has not been scheduled (placed on a node) yet.
Args:
target_node_id: The exact node that's been requested for this
replica. This is best effort and may not be fulfilled.
... | 2 | 1 | 0 | 0 | 0 | 0 | 0 | 2.67 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 13 | 2 | 3 | 3 | 2 | 8 | 3 | 3 | 2 | 0 | 0 | 0 | 0 |
10,414 | ray-project/ray | python/ray/serve/_private/deployment_scheduler.py | ray.serve._private.deployment_scheduler.ReplicaSchedulingRequest | from typing import Any, Callable, Dict, List, Optional, Set, Tuple
from dataclasses import dataclass
from ray.serve._private.common import CreatePlacementGroupRequest, DeploymentID, ReplicaID
import ray
@dataclass
class ReplicaSchedulingRequest:
"""Request to schedule a single replica.
The scheduler is respon... | @dataclass
class ReplicaSchedulingRequest:
'''Request to schedule a single replica.
The scheduler is responsible for scheduling
based on the deployment scheduling policy.
'''
@property
def required_resources(self) -> Resources:
'''The resources required to schedule this replica on a node... | 4 | 2 | 31 | 4 | 19 | 8 | 3 | 0.45 | 0 | 1 | 1 | 0 | 1 | 0 | 1 | 1 | 52 | 7 | 31 | 10 | 28 | 14 | 20 | 9 | 18 | 3 | 0 | 2 | 3 |
10,415 | ray-project/ray | python/ray/serve/_private/deployment_scheduler.py | ray.serve._private.deployment_scheduler.ReplicaSchedulingRequestStatus | from enum import Enum
class ReplicaSchedulingRequestStatus(str, Enum):
"""The status of a replica scheduling request."""
IN_PROGRESS = 'IN_PROGRESS'
SUCCEEDED = 'SUCCEEDED'
ACTOR_CREATION_FAILED = 'ACTOR_CREATION_FAILED'
PLACEMENT_GROUP_CREATION_FAILED = 'PLACEMENT_GROUP_CREATION_FAILED' |
class ReplicaSchedulingRequestStatus(str, Enum):
'''The status of a replica scheduling request.'''
pass | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.2 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 115 | 7 | 1 | 5 | 5 | 4 | 1 | 5 | 5 | 4 | 0 | 4 | 0 | 0 |
10,416 | ray-project/ray | python/ray/serve/_private/deployment_scheduler.py | ray.serve._private.deployment_scheduler.Resources | import ray
from ray.serve._private.constants import RAY_SERVE_HIGH_PRIORITY_CUSTOM_RESOURCES, RAY_SERVE_USE_COMPACT_SCHEDULING_STRATEGY, SERVE_LOGGER_NAME
from typing import Any, Callable, Dict, List, Optional, Set, Tuple
from functools import total_ordering
@total_ordering
class Resources(dict):
CUSTOM_PRIORITY: ... | @total_ordering
class Resources(dict):
def get(self, key: str):
pass
def can_fit(self, other):
pass
def __eq__(self, other):
pass
def __add__(self, other):
pass
def __sub__(self, other):
pass
def __lt__(self, other):
'''Determines priority wh... | 8 | 1 | 12 | 2 | 8 | 2 | 3 | 0.25 | 1 | 3 | 0 | 0 | 6 | 0 | 6 | 33 | 75 | 15 | 48 | 17 | 41 | 12 | 43 | 17 | 36 | 10 | 2 | 2 | 19 |
10,417 | ray-project/ray | python/ray/serve/_private/deployment_scheduler.py | ray.serve._private.deployment_scheduler.SpreadDeploymentSchedulingPolicy | class SpreadDeploymentSchedulingPolicy:
"""A scheduling policy that spreads replicas with best effort."""
pass | class SpreadDeploymentSchedulingPolicy:
'''A scheduling policy that spreads replicas with best effort.'''
pass | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 | 1 | 2 | 1 | 1 | 1 | 2 | 1 | 1 | 0 | 0 | 0 | 0 |
10,418 | ray-project/ray | python/ray/serve/_private/deployment_state.py | ray.serve._private.deployment_state.ActorReplicaWrapper | from ray.serve.generated.serve_pb2 import DeploymentLanguage
from copy import copy
from ray.serve._private.utils import JavaActorHandleProxy, check_obj_ref_ready_nowait, get_capacity_adjusted_num_replicas, get_random_string, msgpack_deserialize, msgpack_serialize
import traceback
import time
from ray.actor import Actor... |
class ActorReplicaWrapper:
'''Wraps a Ray actor for a deployment replica.
This is primarily defined so that we can mock out actual Ray operations
for unit testing.
*All Ray API calls should be made here, not in DeploymentState.*
'''
def __init__(self, replica_id: ReplicaID, version: Deployment... | 74 | 23 | 18 | 1 | 12 | 5 | 2 | 0.39 | 0 | 18 | 11 | 0 | 35 | 24 | 35 | 35 | 682 | 89 | 426 | 111 | 360 | 167 | 245 | 79 | 209 | 11 | 0 | 3 | 85 |
10,419 | ray-project/ray | python/ray/serve/_private/deployment_state.py | ray.serve._private.deployment_state.DeploymentReplica | from ray.actor import ActorHandle
from ray.serve._private.deployment_info import DeploymentInfo
from ray.serve.schema import DeploymentDetails, ReplicaDetails, _deployment_info_to_schema
from ray.serve._private.version import DeploymentVersion
from ray.serve._private.deployment_scheduler import DeploymentDownscaleReque... |
class DeploymentReplica:
'''Manages state transitions for deployment replicas.
This is basically a checkpointable lightweight state machine.
'''
def __init__(self, replica_id: ReplicaID, version: DeploymentVersion):
pass
def get_running_replica_info(self, cluster_node_info_cache: ClusterN... | 48 | 17 | 8 | 1 | 5 | 2 | 1 | 0.34 | 0 | 13 | 9 | 0 | 24 | 6 | 24 | 24 | 221 | 40 | 135 | 58 | 91 | 46 | 81 | 39 | 56 | 3 | 0 | 1 | 30 |
10,420 | ray-project/ray | python/ray/serve/_private/deployment_state.py | ray.serve._private.deployment_state.DeploymentState | from ray.serve.schema import DeploymentDetails, ReplicaDetails, _deployment_info_to_schema
from ray.serve._private.version import DeploymentVersion
from ray.serve import metrics
from ray.serve._private.constants import MAX_DEPLOYMENT_CONSTRUCTOR_RETRY_COUNT, MAX_PER_REPLICA_RETRY_COUNT, RAY_SERVE_ENABLE_TASK_EVENTS, RA... |
class DeploymentState:
'''Manages the target state and replicas for a single deployment.'''
def __init__(self, id: DeploymentID, long_poll_host: LongPollHost, deployment_scheduler: DeploymentScheduler, cluster_node_info_cache: ClusterNodeInfoCache, autoscaling_state_manager: AutoscalingStateManager):
... | 53 | 25 | 26 | 3 | 19 | 5 | 3 | 0.25 | 0 | 28 | 20 | 0 | 39 | 18 | 39 | 39 | 1,089 | 142 | 758 | 185 | 683 | 191 | 372 | 149 | 332 | 15 | 0 | 3 | 120 |
10,421 | ray-project/ray | python/ray/serve/_private/deployment_state.py | ray.serve._private.deployment_state.DeploymentStateManager | from ray.serve._private.deployment_scheduler import DeploymentDownscaleRequest, DeploymentScheduler, ReplicaSchedulingRequest, ReplicaSchedulingRequestStatus, SpreadDeploymentSchedulingPolicy
from ray.serve._private.deployment_info import DeploymentInfo
from ray.serve._private.long_poll import LongPollHost, LongPollNam... |
class DeploymentStateManager:
'''Manages all state for deployments in the system.
This class is *not* thread safe, so any state-modifying methods should be
called with a lock held.
'''
def __init__(self, kv_store: KVStoreBase, long_poll_host: LongPollHost, all_current_actor_names: List[str], all_c... | 26 | 17 | 21 | 2 | 15 | 4 | 3 | 0.32 | 0 | 22 | 15 | 0 | 22 | 6 | 22 | 22 | 500 | 72 | 326 | 113 | 269 | 103 | 179 | 78 | 156 | 18 | 0 | 3 | 70 |
10,422 | ray-project/ray | python/ray/serve/_private/deployment_state.py | ray.serve._private.deployment_state.DeploymentStateUpdateResult | from dataclasses import dataclass
from ray.serve._private.deployment_scheduler import DeploymentDownscaleRequest, DeploymentScheduler, ReplicaSchedulingRequest, ReplicaSchedulingRequestStatus, SpreadDeploymentSchedulingPolicy
from typing import Any, Callable, Dict, List, Optional, Set, Tuple
@dataclass
class Deploymen... | @dataclass
class DeploymentStateUpdateResult:
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 | 0 | 5 | 1 | 4 | 0 | 5 | 1 | 4 | 0 | 0 | 0 | 0 |
10,423 | ray-project/ray | python/ray/serve/_private/deployment_state.py | ray.serve._private.deployment_state.DeploymentTargetState | from typing import Any, Callable, Dict, List, Optional, Set, Tuple
from dataclasses import dataclass
from ray.serve._private.version import DeploymentVersion
from ray.serve._private.deployment_info import DeploymentInfo
@dataclass
class DeploymentTargetState:
"""The current goal state for a deployment.
info: ... | @dataclass
class DeploymentTargetState:
'''The current goal state for a deployment.
info: contains the information needed to initialize a replica.
target_num_replicas: the number of replicas to run. This should already
be adjusted by the target_capacity.
version: the goal version of the deployme... | 7 | 2 | 20 | 2 | 15 | 3 | 2 | 0.29 | 0 | 3 | 0 | 0 | 1 | 0 | 3 | 3 | 78 | 11 | 52 | 13 | 40 | 15 | 17 | 5 | 13 | 3 | 0 | 2 | 6 |
10,424 | ray-project/ray | python/ray/serve/_private/deployment_state.py | ray.serve._private.deployment_state.ReplicaHealthCheckResponse | from enum import Enum
class ReplicaHealthCheckResponse(Enum):
NONE = 1
SUCCEEDED = 2
APP_FAILURE = 3
ACTOR_CRASHED = 4 |
class ReplicaHealthCheckResponse(Enum):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 49 | 5 | 0 | 5 | 5 | 4 | 0 | 5 | 5 | 4 | 0 | 4 | 0 | 0 |
10,425 | ray-project/ray | python/ray/serve/_private/deployment_state.py | ray.serve._private.deployment_state.ReplicaStartupStatus | from enum import Enum
class ReplicaStartupStatus(Enum):
PENDING_ALLOCATION = 1
PENDING_INITIALIZATION = 2
SUCCEEDED = 3
FAILED = 4 |
class ReplicaStartupStatus(Enum):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 49 | 5 | 0 | 5 | 5 | 4 | 0 | 5 | 5 | 4 | 0 | 4 | 0 | 0 |
10,426 | ray-project/ray | python/ray/serve/_private/deployment_state.py | ray.serve._private.deployment_state.ReplicaStateContainer | import math
from collections import defaultdict
from ray.serve._private.version import DeploymentVersion
from ray.serve._private.common import DeploymentID, DeploymentStatus, DeploymentStatusInfo, DeploymentStatusInternalTrigger, DeploymentStatusTrigger, DeploymentTargetInfo, Duration, ReplicaID, ReplicaState, RequestR... |
class ReplicaStateContainer:
'''Container for mapping ReplicaStates to lists of DeploymentReplicas.'''
def __init__(self):
pass
def add(self, state: ReplicaState, replica: DeploymentReplica):
'''Add the provided replica under the provided state.
Args:
state: state to a... | 8 | 5 | 17 | 2 | 11 | 5 | 2 | 0.43 | 0 | 8 | 2 | 0 | 7 | 1 | 7 | 7 | 129 | 20 | 76 | 26 | 56 | 33 | 44 | 14 | 36 | 6 | 0 | 3 | 17 |
10,427 | ray-project/ray | python/ray/serve/_private/endpoint_state.py | ray.serve._private.endpoint_state.EndpointState | from ray.serve._private.storage.kv_store import KVStoreBase
from ray.serve._private.common import DeploymentID, EndpointInfo
from typing import Any, Dict, Optional
from ray.serve._private.long_poll import LongPollHost, LongPollNamespace
from ray import cloudpickle
class EndpointState:
"""Manages all state for endp... |
class EndpointState:
'''Manages all state for endpoints in the system.
This class is *not* thread safe, so any state-modifying methods should be
called with a lock held.
'''
def __init__(self, kv_store: KVStoreBase, long_poll_host: LongPollHost):
pass
def shutdown(self):
pass
... | 11 | 3 | 8 | 1 | 6 | 1 | 2 | 0.26 | 0 | 9 | 5 | 0 | 10 | 3 | 10 | 10 | 95 | 22 | 58 | 21 | 45 | 15 | 47 | 19 | 36 | 3 | 0 | 2 | 18 |
10,428 | ray-project/ray | python/ray/serve/_private/grpc_util.py | ray.serve._private.grpc_util.gRPCGenericServer | from typing import Callable, List, Optional, Sequence, Tuple
import grpc
from ray.serve._private.constants import DEFAULT_GRPC_SERVER_OPTIONS, RAY_SERVE_REQUEST_PROCESSING_TIMEOUT_S, SERVE_LOGGER_NAME
from grpc.aio._server import Server
class gRPCGenericServer(Server):
"""Custom gRPC server that will override all ... |
class gRPCGenericServer(Server):
'''Custom gRPC server that will override all service method handlers.
Original implementation see: https://github.com/grpc/grpc/blob/
60c1701f87cacf359aa1ad785728549eeef1a4b0/src/python/grpcio/grpc/aio/_server.py
'''
def __init__(self, service_handler_factory: ... | 3 | 2 | 24 | 1 | 19 | 5 | 2 | 0.34 | 1 | 2 | 0 | 0 | 2 | 2 | 2 | 2 | 55 | 4 | 38 | 16 | 28 | 13 | 14 | 9 | 11 | 2 | 1 | 1 | 3 |
10,429 | ray-project/ray | python/ray/serve/_private/handle_options.py | ray.serve._private.handle_options.DynamicHandleOptions | from ray.serve._private.utils import DEFAULT
from dataclasses import dataclass, fields
@dataclass(frozen=True)
class DynamicHandleOptions(DynamicHandleOptionsBase):
_by_reference: bool = True
def copy_and_update(self, **kwargs) -> 'DynamicHandleOptions':
new_kwargs = {}
for f in fields(self):
... | @dataclass(frozen=True)
class DynamicHandleOptions(DynamicHandleOptionsBase):
def copy_and_update(self, **kwargs) -> 'DynamicHandleOptions':
pass | 3 | 0 | 10 | 2 | 8 | 0 | 3 | 0 | 1 | 1 | 1 | 0 | 1 | 0 | 1 | 22 | 11 | 2 | 9 | 4 | 7 | 0 | 8 | 4 | 6 | 3 | 5 | 2 | 3 |
10,430 | ray-project/ray | python/ray/serve/_private/handle_options.py | ray.serve._private.handle_options.DynamicHandleOptionsBase | from abc import ABC, abstractmethod
from dataclasses import dataclass, fields
@dataclass(frozen=True)
class DynamicHandleOptionsBase(ABC):
"""Dynamic options for each ServeHandle instance.
These fields can be changed by calling `.options()` on a handle.
"""
method_name: str = '__call__'
multiplexe... | @dataclass(frozen=True)
class DynamicHandleOptionsBase(ABC):
'''Dynamic options for each ServeHandle instance.
These fields can be changed by calling `.options()` on a handle.
'''
@abstractmethod
def copy_and_update(self, **kwargs) -> 'DynamicHandleOptionsBase':
pass | 4 | 1 | 2 | 0 | 2 | 0 | 1 | 0.43 | 1 | 0 | 0 | 1 | 1 | 0 | 1 | 21 | 13 | 3 | 7 | 6 | 4 | 3 | 6 | 5 | 4 | 1 | 4 | 0 | 1 |
10,431 | ray-project/ray | python/ray/serve/_private/handle_options.py | ray.serve._private.handle_options.InitHandleOptions | from ray.serve._private.utils import DEFAULT
from dataclasses import dataclass, fields
from ray.serve._private.common import DeploymentHandleSource
import ray
@dataclass(frozen=True)
class InitHandleOptions(InitHandleOptionsBase):
@classmethod
def create(cls, **kwargs) -> 'InitHandleOptions':
for k in... | @dataclass(frozen=True)
class InitHandleOptions(InitHandleOptionsBase):
@classmethod
def create(cls, **kwargs) -> 'InitHandleOptions':
pass | 4 | 0 | 14 | 2 | 10 | 2 | 4 | 0.17 | 1 | 3 | 2 | 0 | 0 | 0 | 1 | 22 | 16 | 2 | 12 | 4 | 9 | 2 | 8 | 3 | 6 | 4 | 5 | 2 | 4 |
10,432 | ray-project/ray | python/ray/serve/_private/handle_options.py | ray.serve._private.handle_options.InitHandleOptionsBase | from ray.serve._private.common import DeploymentHandleSource
from abc import ABC, abstractmethod
from dataclasses import dataclass, fields
from ray.serve._private.constants import RAY_SERVE_RUN_ROUTER_IN_SEPARATE_LOOP
@dataclass(frozen=True)
class InitHandleOptionsBase(ABC):
"""Init options for each ServeHandle in... | @dataclass(frozen=True)
class InitHandleOptionsBase(ABC):
'''Init options for each ServeHandle instance.
These fields can be set by calling `.init()` on a handle before
sending the first request.
'''
@classmethod
@abstractmethod
def create(cls, **kwargs) -> 'InitHandleOptionsBase':
p... | 5 | 1 | 2 | 0 | 2 | 0 | 1 | 0.57 | 1 | 1 | 0 | 1 | 0 | 0 | 1 | 21 | 14 | 3 | 7 | 5 | 3 | 4 | 5 | 4 | 3 | 1 | 4 | 0 | 1 |
10,433 | ray-project/ray | python/ray/serve/_private/http_util.py | ray.serve._private.http_util.ASGIAppReplicaWrapper | from typing import Any, AsyncGenerator, Awaitable, Callable, List, Optional, Tuple, Type, Union
from uvicorn.config import Config
import inspect
from uvicorn.lifespan.on import LifespanOn
from starlette.types import ASGIApp, Message, Receive, Scope, Send
import logging
from fastapi import FastAPI
class ASGIAppReplicaW... |
class ASGIAppReplicaWrapper:
'''Provides a common wrapper for replicas running an ASGI app.'''
def __init__(self, app_or_func: Union[ASGIApp, Callable]):
pass
@property
def app(self) -> ASGIApp:
pass
@property
def docs_path(self) -> Optional[str]:
pass
async def _r... | 9 | 2 | 8 | 1 | 6 | 2 | 1 | 0.35 | 0 | 2 | 1 | 2 | 5 | 2 | 5 | 5 | 51 | 9 | 31 | 16 | 17 | 11 | 19 | 10 | 11 | 2 | 0 | 2 | 6 |
10,434 | ray-project/ray | python/ray/serve/_private/http_util.py | ray.serve._private.http_util.ASGIArgs | from dataclasses import dataclass
import starlette
from typing import Any, AsyncGenerator, Awaitable, Callable, List, Optional, Tuple, Type, Union
from starlette.types import ASGIApp, Message, Receive, Scope, Send
@dataclass(frozen=True)
class ASGIArgs:
scope: Scope
receive: Receive
send: Send
def to_... | @dataclass(frozen=True)
class ASGIArgs:
def to_args_tuple(self) -> Tuple[Scope, Receive, Send]:
pass
def to_starlette_request(self) -> starlette.requests.Request:
pass | 4 | 0 | 3 | 0 | 3 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 2 | 2 | 12 | 2 | 10 | 3 | 7 | 0 | 8 | 3 | 5 | 1 | 0 | 0 | 2 |
10,435 | ray-project/ray | python/ray/serve/_private/http_util.py | ray.serve._private.http_util.ASGIReceiveProxy | from starlette.types import ASGIApp, Message, Receive, Scope, Send
import asyncio
import pickle
from ray.serve._private.common import RequestMetadata
from typing import Any, AsyncGenerator, Awaitable, Callable, List, Optional, Tuple, Type, Union
class ASGIReceiveProxy:
"""Proxies ASGI receive from an actor.
T... |
class ASGIReceiveProxy:
'''Proxies ASGI receive from an actor.
The `receive_asgi_messages` callback will be called repeatedly to fetch messages
until a disconnect message is received.
'''
def __init__(self, scope: Scope, request_metadata: RequestMetadata, receive_asgi_messages: Callable[[RequestMe... | 7 | 4 | 18 | 2 | 11 | 5 | 3 | 0.52 | 0 | 4 | 1 | 0 | 4 | 5 | 4 | 4 | 82 | 13 | 46 | 19 | 36 | 24 | 35 | 13 | 30 | 6 | 0 | 4 | 12 |
10,436 | ray-project/ray | python/ray/serve/_private/http_util.py | ray.serve._private.http_util.MessageQueue | import asyncio
from starlette.types import ASGIApp, Message, Receive, Scope, Send
from collections import deque
from typing import Any, AsyncGenerator, Awaitable, Callable, List, Optional, Tuple, Type, Union
class MessageQueue(Send):
"""Queue enables polling for received or sent messages.
Implements the ASGI ... |
class MessageQueue(Send):
'''Queue enables polling for received or sent messages.
Implements the ASGI `Send` interface.
This class:
- Is *NOT* thread safe and should only be accessed from a single asyncio
event loop.
- Assumes a single consumer of the queue (concurrent calls to
... | 10 | 7 | 10 | 2 | 5 | 4 | 2 | 0.9 | 1 | 2 | 0 | 0 | 8 | 4 | 8 | 8 | 100 | 24 | 40 | 15 | 31 | 36 | 38 | 15 | 29 | 6 | 1 | 2 | 16 |
10,437 | ray-project/ray | python/ray/serve/_private/http_util.py | ray.serve._private.http_util.RequestIdMiddleware | from starlette.datastructures import MutableHeaders
from starlette.types import ASGIApp, Message, Receive, Scope, Send
from ray.serve._private.utils import call_function_from_import_path, generate_request_id, serve_encoders
from ray.serve._private.constants import RAY_SERVE_HTTP_KEEP_ALIVE_TIMEOUT_S, RAY_SERVE_HTTP_PRO... |
class RequestIdMiddleware:
def __init__(self, app: ASGIApp):
pass
async def __call__(self, scope: Scope, receive: Receive, send: Send):
pass
async def send_with_request_id(message: Message):
pass | 4 | 0 | 9 | 1 | 8 | 0 | 2 | 0 | 0 | 0 | 0 | 0 | 2 | 1 | 2 | 2 | 21 | 3 | 18 | 8 | 14 | 0 | 17 | 8 | 13 | 3 | 0 | 1 | 7 |
10,438 | ray-project/ray | python/ray/serve/_private/http_util.py | ray.serve._private.http_util.Response | class Response:
"""ASGI compliant response class.
It is expected to be called in async context and pass along
`scope, receive, send` as in ASGI spec.
>>> from ray.serve.http_util import Response # doctest: +SKIP
>>> scope, receive = ... # doctest: +SKIP
>>> await Response({"k": "v"}).send(sco... | class Response:
'''ASGI compliant response class.
It is expected to be called in async context and pass along
`scope, receive, send` as in ASGI spec.
>>> from ray.serve.http_util import Response # doctest: +SKIP
>>> scope, receive = ... # doctest: +SKIP
>>> await Response({"k": "v"}).send(scope... | 3 | 2 | 7 | 1 | 4 | 3 | 2 | 1.33 | 0 | 0 | 0 | 0 | 2 | 1 | 2 | 2 | 26 | 5 | 9 | 5 | 6 | 12 | 6 | 5 | 3 | 2 | 0 | 1 | 3 |
10,439 | ray-project/ray | python/ray/serve/_private/local_testing_mode.py | ray.serve._private.local_testing_mode.LocalReplicaResult | from functools import wraps
from ray.serve.exceptions import RequestCancelledError
import concurrent.futures
from ray.serve._private.replica_result import ReplicaResult
import time
import queue
import asyncio
from typing import Any, Callable, Coroutine, Dict, Optional, Tuple, Union
import ray
import inspect
class Loca... |
class LocalReplicaResult(ReplicaResult):
'''ReplicaResult used by in-process Deployment Handles.'''
def __init__(self, future: concurrent.futures.Future, *, request_id: str, is_streaming: bool=False, generator_result_queue: Optional[queue.Queue]=None):
pass
@property
def _asyncio_future(self) ... | 25 | 1 | 8 | 1 | 7 | 0 | 2 | 0.06 | 1 | 9 | 1 | 0 | 12 | 5 | 12 | 41 | 134 | 26 | 102 | 38 | 72 | 6 | 72 | 24 | 56 | 5 | 5 | 3 | 29 |
10,440 | ray-project/ray | python/ray/serve/_private/local_testing_mode.py | ray.serve._private.local_testing_mode.LocalRouter | from ray.serve._private.utils import GENERATOR_COMPOSITION_NOT_SUPPORTED_ERROR
from ray.serve._private.common import DeploymentID, RequestMetadata
import queue
from ray import cloudpickle
from ray.serve._private.router import Router
from ray.serve.handle import DeploymentHandle, DeploymentResponse, DeploymentResponseGe... |
class LocalRouter(Router):
def __init__(self, user_callable_wrapper: UserCallableWrapper, deployment_id: DeploymentID, handle_options: Any):
pass
def running_replicas_populated(self) -> bool:
pass
def _resolve_deployment_responses(self, request_args: Tuple[Any], request_kwargs: Dict[str,... | 8 | 1 | 13 | 1 | 11 | 1 | 1 | 0.1 | 1 | 12 | 6 | 0 | 5 | 2 | 5 | 28 | 87 | 12 | 68 | 26 | 48 | 7 | 30 | 14 | 22 | 3 | 5 | 1 | 10 |
10,441 | ray-project/ray | python/ray/serve/_private/logging_utils.py | ray.serve._private.logging_utils.LoggingContext | class LoggingContext:
"""
Context manager to manage logging behaviors within a particular block, such as:
1) Overriding logging level
Source (python3 official documentation)
https://docs.python.org/3/howto/logging-cookbook.html#using-a-context-manager-for-selective-logging # noqa: E501
"""
... | class LoggingContext:
'''
Context manager to manage logging behaviors within a particular block, such as:
1) Overriding logging level
Source (python3 official documentation)
https://docs.python.org/3/howto/logging-cookbook.html#using-a-context-manager-for-selective-logging # noqa: E501
'''
... | 4 | 1 | 3 | 0 | 3 | 0 | 2 | 0.55 | 0 | 0 | 0 | 0 | 3 | 3 | 3 | 3 | 21 | 4 | 11 | 7 | 7 | 6 | 11 | 7 | 7 | 2 | 0 | 1 | 5 |
10,442 | ray-project/ray | python/ray/serve/_private/logging_utils.py | ray.serve._private.logging_utils.ServeComponentFilter | from typing import Any, Optional
from ray.serve._private.constants import RAY_SERVE_ENABLE_JSON_LOGGING, RAY_SERVE_ENABLE_MEMORY_PROFILING, RAY_SERVE_LOG_TO_STDERR, SERVE_LOG_APPLICATION, SERVE_LOG_COMPONENT, SERVE_LOG_COMPONENT_ID, SERVE_LOG_DEPLOYMENT, SERVE_LOG_LEVEL_NAME, SERVE_LOG_MESSAGE, SERVE_LOG_RECORD_FORMAT,... |
class ServeComponentFilter(logging.Filter):
'''Serve component filter.
The filter will add the component name, id, and type to the log record.
'''
def __init__(self, component_name: str, component_id: str, component_type: Optional[ServeComponentType]=None):
pass
def filter(self, record: l... | 3 | 2 | 12 | 1 | 9 | 2 | 2 | 0.37 | 1 | 4 | 1 | 0 | 2 | 3 | 2 | 4 | 31 | 5 | 19 | 11 | 11 | 7 | 13 | 6 | 10 | 2 | 2 | 1 | 3 |
10,443 | ray-project/ray | python/ray/serve/_private/logging_utils.py | ray.serve._private.logging_utils.ServeContextFilter | from ray.serve._private.constants import RAY_SERVE_ENABLE_JSON_LOGGING, RAY_SERVE_ENABLE_MEMORY_PROFILING, RAY_SERVE_LOG_TO_STDERR, SERVE_LOG_APPLICATION, SERVE_LOG_COMPONENT, SERVE_LOG_COMPONENT_ID, SERVE_LOG_DEPLOYMENT, SERVE_LOG_LEVEL_NAME, SERVE_LOG_MESSAGE, SERVE_LOG_RECORD_FORMAT, SERVE_LOG_REPLICA, SERVE_LOG_REQ... |
class ServeContextFilter(logging.Filter):
'''Serve context filter.
The filter will add the route, request id, app name to the log record.
Note: the filter doesn't do any filtering, it only adds the serve request context
attributes.
'''
def filter(self, record):
pass | 2 | 1 | 9 | 0 | 9 | 0 | 4 | 0.5 | 1 | 0 | 0 | 0 | 1 | 0 | 1 | 3 | 18 | 3 | 10 | 3 | 8 | 5 | 10 | 3 | 8 | 4 | 2 | 1 | 4 |
10,444 | ray-project/ray | python/ray/serve/_private/logging_utils.py | ray.serve._private.logging_utils.ServeFormatter | import logging
from ray.serve._private.constants import RAY_SERVE_ENABLE_JSON_LOGGING, RAY_SERVE_ENABLE_MEMORY_PROFILING, RAY_SERVE_LOG_TO_STDERR, SERVE_LOG_APPLICATION, SERVE_LOG_COMPONENT, SERVE_LOG_COMPONENT_ID, SERVE_LOG_DEPLOYMENT, SERVE_LOG_LEVEL_NAME, SERVE_LOG_MESSAGE, SERVE_LOG_RECORD_FORMAT, SERVE_LOG_REPLICA... |
class ServeFormatter(TextFormatter):
'''Serve Logging Formatter
The formatter will generate the log format on the fly based on the field of record.
Optimized to pre-compute format strings and formatters for better performance.
'''
def __init__(self, component_name: str, component_id: str, fmt: Opt... | 6 | 2 | 15 | 2 | 9 | 4 | 2 | 0.63 | 1 | 2 | 0 | 0 | 2 | 1 | 2 | 9 | 38 | 8 | 19 | 12 | 12 | 12 | 13 | 8 | 10 | 2 | 2 | 1 | 3 |
10,445 | ray-project/ray | python/ray/serve/_private/logging_utils.py | ray.serve._private.logging_utils.ServeLogAttributeRemovalFilter | import logging
from ray.serve._private.constants import RAY_SERVE_ENABLE_JSON_LOGGING, RAY_SERVE_ENABLE_MEMORY_PROFILING, RAY_SERVE_LOG_TO_STDERR, SERVE_LOG_APPLICATION, SERVE_LOG_COMPONENT, SERVE_LOG_COMPONENT_ID, SERVE_LOG_DEPLOYMENT, SERVE_LOG_LEVEL_NAME, SERVE_LOG_MESSAGE, SERVE_LOG_RECORD_FORMAT, SERVE_LOG_REPLICA... |
class ServeLogAttributeRemovalFilter(logging.Filter):
'''Serve log attribute removal filter.
The filter will remove unwanted attributes on the log record so they won't be
included in the structured logs.
Note: the filter doesn't do any filtering, it only removes unwanted attributes.
'''
def fi... | 2 | 1 | 6 | 1 | 5 | 0 | 3 | 0.83 | 1 | 0 | 0 | 0 | 1 | 0 | 1 | 3 | 15 | 4 | 6 | 3 | 4 | 5 | 6 | 3 | 4 | 3 | 2 | 2 | 3 |
10,446 | ray-project/ray | python/ray/serve/_private/logging_utils.py | ray.serve._private.logging_utils.StreamToLogger | from typing import Any, Optional
import traceback
import logging
class StreamToLogger(object):
"""
Fake file-like stream object that redirects writes to a logger instance.
This comes from https://stackoverflow.com/a/36296215 directly.
"""
def __init__(self, logger: logging.Logger, log_level: int,... |
class StreamToLogger(object):
'''
Fake file-like stream object that redirects writes to a logger instance.
This comes from https://stackoverflow.com/a/36296215 directly.
'''
def __init__(self, logger: logging.Logger, log_level: int, original_object: Any):
pass
def __getattr__(self, at... | 8 | 2 | 8 | 0 | 6 | 2 | 2 | 0.35 | 1 | 6 | 0 | 0 | 5 | 4 | 6 | 6 | 62 | 8 | 40 | 16 | 32 | 14 | 27 | 15 | 20 | 3 | 1 | 2 | 11 |
10,447 | ray-project/ray | python/ray/serve/_private/long_poll.py | ray.serve._private.long_poll.LongPollClient | from ray.serve.generated.serve_pb2 import DeploymentTargetInfo, EndpointInfo as EndpointInfoProto, EndpointSet, LongPollRequest, LongPollResult, UpdatedObject as UpdatedObjectProto
from asyncio.events import AbstractEventLoop
from typing import Any, Callable, DefaultDict, Dict, Optional, Set, Tuple, Union
import ray
im... |
class LongPollClient:
'''The asynchronous long polling client.
Args:
host_actor: handle to actor embedding LongPollHost.
key_listeners: a dictionary mapping keys to
callbacks to be called on state update for the corresponding keys.
call_in_event_loop: an asyncio event loop
... | 10 | 6 | 15 | 1 | 9 | 5 | 2 | 0.62 | 0 | 6 | 1 | 0 | 7 | 7 | 7 | 7 | 136 | 19 | 73 | 25 | 57 | 45 | 56 | 18 | 47 | 7 | 0 | 1 | 17 |
10,448 | ray-project/ray | python/ray/serve/_private/long_poll.py | ray.serve._private.long_poll.LongPollHost | import asyncio
from asyncio import sleep
import random
from ray.util import metrics
from collections import defaultdict
from typing import Any, Callable, DefaultDict, Dict, Optional, Set, Tuple, Union
from ray._common.utils import get_or_create_event_loop
from ray.serve.generated.serve_pb2 import DeploymentTargetInfo, ... |
class LongPollHost:
'''The server side object that manages long pulling requests.
The desired use case is to embed this in an Ray actor. Client will be
expected to call actor.listen_for_change.remote(...). On the host side,
you can call host.notify_changed({key: object}) to update the state and
pot... | 12 | 6 | 22 | 1 | 16 | 4 | 3 | 0.34 | 0 | 12 | 3 | 0 | 11 | 5 | 11 | 11 | 261 | 27 | 175 | 57 | 146 | 59 | 107 | 40 | 95 | 11 | 0 | 3 | 37 |
10,449 | ray-project/ray | python/ray/serve/_private/long_poll.py | ray.serve._private.long_poll.LongPollNamespace | from enum import Enum, auto
class LongPollNamespace(Enum):
def __repr__(self):
return f'{self.__class__.__name__}.{self.name}'
DEPLOYMENT_TARGETS = auto()
ROUTE_TABLE = auto()
GLOBAL_LOGGING_CONFIG = auto()
DEPLOYMENT_CONFIG = auto() |
class LongPollNamespace(Enum):
def __repr__(self):
pass | 2 | 0 | 2 | 0 | 2 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 1 | 50 | 8 | 1 | 7 | 6 | 5 | 0 | 7 | 6 | 5 | 1 | 4 | 0 | 1 |
10,450 | ray-project/ray | python/ray/serve/_private/long_poll.py | ray.serve._private.long_poll.LongPollState | from enum import Enum, auto
class LongPollState(Enum):
TIME_OUT = auto() |
class LongPollState(Enum):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 49 | 2 | 0 | 2 | 2 | 1 | 0 | 2 | 2 | 1 | 0 | 4 | 0 | 0 |
10,451 | ray-project/ray | python/ray/serve/_private/long_poll.py | ray.serve._private.long_poll.UpdatedObject | from typing import Any, Callable, DefaultDict, Dict, Optional, Set, Tuple, Union
from dataclasses import dataclass
@dataclass
class UpdatedObject:
object_snapshot: Any
snapshot_id: int | @dataclass
class UpdatedObject:
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0.67 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 | 0 | 3 | 1 | 2 | 2 | 3 | 1 | 2 | 0 | 0 | 0 | 0 |
10,452 | ray-project/ray | python/ray/serve/_private/metrics_utils.py | ray.serve._private.metrics_utils.InMemoryMetricsStore | from collections import defaultdict
import bisect
from typing import Awaitable, Callable, DefaultDict, Dict, Hashable, Iterable, List, Optional, Tuple, Union
from itertools import chain
from ray.serve._private.common import TimeStampedValue
import statistics
class InMemoryMetricsStore:
"""A very simple, in memory ... |
class InMemoryMetricsStore:
'''A very simple, in memory time series database'''
def __init__(self):
pass
def add_metrics_point(self, data_points: Dict[Hashable, float], timestamp: float):
'''Push new data points to the store.
Args:
data_points: dictionary containing th... | 12 | 11 | 15 | 2 | 6 | 7 | 2 | 1.13 | 0 | 4 | 1 | 0 | 6 | 1 | 6 | 6 | 98 | 16 | 39 | 20 | 26 | 44 | 27 | 14 | 20 | 3 | 0 | 2 | 12 |
10,453 | ray-project/ray | python/ray/serve/_private/metrics_utils.py | ray.serve._private.metrics_utils.MetricsPusher | from typing import Awaitable, Callable, DefaultDict, Dict, Hashable, Iterable, List, Optional, Tuple, Union
from ray.serve._private.constants import METRICS_PUSHER_GRACEFUL_SHUTDOWN_TIMEOUT_S, SERVE_LOGGER_NAME
import asyncio
class MetricsPusher:
"""Periodically runs registered asyncio tasks."""
def __init__(... |
class MetricsPusher:
'''Periodically runs registered asyncio tasks.'''
def __init__(self, *, async_sleep: Optional[Callable[[int], None]]=None):
pass
@property
def stop_event(self) -> asyncio.Event:
pass
def start(self):
pass
async def metrics_task(self, name: str):
... | 9 | 4 | 11 | 2 | 8 | 2 | 2 | 0.23 | 0 | 6 | 1 | 0 | 7 | 4 | 7 | 7 | 89 | 19 | 57 | 25 | 39 | 13 | 39 | 14 | 31 | 5 | 0 | 2 | 14 |
10,454 | ray-project/ray | python/ray/serve/_private/metrics_utils.py | ray.serve._private.metrics_utils._MetricsTask | from dataclasses import dataclass
from typing import Awaitable, Callable, DefaultDict, Dict, Hashable, Iterable, List, Optional, Tuple, Union
@dataclass
class _MetricsTask:
task_func: Union[Callable, Callable[[], Awaitable]]
interval_s: float | @dataclass
class _MetricsTask:
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 | 0 | 3 | 1 | 2 | 0 | 3 | 1 | 2 | 0 | 0 | 0 | 0 |
10,455 | ray-project/ray | python/ray/serve/_private/proxy.py | ray.serve._private.proxy.GenericProxy | from ray.serve._private.common import DeploymentID, EndpointInfo, NodeId, ReplicaID, RequestMetadata, RequestProtocol
from typing import Any, Callable, Dict, Generator, Optional, Set, Tuple
import time
import starlette.routing
from ray.serve._private.utils import generate_request_id, get_head_node_id, is_grpc_enabled
f... |
class GenericProxy(ABC):
'''This class is served as the base class for different types of proxies.
It contains all the common setup and methods required for running a proxy.
The proxy subclass need to implement the following methods:
- `protocol()`
- `not_found_response()`
- `routes_respo... | 23 | 11 | 25 | 2 | 19 | 4 | 2 | 0.24 | 1 | 13 | 9 | 2 | 15 | 11 | 15 | 35 | 406 | 50 | 288 | 81 | 234 | 68 | 106 | 44 | 90 | 8 | 4 | 3 | 35 |
10,456 | ray-project/ray | python/ray/serve/_private/proxy.py | ray.serve._private.proxy.HTTPProxy | from starlette.types import Receive
from ray.serve.handle import DeploymentHandle
from ray.serve._private.proxy_request_response import ASGIProxyRequest, HandlerMetadata, ProxyRequest, ResponseGenerator, ResponseHandlerInfo, ResponseStatus, gRPCProxyRequest
from ray.serve._private.proxy_response_generator import ProxyR... |
class HTTPProxy(GenericProxy):
'''This class is meant to be instantiated and run by an ASGI HTTP server.'''
def __init__(self, node_id: NodeId, node_ip_address: str, is_head: bool, proxy_router: ProxyRouter, self_actor_name: str, request_timeout_s: Optional[float]=None, access_log_context: Dict[str, Any]=None... | 13 | 6 | 30 | 2 | 23 | 5 | 5 | 0.23 | 1 | 23 | 13 | 0 | 11 | 3 | 11 | 46 | 346 | 32 | 257 | 83 | 209 | 58 | 128 | 45 | 116 | 22 | 5 | 5 | 50 |
10,457 | ray-project/ray | python/ray/serve/_private/proxy.py | ray.serve._private.proxy.ProxyActor | from ray.serve._private.default_impl import get_proxy_handle
from ray.serve._private.logging_utils import access_log_msg, configure_component_logger, configure_component_memory_profiler, get_component_logger_file_path
from ray.serve._private.constants import HEALTHY_MESSAGE, PROXY_MIN_DRAINING_PERIOD_S, RAY_SERVE_ENABL... | @ray.remote(num_cpus=0)
class ProxyActor(ProxyActorInterface):
def __init__(self, http_options: HTTPOptions, grpc_options: gRPCOptions, *, node_id: NodeId, node_ip_address: str, logging_config: LoggingConfig, long_poll_client: Optional[LongPollClient]=None):
pass
def _update_routes_in_proxies(self, en... | 14 | 8 | 17 | 2 | 12 | 3 | 2 | 0.26 | 0 | 17 | 12 | 0 | 13 | 14 | 13 | 13 | 239 | 37 | 161 | 46 | 137 | 42 | 81 | 35 | 66 | 4 | 0 | 2 | 23 |
10,458 | ray-project/ray | python/ray/serve/_private/proxy.py | ray.serve._private.proxy.gRPCProxy | from ray.serve._private.common import DeploymentID, EndpointInfo, NodeId, ReplicaID, RequestMetadata, RequestProtocol
from ray.serve._private.utils import generate_request_id, get_head_node_id, is_grpc_enabled
import grpc
from ray.serve.handle import DeploymentHandle
from typing import Any, Callable, Dict, Generator, O... |
class gRPCProxy(GenericProxy):
'''This class is meant to be instantiated and run by an gRPC server.
This is the servicer class for the gRPC server. It implements `unary_unary`
as the entry point for unary gRPC request and `unary_stream` as the entry
point for streaming gRPC request.
'''
@proper... | 11 | 4 | 27 | 3 | 20 | 4 | 3 | 0.16 | 1 | 15 | 9 | 0 | 7 | 0 | 7 | 42 | 218 | 26 | 165 | 53 | 129 | 27 | 75 | 27 | 64 | 7 | 5 | 2 | 27 |
10,459 | ray-project/ray | python/ray/serve/_private/proxy_request_response.py | ray.serve._private.proxy_request_response.ASGIProxyRequest | from starlette.types import Receive, Scope, Send
from typing import Any, AsyncIterator, List, Tuple, Union
import pickle
from ray.serve._private.common import StreamingHTTPRequest, gRPCRequest
class ASGIProxyRequest(ProxyRequest):
"""ProxyRequest implementation to wrap ASGI scope, receive, and send."""
def __... |
class ASGIProxyRequest(ProxyRequest):
'''ProxyRequest implementation to wrap ASGI scope, receive, and send.'''
def __init__(self, scope: Scope, receive: Receive, send: Send):
pass
@property
def request_type(self) -> str:
pass
@property
def method(self) -> str:
pass
... | 23 | 1 | 3 | 0 | 3 | 0 | 1 | 0.09 | 1 | 4 | 1 | 0 | 13 | 3 | 13 | 38 | 60 | 13 | 43 | 26 | 20 | 4 | 29 | 17 | 15 | 1 | 5 | 0 | 13 |
10,460 | ray-project/ray | python/ray/serve/_private/proxy_request_response.py | ray.serve._private.proxy_request_response.HandlerMetadata | from dataclasses import dataclass
@dataclass(frozen=True)
class HandlerMetadata:
application_name: str = ''
deployment_name: str = ''
route: str = '' | @dataclass(frozen=True)
class HandlerMetadata:
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 | 0 | 4 | 4 | 3 | 0 | 4 | 4 | 3 | 0 | 0 | 0 | 0 |
10,461 | ray-project/ray | python/ray/serve/_private/proxy_request_response.py | ray.serve._private.proxy_request_response.ProxyRequest | from abc import ABC, abstractmethod
class ProxyRequest(ABC):
"""Base ProxyRequest class to use in the common interface among proxies"""
@property
@abstractmethod
def request_type(self) -> str:
raise NotImplementedError
@property
@abstractmethod
def method(self) -> str:
rai... |
class ProxyRequest(ABC):
'''Base ProxyRequest class to use in the common interface among proxies'''
@property
@abstractmethod
def request_type(self) -> str:
pass
@property
@abstractmethod
def method(self) -> str:
pass
@property
@abstractmethod
def route_path(self... | 16 | 1 | 2 | 0 | 2 | 0 | 1 | 0.05 | 1 | 3 | 0 | 3 | 5 | 0 | 5 | 25 | 27 | 5 | 21 | 11 | 5 | 1 | 11 | 6 | 5 | 1 | 4 | 0 | 5 |
10,462 | ray-project/ray | python/ray/serve/_private/proxy_request_response.py | ray.serve._private.proxy_request_response.ResponseHandlerInfo | from dataclasses import dataclass
@dataclass(frozen=True)
class ResponseHandlerInfo:
response_generator: ResponseGenerator
metadata: HandlerMetadata
should_record_access_log: bool
should_increment_ongoing_requests: bool | @dataclass(frozen=True)
class ResponseHandlerInfo:
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 | 0 | 5 | 1 | 4 | 0 | 5 | 1 | 4 | 0 | 0 | 0 | 0 |
10,463 | ray-project/ray | python/ray/serve/_private/proxy_request_response.py | ray.serve._private.proxy_request_response.ResponseStatus | from typing import Any, AsyncIterator, List, Tuple, Union
import grpc
from dataclasses import dataclass
@dataclass(frozen=True)
class ResponseStatus:
code: Union[str, grpc.StatusCode]
is_error: bool = False
message: str = '' | @dataclass(frozen=True)
class ResponseStatus:
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 | 0 | 4 | 3 | 3 | 1 | 4 | 3 | 3 | 0 | 0 | 0 | 0 |
10,464 | ray-project/ray | python/ray/serve/_private/proxy_request_response.py | ray.serve._private.proxy_request_response.gRPCProxyRequest | import pickle
from ray.serve._private.common import StreamingHTTPRequest, gRPCRequest
from ray.serve._private.utils import DEFAULT
from ray.serve.grpc_util import RayServegRPCContext
import grpc
from typing import Any, AsyncIterator, List, Tuple, Union
class gRPCProxyRequest(ProxyRequest):
"""ProxyRequest implemen... |
class gRPCProxyRequest(ProxyRequest):
'''ProxyRequest implementation to wrap gRPC request protobuf and metadata.'''
def __init__(self, request_proto: Any, context: grpc._cython.cygrpc._ServicerContext, service_method: str, stream: bool):
pass
def setup_variables(self):
pass
@property
... | 15 | 1 | 5 | 0 | 5 | 1 | 2 | 0.17 | 1 | 7 | 3 | 0 | 9 | 9 | 9 | 34 | 65 | 9 | 48 | 32 | 27 | 8 | 35 | 21 | 25 | 6 | 5 | 3 | 14 |
10,465 | ray-project/ray | python/ray/serve/_private/proxy_response_generator.py | ray.serve._private.proxy_response_generator.ProxyResponseGenerator | from ray.serve.handle import DeploymentResponse, DeploymentResponseGenerator
from typing import Any, Callable, Optional, Union
import time
from ray.serve._private.utils import calculate_remaining_timeout
from asyncio.tasks import FIRST_COMPLETED
import asyncio
class ProxyResponseGenerator(_ProxyResponseGeneratorBase):... |
class ProxyResponseGenerator(_ProxyResponseGeneratorBase):
'''Wraps a unary DeploymentResponse or streaming DeploymentResponseGenerator.
In the case of a unary DeploymentResponse, __anext__ will only ever return one
result.
'''
def __init__(self, response: Union[DeploymentResponse, DeploymentRespo... | 8 | 1 | 13 | 1 | 12 | 1 | 3 | 0.11 | 1 | 8 | 2 | 0 | 7 | 5 | 7 | 31 | 105 | 14 | 82 | 28 | 67 | 9 | 56 | 17 | 48 | 7 | 5 | 2 | 19 |
10,466 | ray-project/ray | python/ray/serve/_private/proxy_response_generator.py | ray.serve._private.proxy_response_generator._ProxyResponseGeneratorBase | import time
from abc import ABC, abstractmethod
from typing import Any, Callable, Optional, Union
import asyncio
class _ProxyResponseGeneratorBase(ABC):
def __init__(self, *, timeout_s: Optional[float]=None, disconnected_task: Optional[asyncio.Task]=None, result_callback: Optional[Callable[[Any], Any]]=None):
... |
class _ProxyResponseGeneratorBase(ABC):
def __init__(self, *, timeout_s: Optional[float]=None, disconnected_task: Optional[asyncio.Task]=None, result_callback: Optional[Callable[[Any], Any]]=None):
'''Implements a generator wrapping a deployment response.
Args:
- timeout_s: an end-to-e... | 6 | 3 | 9 | 1 | 4 | 5 | 1 | 0.95 | 1 | 2 | 0 | 1 | 4 | 4 | 4 | 24 | 42 | 5 | 19 | 16 | 7 | 18 | 12 | 9 | 7 | 1 | 4 | 0 | 4 |
10,467 | ray-project/ray | python/ray/serve/_private/proxy_router.py | ray.serve._private.proxy_router.ProxyRouter | from ray.serve.handle import DeploymentHandle
from typing import Callable, Dict, List, Optional, Tuple
from ray.serve._private.common import ApplicationName, DeploymentID, EndpointInfo
class ProxyRouter:
"""Router interface for the proxy to use."""
def __init__(self, get_handle: Callable[[str, str], Deploymen... |
class ProxyRouter:
'''Router interface for the proxy to use.'''
def __init__(self, get_handle: Callable[[str, str], DeploymentHandle]):
pass
def ready_for_traffic(self, is_head: bool) -> Tuple[bool, str]:
'''Whether the proxy router is ready to serve traffic.
The first return valu... | 6 | 4 | 29 | 3 | 16 | 10 | 4 | 0.63 | 0 | 8 | 3 | 1 | 5 | 7 | 5 | 5 | 152 | 22 | 80 | 31 | 67 | 50 | 58 | 24 | 52 | 6 | 0 | 3 | 21 |
10,468 | ray-project/ray | python/ray/serve/_private/proxy_state.py | ray.serve._private.proxy_state.ActorProxyWrapper | from ray.serve.config import DeploymentMode, HTTPOptions, gRPCOptions
from typing import Dict, List, Optional, Set, Tuple, Type
from ray._common.network_utils import build_address
from ray.exceptions import GetTimeoutError, RayActorError
from ray.util.scheduling_strategies import NodeAffinitySchedulingStrategy
import j... |
class ActorProxyWrapper(ProxyWrapper):
def __init__(self, logging_config: LoggingConfig, actor_handle: Optional[ActorHandle]=None, http_options: Optional[HTTPOptions]=None, grpc_options: Optional[gRPCOptions]=None, name: Optional[str]=None, node_id: Optional[str]=None, node_ip_address: Optional[str]=None, port: O... | 14 | 6 | 20 | 2 | 16 | 2 | 3 | 0.15 | 1 | 14 | 7 | 0 | 9 | 8 | 10 | 37 | 211 | 26 | 161 | 47 | 127 | 24 | 81 | 24 | 70 | 5 | 5 | 2 | 26 |
10,469 | ray-project/ray | python/ray/serve/_private/proxy_state.py | ray.serve._private.proxy_state.ProxyState | from ray.serve.schema import LoggingConfig, ProxyDetails, ProxyStatus, Target
from ray.actor import ActorHandle
from ray.serve._private.utils import Timer, TimerBase, format_actor_name, is_grpc_enabled
from ray.serve._private.constants import ASYNC_CONCURRENCY, PROXY_DRAIN_CHECK_PERIOD_S, PROXY_HEALTH_CHECK_PERIOD_S, P... | null | 21 | 5 | 14 | 1 | 11 | 3 | 2 | 0.23 | 0 | 11 | 6 | 0 | 14 | 11 | 14 | 14 | 220 | 30 | 154 | 48 | 125 | 36 | 93 | 33 | 78 | 16 | 0 | 6 | 33 |
10,470 | ray-project/ray | python/ray/serve/_private/proxy_state.py | ray.serve._private.proxy_state.ProxyStateManager | from ray.serve.schema import LoggingConfig, ProxyDetails, ProxyStatus, Target
from ray.serve._private.common import NodeId, RequestProtocol
from ray.serve.config import DeploymentMode, HTTPOptions, gRPCOptions
from ray.serve._private.constants import ASYNC_CONCURRENCY, PROXY_DRAIN_CHECK_PERIOD_S, PROXY_HEALTH_CHECK_PER... |
class ProxyStateManager:
'''Manages all state for proxies in the system.
This class is *not* thread safe, so any state-modifying methods should be
called with a lock held.
'''
def __init__(self, http_options: HTTPOptions, head_node_id: str, cluster_node_info_cache: ClusterNodeInfoCache, logging_co... | 18 | 8 | 13 | 1 | 10 | 1 | 2 | 0.15 | 0 | 19 | 14 | 0 | 16 | 10 | 16 | 16 | 226 | 38 | 163 | 58 | 131 | 25 | 90 | 43 | 73 | 6 | 0 | 2 | 31 |
10,471 | ray-project/ray | python/ray/serve/_private/proxy_state.py | ray.serve._private.proxy_state.ProxyWrapper | from typing import Dict, List, Optional, Set, Tuple, Type
from abc import ABC, abstractmethod
class ProxyWrapper(ABC):
@property
@abstractmethod
def actor_id(self) -> str:
"""Return the actor id of the proxy actor."""
raise NotImplementedError
@abstractmethod
def is_ready(self, ti... |
class ProxyWrapper(ABC):
@property
@abstractmethod
def actor_id(self) -> str:
'''Return the actor id of the proxy actor.'''
pass
@abstractmethod
def is_ready(self, timeout_s: float) -> Optional[bool]:
'''Return whether proxy is ready to be serving requests.
Since ac... | 16 | 7 | 6 | 0 | 2 | 4 | 1 | 1.13 | 1 | 4 | 0 | 2 | 7 | 0 | 7 | 27 | 58 | 9 | 23 | 15 | 7 | 26 | 15 | 8 | 7 | 1 | 4 | 0 | 7 |
10,472 | ray-project/ray | python/ray/serve/_private/replica.py | ray.serve._private.replica.Replica | import asyncio
from ray.serve._private.common import RUNNING_REQUESTS_KEY, DeploymentID, ReplicaID, ReplicaMetricReport, ReplicaQueueLengthInfo, RequestMetadata, ServeComponentType, StreamingHTTPRequest, gRPCRequest
from contextlib import asynccontextmanager, contextmanager
import time
import ray
from typing import Any... |
class Replica(ReplicaBase):
async def _on_initialized(self):
pass
def _on_request_cancelled(self, metadata: RequestMetadata, e: asyncio.CancelledError):
'''Recursively cancels child requests.'''
pass
def _on_request_failed(self, request_metadata: RequestMetadata, e: Exception):
... | 6 | 2 | 13 | 1 | 10 | 2 | 2 | 0.2 | 1 | 3 | 1 | 0 | 4 | 1 | 4 | 45 | 55 | 6 | 41 | 14 | 31 | 8 | 17 | 8 | 12 | 2 | 5 | 1 | 7 |
10,473 | ray-project/ray | python/ray/serve/_private/replica.py | ray.serve._private.replica.ReplicaActor | import os
from ray.serve._private.common import RUNNING_REQUESTS_KEY, DeploymentID, ReplicaID, ReplicaMetricReport, ReplicaQueueLengthInfo, RequestMetadata, ServeComponentType, StreamingHTTPRequest, gRPCRequest
from ray.serve._private.config import DeploymentConfig
from ray.serve._private.logging_utils import access_lo... |
class ReplicaActor:
'''Actor definition for replicas of Ray Serve deployments.
This class defines the interface that the controller and deployment handles
(i.e., from proxies and other replicas) use to interact with a replica.
All interaction with the user-provided callable is done via the
`UserCal... | 15 | 7 | 14 | 1 | 10 | 3 | 2 | 0.3 | 0 | 10 | 5 | 0 | 14 | 1 | 14 | 14 | 218 | 33 | 142 | 68 | 87 | 43 | 62 | 29 | 45 | 4 | 0 | 3 | 23 |
10,474 | ray-project/ray | python/ray/serve/_private/replica.py | ray.serve._private.replica.ReplicaBase | from ray.serve._private.logging_utils import access_log_msg, configure_component_logger, configure_component_memory_profiler, get_component_logger_file_path
from ray.serve._private.common import RUNNING_REQUESTS_KEY, DeploymentID, ReplicaID, ReplicaMetricReport, ReplicaQueueLengthInfo, RequestMetadata, ServeComponentTy... |
class ReplicaBase(ABC):
def __init__(self, replica_id: ReplicaID, deployment_def: Callable, init_args: Tuple, init_kwargs: Dict, deployment_config: DeploymentConfig, version: DeploymentVersion, ingress: bool, route_prefix: str, rank: int):
pass
@property
def max_ongoing_requests(self) -> int:
... | 36 | 3 | 21 | 2 | 17 | 3 | 3 | 0.15 | 1 | 19 | 9 | 1 | 21 | 19 | 21 | 41 | 510 | 62 | 390 | 114 | 325 | 59 | 201 | 71 | 176 | 11 | 4 | 6 | 62 |
10,475 | ray-project/ray | python/ray/serve/_private/replica.py | ray.serve._private.replica.ReplicaMetricsManager | from ray.serve import metrics
import time
from ray.serve._private.metrics_utils import InMemoryMetricsStore, MetricsPusher
from collections import defaultdict, deque
import ray
from typing import Any, AsyncGenerator, Callable, Dict, Generator, Optional, Tuple, Union
import concurrent.futures
from ray.serve.config impor... |
class ReplicaMetricsManager:
'''Manages metrics for the replica.
A variety of metrics are managed:
- Fine-grained metrics are set for every request.
- Autoscaling statistics are periodically pushed to the controller.
- Queue length metrics are periodically recorded as user-facing gauges... | 16 | 8 | 16 | 2 | 13 | 1 | 2 | 0.12 | 0 | 13 | 7 | 0 | 11 | 16 | 11 | 11 | 194 | 30 | 146 | 42 | 129 | 18 | 86 | 37 | 74 | 5 | 0 | 2 | 27 |
10,476 | ray-project/ray | python/ray/serve/_private/replica.py | ray.serve._private.replica.UserCallableWrapper | import inspect
from fastapi import Request
import functools
import threading
from typing import Any, AsyncGenerator, Callable, Dict, Generator, Optional, Tuple, Union
from anyio import to_thread
from ray.serve._private.http_util import ASGIAppReplicaWrapper, ASGIArgs, ASGIReceiveProxy, MessageQueue, Response
import con... |
class UserCallableWrapper:
'''Wraps a user-provided callable that is used to handle requests to a replica.'''
def __init__(self, deployment_def: Callable, init_args: Tuple, init_kwargs: Dict, *, deployment_id: DeploymentID, run_sync_methods_in_threadpool: bool, run_user_code_in_separate_thread: bool, local_te... | 51 | 12 | 26 | 3 | 19 | 5 | 3 | 0.26 | 0 | 27 | 12 | 0 | 17 | 13 | 17 | 17 | 576 | 77 | 396 | 123 | 316 | 103 | 184 | 64 | 161 | 12 | 0 | 3 | 75 |
10,477 | ray-project/ray | python/ray/serve/_private/replica.py | ray.serve._private.replica.UserMethodInfo | from dataclasses import dataclass
from ray.serve._private.constants import GRPC_CONTEXT_ARG_NAME, HEALTH_CHECK_METHOD, RAY_SERVE_COLLECT_AUTOSCALING_METRICS_ON_HANDLE, RAY_SERVE_METRICS_EXPORT_INTERVAL_MS, RAY_SERVE_RECORD_AUTOSCALING_STATS_TIMEOUT_S, RAY_SERVE_REPLICA_AUTOSCALING_METRIC_RECORD_INTERVAL_S, RAY_SERVE_RE... | @dataclass
class UserMethodInfo:
'''Wrapper for a user method and its relevant metadata.'''
@classmethod
def from_callable(cls, c: Callable, *, is_asgi_app: bool) -> 'UserMethodInfo':
pass | 4 | 1 | 9 | 0 | 9 | 0 | 1 | 0.06 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 1 | 19 | 2 | 16 | 4 | 13 | 1 | 9 | 3 | 7 | 1 | 0 | 0 | 1 |
10,478 | ray-project/ray | python/ray/serve/_private/replica_result.py | ray.serve._private.replica_result.ActorReplicaResult | from ray.serve.exceptions import RequestCancelledError
import threading
from ray.serve._private.utils import calculate_remaining_timeout, generate_request_id
import pickle
from typing import Callable, Coroutine, Optional, Union
import asyncio
import ray
import time
import inspect
from ray.serve._private.common import R... |
class ActorReplicaResult(ReplicaResult):
def __init__(self, obj_ref_or_gen: Union[ray.ObjectRef, ray.ObjectRefGenerator], metadata: RequestMetadata, *, with_rejection: bool=False):
pass
@property
def _object_ref_or_gen_asyncio_lock(self) -> asyncio.Lock:
'''Lazy `asyncio.Lock` object.'''
... | 24 | 2 | 10 | 1 | 8 | 1 | 2 | 0.08 | 1 | 6 | 2 | 0 | 11 | 5 | 11 | 40 | 135 | 24 | 103 | 35 | 79 | 8 | 69 | 25 | 55 | 3 | 5 | 3 | 23 |
10,479 | ray-project/ray | python/ray/serve/_private/replica_result.py | ray.serve._private.replica_result.ReplicaResult | from abc import ABC, abstractmethod
from ray.serve._private.common import ReplicaQueueLengthInfo, RequestMetadata
import ray
from typing import Callable, Coroutine, Optional, Union
class ReplicaResult(ABC):
@abstractmethod
async def get_rejection_response(self) -> Optional[ReplicaQueueLengthInfo]:
rai... |
class ReplicaResult(ABC):
@abstractmethod
async def get_rejection_response(self) -> Optional[ReplicaQueueLengthInfo]:
pass
@abstractmethod
async def get_rejection_response(self) -> Optional[ReplicaQueueLengthInfo]:
pass
@abstractmethod
async def get_async(self):
pass
@abstractm... | 21 | 0 | 2 | 0 | 2 | 0 | 1 | 0.07 | 1 | 2 | 0 | 3 | 9 | 0 | 9 | 29 | 38 | 8 | 28 | 19 | 9 | 2 | 19 | 10 | 9 | 1 | 4 | 0 | 9 |
10,480 | ray-project/ray | python/ray/serve/_private/router.py | ray.serve._private.router.AsyncioRouter | from ray.serve._private.utils import generate_request_id, resolve_deployment_response
from functools import lru_cache, partial
from ray.serve._private.usage import ServeUsageTag
import asyncio
from ray.serve._private.constants import RAY_SERVE_COLLECT_AUTOSCALING_METRICS_ON_HANDLE, RAY_SERVE_HANDLE_AUTOSCALING_METRIC_P... |
class AsyncioRouter:
def __init__(self, controller_handle: ActorHandle, deployment_id: DeploymentID, handle_id: str, self_actor_id: str, handle_source: DeploymentHandleSource, event_loop: asyncio.BaseEventLoop, enable_strict_max_ongoing_requests: bool, node_id: str, availability_zone: Optional[str], prefer_local_... | 13 | 5 | 33 | 3 | 23 | 7 | 3 | 0.29 | 0 | 24 | 18 | 0 | 9 | 9 | 9 | 9 | 308 | 35 | 212 | 70 | 173 | 61 | 102 | 41 | 92 | 8 | 0 | 3 | 31 |
10,481 | ray-project/ray | python/ray/serve/_private/router.py | ray.serve._private.router.Router | from ray.serve._private.common import RUNNING_REQUESTS_KEY, DeploymentHandleSource, DeploymentID, DeploymentTargetInfo, HandleMetricReport, ReplicaID, RequestMetadata, RunningReplicaInfo
from abc import ABC, abstractmethod
from ray.serve._private.replica_result import ReplicaResult
import concurrent.futures
class Rout... |
class Router(ABC):
@abstractmethod
def running_replicas_populated(self) -> bool:
pass
@abstractmethod
def assign_request(self, request_meta: RequestMetadata, *request_args, **request_kwargs) -> concurrent.futures.Future[ReplicaResult]:
pass
@abstractmethod
def shutdown(self) ->... | 7 | 0 | 4 | 0 | 4 | 0 | 1 | 0 | 1 | 4 | 2 | 2 | 3 | 0 | 3 | 23 | 17 | 2 | 15 | 12 | 3 | 0 | 7 | 4 | 3 | 1 | 4 | 0 | 3 |
10,482 | ray-project/ray | python/ray/serve/_private/router.py | ray.serve._private.router.RouterMetricsManager | from ray.serve._private.metrics_utils import QUEUED_REQUESTS_KEY, InMemoryMetricsStore, MetricsPusher, TimeStampedValue
from ray.util import metrics
from contextlib import contextmanager
from typing import Any, Callable, Coroutine, DefaultDict, Dict, List, Optional, Union
from ray.serve._private.config import Deploymen... |
class RouterMetricsManager:
'''Manages metrics for the router.'''
def __init__(self, deployment_id: DeploymentID, handle_id: str, self_actor_id: str, handle_source: DeploymentHandleSource, controller_handle: ActorHandle, router_requests_counter: metrics.Counter, queued_requests_gauge: metrics.Gauge, running_r... | 23 | 7 | 17 | 1 | 13 | 3 | 2 | 0.21 | 0 | 15 | 11 | 0 | 15 | 15 | 15 | 15 | 271 | 37 | 194 | 56 | 164 | 41 | 94 | 41 | 78 | 6 | 0 | 2 | 26 |
10,483 | ray-project/ray | python/ray/serve/_private/router.py | ray.serve._private.router.SharedRouterLongPollClient | from ray.serve._private.common import RUNNING_REQUESTS_KEY, DeploymentHandleSource, DeploymentID, DeploymentTargetInfo, HandleMetricReport, ReplicaID, RequestMetadata, RunningReplicaInfo
from ray.serve._private.config import DeploymentConfig
from collections import defaultdict
from collections.abc import MutableMapping... |
class SharedRouterLongPollClient:
def __init__(self, controller_handle: ActorHandle, event_loop: AbstractEventLoop):
pass
@classmethod
@lru_cache(maxsize=None)
def get_or_create(cls, controller_handle: ActorHandle, event_loop: AbstractEventLoop) -> 'SharedRouterLongPollClient':
pass
... | 9 | 0 | 12 | 1 | 9 | 2 | 2 | 0.18 | 0 | 11 | 6 | 0 | 4 | 3 | 5 | 5 | 67 | 8 | 50 | 23 | 34 | 9 | 24 | 14 | 18 | 3 | 0 | 2 | 9 |
10,484 | ray-project/ray | python/ray/serve/_private/router.py | ray.serve._private.router.SingletonThreadRouter | from typing import Any, Callable, Coroutine, DefaultDict, Dict, List, Optional, Union
import asyncio
from asyncio import AbstractEventLoop, ensure_future, futures
from ray.serve._private.common import RUNNING_REQUESTS_KEY, DeploymentHandleSource, DeploymentID, DeploymentTargetInfo, HandleMetricReport, ReplicaID, Reques... | null | 9 | 4 | 8 | 1 | 7 | 1 | 1 | 0.23 | 1 | 6 | 3 | 0 | 4 | 1 | 5 | 28 | 59 | 11 | 39 | 16 | 27 | 9 | 19 | 10 | 13 | 2 | 5 | 2 | 6 |
10,485 | ray-project/ray | python/ray/serve/_private/storage/kv_store.py | ray.serve._private.storage.kv_store.KVStoreError | class KVStoreError(Exception):
def __init__(self, rpc_code):
self.rpc_code = rpc_code | class KVStoreError(Exception):
def __init__(self, rpc_code):
pass | 2 | 0 | 2 | 0 | 2 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 1 | 11 | 3 | 0 | 3 | 3 | 1 | 0 | 3 | 3 | 1 | 1 | 3 | 0 | 1 |
10,486 | ray-project/ray | python/ray/serve/_private/storage/kv_store.py | ray.serve._private.storage.kv_store.RayInternalKVStore | from typing import Optional
from ray.serve._private.storage.kv_store_base import KVStoreBase
import ray
import ray.serve._private.constants as serve_constants
from ray._raylet import GcsClient
class RayInternalKVStore(KVStoreBase):
"""Wraps ray's internal_kv with a namespace to avoid collisions.
Supports stri... |
class RayInternalKVStore(KVStoreBase):
'''Wraps ray's internal_kv with a namespace to avoid collisions.
Supports string keys and bytes values, caller must handle serialization.
'''
def __init__(self, namespace: Optional[str]=None, gcs_client: Optional[GcsClient]=None):
pass
def get_storag... | 6 | 4 | 15 | 2 | 11 | 3 | 3 | 0.33 | 1 | 5 | 1 | 0 | 5 | 3 | 5 | 29 | 86 | 14 | 54 | 16 | 44 | 18 | 34 | 9 | 28 | 4 | 4 | 1 | 14 |
10,487 | ray-project/ray | python/ray/serve/_private/storage/kv_store_base.py | ray.serve._private.storage.kv_store_base.KVStoreBase | import abc
from typing import Optional
from ray.util.annotations import DeveloperAPI
from abc import abstractmethod
@DeveloperAPI
class KVStoreBase(metaclass=abc.ABCMeta):
"""Abstract class for KVStore defining APIs needed for ray serve
use cases, currently (8/6/2021) controller state checkpointing.
"""
... | @DeveloperAPI
class KVStoreBase(metaclass=abc.ABCMeta):
'''Abstract class for KVStore defining APIs needed for ray serve
use cases, currently (8/6/2021) controller state checkpointing.
'''
@abstractmethod
def get_storage_key(self, key: str) -> str:
'''Get internal key for storage.
Ar... | 10 | 5 | 9 | 2 | 2 | 6 | 1 | 1.92 | 1 | 4 | 0 | 1 | 4 | 0 | 4 | 24 | 48 | 10 | 13 | 9 | 4 | 25 | 9 | 5 | 4 | 1 | 3 | 0 | 4 |
10,488 | ray-project/ray | python/ray/serve/_private/usage.py | ray.serve._private.usage.ServeUsageTag | from enum import Enum
from ray._common.usage.usage_lib import TagKey, record_extra_usage_tag
from typing import Dict, Optional
class ServeUsageTag(Enum):
API_VERSION = TagKey.SERVE_API_VERSION
NUM_DEPLOYMENTS = TagKey.SERVE_NUM_DEPLOYMENTS
GCS_STORAGE = TagKey.GCS_STORAGE
NUM_GPU_DEPLOYMENTS = TagKey.S... |
class ServeUsageTag(Enum):
def record(self, value: str):
'''Record telemetry value.'''
pass
def get_value_from_report(self, report: Dict) -> Optional[str]:
'''Returns `None` if the tag isn't in the report.'''
pass | 3 | 2 | 5 | 1 | 3 | 1 | 2 | 0.05 | 1 | 1 | 0 | 0 | 2 | 0 | 2 | 51 | 43 | 3 | 38 | 28 | 35 | 2 | 32 | 28 | 29 | 2 | 4 | 1 | 3 |
10,489 | ray-project/ray | python/ray/serve/_private/utils.py | ray.serve._private.utils.DEFAULT | from enum import Enum
class DEFAULT(Enum):
VALUE = 1 |
class DEFAULT(Enum):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 49 | 2 | 0 | 2 | 2 | 1 | 0 | 2 | 2 | 1 | 0 | 4 | 0 | 0 |
10,490 | ray-project/ray | python/ray/serve/_private/utils.py | ray.serve._private.utils.DeploymentOptionUpdateType | from enum import Enum
class DeploymentOptionUpdateType(str, Enum):
LightWeight = 'LightWeight'
NeedsReconfigure = 'NeedsReconfigure'
NeedsActorReconfigure = 'NeedsActorReconfigure'
HeavyWeight = 'HeavyWeight' |
class DeploymentOptionUpdateType(str, Enum):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1.2 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 115 | 11 | 0 | 5 | 5 | 4 | 6 | 5 | 5 | 4 | 0 | 4 | 0 | 0 |
10,491 | ray-project/ray | python/ray/serve/_private/utils.py | ray.serve._private.utils.JavaActorHandleProxy | from ray.actor import ActorHandle
class JavaActorHandleProxy:
"""Wraps actor handle and translate snake_case to camelCase."""
def __init__(self, handle: ActorHandle):
self.handle = handle
self._available_attrs = set(dir(self.handle))
def __getattr__(self, key: str):
if key in self... |
class JavaActorHandleProxy:
'''Wraps actor handle and translate snake_case to camelCase.'''
def __init__(self, handle: ActorHandle):
pass
def __getattr__(self, key: str):
pass | 3 | 1 | 5 | 0 | 5 | 0 | 2 | 0.09 | 0 | 3 | 1 | 0 | 2 | 2 | 2 | 2 | 14 | 2 | 11 | 7 | 8 | 1 | 10 | 7 | 7 | 2 | 0 | 1 | 3 |
10,492 | ray-project/ray | python/ray/serve/_private/utils.py | ray.serve._private.utils.Timer | import time
class Timer(TimerBase):
def time(self) -> float:
return time.time() |
class Timer(TimerBase):
def time(self) -> float:
pass | 2 | 0 | 2 | 0 | 2 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 22 | 3 | 0 | 3 | 2 | 1 | 0 | 3 | 2 | 1 | 1 | 5 | 0 | 1 |
10,493 | ray-project/ray | python/ray/serve/_private/utils.py | ray.serve._private.utils.TimerBase | from abc import ABC, abstractmethod
class TimerBase(ABC):
@abstractmethod
def time(self) -> float:
"""Return the current time."""
raise NotImplementedError |
class TimerBase(ABC):
@abstractmethod
def time(self) -> float:
'''Return the current time.'''
pass | 3 | 1 | 3 | 0 | 2 | 1 | 1 | 0.25 | 1 | 2 | 0 | 2 | 1 | 0 | 1 | 21 | 5 | 0 | 4 | 3 | 1 | 1 | 3 | 2 | 1 | 1 | 4 | 0 | 1 |
10,494 | ray-project/ray | python/ray/serve/_private/utils.py | ray.serve._private.utils._ServeCustomEncoders | class _ServeCustomEncoders:
"""Group of custom encoders for common types that's not handled by FastAPI."""
@staticmethod
def encode_np_array(obj):
assert isinstance(obj, np.ndarray)
if obj.dtype.kind == 'f':
obj = obj.astype(float)
if obj.dtype.kind in {'i', 'u'}:
... | class _ServeCustomEncoders:
'''Group of custom encoders for common types that's not handled by FastAPI.'''
@staticmethod
def encode_np_array(obj):
pass
@staticmethod
def encode_np_scaler(obj):
pass
@staticmethod
def encode_exception(obj):
pass
@staticmethod
de... | 9 | 1 | 4 | 0 | 4 | 1 | 2 | 0.14 | 0 | 4 | 0 | 0 | 0 | 0 | 4 | 4 | 26 | 4 | 21 | 9 | 12 | 3 | 17 | 5 | 12 | 3 | 0 | 1 | 6 |
10,495 | ray-project/ray | python/ray/serve/_private/version.py | ray.serve._private.version.DeploymentVersion | from ray.serve._private.config import DeploymentConfig
from zlib import crc32
from ray._common.pydantic_compat import BaseModel
from copy import deepcopy
from typing import Any, Dict, List, Optional
from ray.serve.generated.serve_pb2 import DeploymentVersion as DeploymentVersionProto
from ray.serve.config import Autosc... |
class DeploymentVersion:
def __init__(self, code_version: Optional[str], deployment_config: DeploymentConfig, ray_actor_options: Optional[Dict], placement_group_bundles: Optional[List[Dict[str, float]]]=None, placement_group_strategy: Optional[str]=None, max_replicas_per_node: Optional[int]=None, route_prefix: Op... | 14 | 4 | 15 | 0 | 12 | 2 | 3 | 0.19 | 0 | 10 | 2 | 0 | 9 | 10 | 11 | 11 | 181 | 15 | 139 | 42 | 115 | 27 | 60 | 30 | 48 | 7 | 0 | 3 | 28 |
10,496 | ray-project/ray | python/ray/serve/batching.py | ray.serve.batching._AsyncBatchingMethod | from typing import Any, AsyncGenerator, Callable, Coroutine, Dict, Generic, Iterable, List, Literal, Optional, Protocol, Set, Tuple, TypeVar, overload
class _AsyncBatchingMethod(Protocol, Generic[SelfType, T, R]):
async def __call__(self, self_: SelfType, __batch: List[T], /) -> List[R]:
... |
class _AsyncBatchingMethod(Protocol, Generic[SelfType, T, R]):
async def __call__(self, self_: SelfType, __batch: List[T], /) -> List[R]:
pass | 2 | 0 | 2 | 0 | 2 | 0 | 1 | 0 | 2 | 0 | 0 | 0 | 1 | 0 | 1 | 25 | 3 | 0 | 3 | 2 | 1 | 0 | 3 | 2 | 1 | 1 | 5 | 0 | 1 |
10,497 | ray-project/ray | python/ray/serve/batching.py | ray.serve.batching._BatchDecorator | from typing import Any, AsyncGenerator, Callable, Coroutine, Dict, Generic, Iterable, List, Literal, Optional, Protocol, Set, Tuple, TypeVar, overload
class _BatchDecorator(Protocol):
"""Descibes behaviour of decorator produced by calling `batch` with arguments"""
@overload
def __call__(self, _sync_func: ... |
class _BatchDecorator(Protocol):
'''Descibes behaviour of decorator produced by calling `batch` with arguments'''
@overload
def __call__(self, _sync_func: Callable[[List[T]], List[R]], /) -> Callable[[T], R]:
pass
@overload
def __call__(self, _sync_func: Callable[[List[T]], List[R]], /) -> ... | 9 | 1 | 4 | 0 | 4 | 0 | 1 | 0.26 | 1 | 3 | 2 | 0 | 4 | 0 | 4 | 28 | 24 | 4 | 19 | 15 | 4 | 5 | 9 | 5 | 4 | 1 | 5 | 0 | 4 |
10,498 | ray-project/ray | python/ray/serve/batching.py | ray.serve.batching._BatchQueue | from collections import deque
from inspect import isasyncgenfunction, iscoroutinefunction
from ray.serve.exceptions import RayServeException
from ray import serve
from ray._common.utils import get_or_create_event_loop
import time
import asyncio
from typing import Any, AsyncGenerator, Callable, Coroutine, Dict, Generic,... |
class _BatchQueue:
def __init__(self, max_batch_size: int, batch_wait_timeout_s: float, max_concurrent_batches: int, handle_batch_func: Optional[Callable]=None) -> None:
'''Async queue that accepts individual items and returns batches.
Respects max_batch_size and batch_wait_timeout_s; a batch will... | 15 | 8 | 23 | 3 | 14 | 5 | 4 | 0.38 | 0 | 10 | 3 | 0 | 11 | 7 | 11 | 11 | 260 | 43 | 157 | 61 | 128 | 60 | 109 | 41 | 97 | 10 | 0 | 4 | 39 |
10,499 | ray-project/ray | python/ray/serve/batching.py | ray.serve.batching._GeneratorResult | from dataclasses import dataclass
import asyncio
from typing import Any, AsyncGenerator, Callable, Coroutine, Dict, Generic, Iterable, List, Literal, Optional, Protocol, Set, Tuple, TypeVar, overload
@dataclass
class _GeneratorResult:
result: Any
next_future: asyncio.Future | @dataclass
class _GeneratorResult:
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 | 0 | 3 | 1 | 2 | 0 | 3 | 1 | 2 | 0 | 0 | 0 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.