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,500 | ray-project/ray | python/ray/serve/batching.py | ray.serve.batching._LazyBatchQueueWrapper | import io
from typing import Any, AsyncGenerator, Callable, Coroutine, Dict, Generic, Iterable, List, Literal, Optional, Protocol, Set, Tuple, TypeVar, overload
class _LazyBatchQueueWrapper:
"""Stores a _BatchQueue and updates its settings.
_BatchQueue cannot be pickled, you must construct it lazily
at ru... |
class _LazyBatchQueueWrapper:
'''Stores a _BatchQueue and updates its settings.
_BatchQueue cannot be pickled, you must construct it lazily
at runtime inside a replica. This class initializes a queue only upon
first access.
'''
def __init__(self, max_batch_size: int=10, batch_wait_timeout_s: f... | 11 | 6 | 8 | 1 | 5 | 1 | 2 | 0.37 | 0 | 5 | 1 | 0 | 9 | 4 | 9 | 9 | 87 | 20 | 49 | 21 | 33 | 18 | 36 | 15 | 26 | 2 | 0 | 1 | 15 |
10,501 | ray-project/ray | python/ray/serve/batching.py | ray.serve.batching._SingleRequest | from typing import Any, AsyncGenerator, Callable, Coroutine, Dict, Generic, Iterable, List, Literal, Optional, Protocol, Set, Tuple, TypeVar, overload
from dataclasses import dataclass
import asyncio
from ray import serve
@dataclass
class _SingleRequest:
self_arg: Any
flattened_args: List[Any]
future: asyn... | @dataclass
class _SingleRequest:
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 | 0 | 4 | 1 | 3 | 0 | 4 | 1 | 3 | 0 | 0 | 0 | 0 |
10,502 | ray-project/ray | python/ray/serve/batching.py | ray.serve.batching._SyncBatchingMethod | from typing import Any, AsyncGenerator, Callable, Coroutine, Dict, Generic, Iterable, List, Literal, Optional, Protocol, Set, Tuple, TypeVar, overload
class _SyncBatchingMethod(Protocol, Generic[SelfType, T, R]):
def __call__(self, self_: SelfType, __batch: List[T], /) -> List[R]:
... |
class _SyncBatchingMethod(Protocol, Generic[SelfType, T, R]):
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,503 | ray-project/ray | python/ray/serve/config.py | ray.serve.config.AutoscalingConfig | from ray import cloudpickle
from ray._common.utils import import_attr
from ray._common.pydantic_compat import BaseModel, Field, NonNegativeFloat, NonNegativeInt, PositiveFloat, PositiveInt, PrivateAttr, validator
from typing import Any, Callable, Dict, List, Optional, Union
from ray.serve._private.constants import DEFA... | @PublicAPI(stability='stable')
class AutoscalingConfig(BaseModel):
'''Config for the Serve Autoscaler.'''
@validator('max_replicas', always=True)
def replicas_settings_valid(cls, max_replicas, values):
pass
@validator('metrics_interval_s')
def metrics_interval_s_deprecation_warning(cls, v: P... | 14 | 3 | 8 | 1 | 7 | 1 | 2 | 0.28 | 1 | 2 | 0 | 0 | 7 | 0 | 8 | 8 | 122 | 25 | 76 | 31 | 65 | 21 | 55 | 29 | 46 | 5 | 1 | 2 | 17 |
10,504 | ray-project/ray | python/ray/serve/config.py | ray.serve.config.DeploymentMode | from ray.util.annotations import Deprecated, PublicAPI
from enum import Enum
@Deprecated
class DeploymentMode(str, Enum):
NoServer = 'NoServer'
HeadOnly = 'HeadOnly'
EveryNode = 'EveryNode' | @Deprecated
class DeploymentMode(str, Enum):
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 115 | 4 | 0 | 4 | 4 | 3 | 0 | 4 | 4 | 3 | 0 | 4 | 0 | 0 |
10,505 | ray-project/ray | python/ray/serve/config.py | ray.serve.config.HTTPOptions | from ray.serve._private.constants import DEFAULT_AUTOSCALING_POLICY_NAME, DEFAULT_GRPC_PORT, DEFAULT_HTTP_HOST, DEFAULT_HTTP_PORT, DEFAULT_REQUEST_ROUTER_PATH, DEFAULT_REQUEST_ROUTING_STATS_PERIOD_S, DEFAULT_REQUEST_ROUTING_STATS_TIMEOUT_S, DEFAULT_TARGET_ONGOING_REQUESTS, DEFAULT_UVICORN_KEEP_ALIVE_TIMEOUT_S, SERVE_LO... | @PublicAPI(stability='stable')
class HTTPOptions(BaseModel):
'''HTTP options for the proxies. Supported fields:
- host: Host that the proxies listens for HTTP on. Defaults to
"127.0.0.1". To expose Serve publicly, you probably want to set
this to "0.0.0.0".
- port: Port that the proxies listen f... | 11 | 1 | 7 | 0 | 7 | 0 | 2 | 0.61 | 1 | 1 | 1 | 0 | 3 | 0 | 3 | 3 | 67 | 10 | 36 | 19 | 28 | 22 | 25 | 16 | 20 | 2 | 1 | 1 | 6 |
10,506 | ray-project/ray | python/ray/serve/config.py | ray.serve.config.ProxyLocation | from enum import Enum
from typing import Any, Callable, Dict, List, Optional, Union
from ray.util.annotations import Deprecated, PublicAPI
@PublicAPI(stability='stable')
class ProxyLocation(str, Enum):
"""Config for where to run proxies to receive ingress traffic to the cluster.
Options:
- Disabled: ... | @PublicAPI(stability='stable')
class ProxyLocation(str, Enum):
'''Config for where to run proxies to receive ingress traffic to the cluster.
Options:
- Disabled: don't run proxies at all. This should be used if you are only
making calls to your applications via deployment handles.
- He... | 6 | 2 | 18 | 2 | 14 | 2 | 5 | 0.35 | 2 | 3 | 1 | 0 | 0 | 0 | 2 | 117 | 55 | 9 | 34 | 12 | 25 | 12 | 19 | 6 | 16 | 5 | 4 | 1 | 9 |
10,507 | ray-project/ray | python/ray/serve/config.py | ray.serve.config.gRPCOptions | from typing import Any, Callable, Dict, List, Optional, Union
from ray._common.utils import import_attr
from ray.util.annotations import Deprecated, PublicAPI
from ray.serve._private.constants import DEFAULT_AUTOSCALING_POLICY_NAME, DEFAULT_GRPC_PORT, DEFAULT_HTTP_HOST, DEFAULT_HTTP_PORT, DEFAULT_REQUEST_ROUTER_PATH, D... | @PublicAPI(stability='alpha')
class gRPCOptions(BaseModel):
'''gRPC options for the proxies. Supported fields:
Args:
port (int):
Port for gRPC server if started. Default to 9000. Cannot be
updated once Serve has started running. Serve must be shut down and
restarted w... | 4 | 2 | 27 | 2 | 21 | 4 | 4 | 0.64 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 1 | 46 | 5 | 25 | 10 | 22 | 16 | 16 | 8 | 14 | 4 | 1 | 3 | 4 |
10,508 | ray-project/ray | python/ray/serve/context.py | ray.serve.context.ReplicaContext | from typing import Callable, Dict, List, Optional
from dataclasses import dataclass
from ray.serve._private.config import DeploymentConfig
from ray.util.annotations import DeveloperAPI
from ray.serve._private.common import ReplicaID
@DeveloperAPI
@dataclass
class ReplicaContext:
"""Stores runtime context info for ... | @DeveloperAPI
@dataclass
class ReplicaContext:
'''Stores runtime context info for replicas.
Fields:
- app_name: name of the application the replica is a part of.
- deployment: name of the deployment the replica is a part of.
- replica_tag: unique ID for the replica.
- servable_ob... | 9 | 1 | 2 | 0 | 2 | 0 | 1 | 0.54 | 0 | 1 | 0 | 0 | 3 | 0 | 3 | 3 | 25 | 5 | 13 | 7 | 6 | 7 | 10 | 4 | 6 | 1 | 0 | 0 | 3 |
10,509 | ray-project/ray | python/ray/serve/context.py | ray.serve.context._RequestContext | from ray.serve.grpc_util import RayServegRPCContext
from typing import Callable, Dict, List, Optional
from dataclasses import dataclass
@dataclass(frozen=True)
class _RequestContext:
route: str = ''
request_id: str = ''
_internal_request_id: str = ''
app_name: str = ''
multiplexed_model_id: str = '... | @dataclass(frozen=True)
class _RequestContext:
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 8 | 0 | 8 | 8 | 7 | 0 | 8 | 8 | 7 | 0 | 0 | 0 | 0 |
10,510 | ray-project/ray | python/ray/serve/deployment.py | ray.serve.deployment.Application | from ray.util.annotations import PublicAPI
@PublicAPI(stability='stable')
class Application:
"""One or more deployments bound with arguments that can be deployed together.
Can be passed into another `Deployment.bind()` to compose multiple deployments in a
single application, passed to `serve.run`, or depl... | null | 3 | 1 | 3 | 0 | 2 | 1 | 1 | 7.33 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 39 | 14 | 3 | 3 | 1 | 22 | 3 | 3 | 1 | 1 | 0 | 0 | 1 |
10,511 | ray-project/ray | python/ray/serve/deployment.py | ray.serve.deployment.Deployment | from ray.util.annotations import PublicAPI
from ray.serve._private.utils import DEFAULT, Default
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
from ray.serve._private.config import DeploymentConfig, ReplicaConfig, RequestRouterConfig, handle_num_replicas_auto
import warnings
from ray.serve.config... | @PublicAPI(stability='stable')
class Deployment:
'''Class (or function) decorated with the `@serve.deployment` decorator.
This is run on a number of replica actors. Requests to those replicas call
this class.
One or more deployments can be composed together into an `Application` which is
then run vi... | 37 | 10 | 13 | 2 | 10 | 1 | 2 | 0.17 | 0 | 13 | 5 | 0 | 21 | 5 | 21 | 21 | 332 | 61 | 232 | 77 | 165 | 39 | 115 | 31 | 93 | 28 | 0 | 2 | 52 |
10,512 | ray-project/ray | python/ray/serve/exceptions.py | ray.serve.exceptions.BackPressureError | from ray.util.annotations import PublicAPI
@PublicAPI(stability='alpha')
class BackPressureError(RayServeException):
"""Raised when max_queued_requests is exceeded on a DeploymentHandle."""
def __init__(self, num_queued_requests: int, max_queued_requests: int):
super().__init__(num_queued_requests, ma... | @PublicAPI(stability='alpha')
class BackPressureError(RayServeException):
'''Raised when max_queued_requests is exceeded on a DeploymentHandle.'''
def __init__(self, num_queued_requests: int, max_queued_requests: int):
pass
def __str__(self) -> str:
pass
@property
def message(self)... | 6 | 1 | 4 | 0 | 4 | 0 | 1 | 0.08 | 1 | 3 | 0 | 0 | 3 | 1 | 3 | 13 | 17 | 3 | 13 | 6 | 8 | 1 | 8 | 5 | 4 | 1 | 4 | 0 | 3 |
10,513 | ray-project/ray | python/ray/serve/exceptions.py | ray.serve.exceptions.DeploymentUnavailableError | from ray.util.annotations import PublicAPI
from ray.serve._private.common import DeploymentID
@PublicAPI(stability='alpha')
class DeploymentUnavailableError(RayServeException):
"""Raised when a Serve deployment is unavailable to receive requests.
Currently this happens because the deployment failed to deploy.... | @PublicAPI(stability='alpha')
class DeploymentUnavailableError(RayServeException):
'''Raised when a Serve deployment is unavailable to receive requests.
Currently this happens because the deployment failed to deploy.
'''
def __init__(self, deployment_id: DeploymentID):
pass
@property
de... | 5 | 1 | 2 | 0 | 2 | 0 | 1 | 0.5 | 1 | 2 | 1 | 0 | 2 | 1 | 2 | 12 | 12 | 3 | 6 | 5 | 2 | 3 | 5 | 4 | 2 | 1 | 4 | 0 | 2 |
10,514 | ray-project/ray | python/ray/serve/exceptions.py | ray.serve.exceptions.RayServeException | from ray.util.annotations import PublicAPI
@PublicAPI(stability='stable')
class RayServeException(Exception):
pass | @PublicAPI(stability='stable')
class RayServeException(Exception):
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 | 0 | 0 | 0 | 10 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 3 | 0 | 0 |
10,515 | ray-project/ray | python/ray/serve/exceptions.py | ray.serve.exceptions.RequestCancelledError | from ray.util.annotations import PublicAPI
from ray.exceptions import TaskCancelledError
from typing import Optional
@PublicAPI(stability='alpha')
class RequestCancelledError(RayServeException, TaskCancelledError):
"""Raise when a Serve request is cancelled."""
def __init__(self, request_id: Optional[str]=Non... | @PublicAPI(stability='alpha')
class RequestCancelledError(RayServeException, TaskCancelledError):
'''Raise when a Serve request is cancelled.'''
def __init__(self, request_id: Optional[str]=None):
pass
def __str__(self):
pass | 4 | 1 | 4 | 0 | 4 | 0 | 2 | 0.13 | 2 | 1 | 0 | 0 | 2 | 1 | 2 | 17 | 11 | 2 | 8 | 4 | 5 | 1 | 7 | 4 | 4 | 2 | 5 | 1 | 3 |
10,516 | ray-project/ray | python/ray/serve/gradio_integrations.py | ray.serve.gradio_integrations.GradioIngress | from typing import Callable
from ray.util.annotations import PublicAPI
from ray.serve._private.http_util import ASGIAppReplicaWrapper
@PublicAPI(stability='alpha')
class GradioIngress(ASGIAppReplicaWrapper):
"""User-facing class that wraps a Gradio App in a Serve Deployment."""
def __init__(self, builder: Cal... | @PublicAPI(stability='alpha')
class GradioIngress(ASGIAppReplicaWrapper):
'''User-facing class that wraps a Gradio App in a Serve Deployment.'''
def __init__(self, builder: Callable[[], Blocks]):
'''Builds and wraps an ASGI app from the provided builder.
The builder should take no arguments and... | 3 | 2 | 8 | 1 | 3 | 4 | 1 | 1.25 | 1 | 1 | 0 | 2 | 1 | 0 | 1 | 6 | 11 | 2 | 4 | 3 | 2 | 5 | 4 | 3 | 2 | 1 | 1 | 0 | 1 |
10,517 | ray-project/ray | python/ray/serve/grpc_util.py | ray.serve.grpc_util.RayServegRPCContext | from ray.util.annotations import PublicAPI
import grpc
from typing import Any, Dict, List, Optional, Tuple
@PublicAPI(stability='beta')
class RayServegRPCContext:
"""Context manager to set and get gRPC context.
This class implements most of the methods from ServicerContext
(see: https://grpc.github.io/grp... | @PublicAPI(stability='beta')
class RayServegRPCContext:
'''Context manager to set and get gRPC context.
This class implements most of the methods from ServicerContext
(see: https://grpc.github.io/grpc/python/grpc.html#grpc.ServicerContext). It's
serializable and can be passed with the request to be used... | 17 | 13 | 9 | 1 | 3 | 5 | 1 | 1.38 | 0 | 3 | 0 | 0 | 15 | 9 | 15 | 15 | 161 | 37 | 53 | 26 | 37 | 73 | 49 | 26 | 33 | 5 | 0 | 2 | 21 |
10,518 | ray-project/ray | python/ray/serve/handle.py | ray.serve.handle.DeploymentHandle | import warnings
from ray.util.annotations import DeveloperAPI, PublicAPI
from typing import Any, AsyncIterator, Dict, Iterator, Optional, Tuple, Union
from ray.serve._private.utils import DEFAULT, calculate_remaining_timeout, get_random_string, inside_ray_client_context, is_running_in_asyncio_loop
@PublicAPI(stability... | @PublicAPI(stability='stable')
class DeploymentHandle(_DeploymentHandleBase):
'''A handle used to make requests to a deployment at runtime.
This is primarily used to compose multiple deployments within a single application.
It can also be used to make calls to the ingress deployment of an application (e.g.,... | 4 | 3 | 38 | 7 | 17 | 14 | 3 | 1.54 | 1 | 5 | 3 | 0 | 2 | 0 | 2 | 18 | 114 | 25 | 35 | 15 | 22 | 54 | 13 | 5 | 10 | 3 | 1 | 1 | 5 |
10,519 | ray-project/ray | python/ray/serve/handle.py | ray.serve.handle.DeploymentResponse | from ray.serve.exceptions import RayServeException, RequestCancelledError
from typing import Any, AsyncIterator, Dict, Iterator, Optional, Tuple, Union
from ray.serve._private.utils import DEFAULT, calculate_remaining_timeout, get_random_string, inside_ray_client_context, is_running_in_asyncio_loop
from ray.serve._priv... | @PublicAPI(stability='stable')
class DeploymentResponse(_DeploymentResponseBase):
'''A future-like object wrapping the result of a unary deployment handle call.
From inside a deployment, a `DeploymentResponse` can be awaited to retrieve the
output of the call without blocking the asyncio event loop.
Fro... | 9 | 5 | 18 | 3 | 10 | 5 | 1 | 1.37 | 1 | 6 | 2 | 0 | 5 | 0 | 5 | 11 | 167 | 39 | 54 | 26 | 37 | 74 | 26 | 15 | 20 | 2 | 1 | 1 | 7 |
10,520 | ray-project/ray | python/ray/serve/handle.py | ray.serve.handle.DeploymentResponseGenerator | from ray._raylet import ObjectRefGenerator
from ray.serve._private.common import OBJ_REF_NOT_SUPPORTED_ERROR, DeploymentHandleSource, DeploymentID, RequestMetadata
import asyncio
from ray.util.annotations import DeveloperAPI, PublicAPI
from ray.serve._private.usage import ServeUsageTag
from typing import Any, AsyncIter... | @PublicAPI(stability='stable')
class DeploymentResponseGenerator(_DeploymentResponseBase):
'''A future-like object wrapping the result of a streaming deployment handle call.
This is returned when using `handle.options(stream=True)` and calling a generator
deployment method.
`DeploymentResponseGenerator`... | 11 | 3 | 8 | 1 | 5 | 2 | 1 | 1.23 | 1 | 6 | 1 | 0 | 7 | 0 | 7 | 13 | 120 | 31 | 40 | 18 | 26 | 49 | 25 | 12 | 17 | 2 | 1 | 1 | 9 |
10,521 | ray-project/ray | python/ray/serve/handle.py | ray.serve.handle._DeploymentHandleBase | from ray.serve._private.handle_options import DynamicHandleOptionsBase, InitHandleOptionsBase
import asyncio
from ray.util import metrics
from ray.serve._private.utils import DEFAULT, calculate_remaining_timeout, get_random_string, inside_ray_client_context, is_running_in_asyncio_loop
from typing import Any, AsyncItera... |
class _DeploymentHandleBase:
def __init__(self, deployment_name: str, app_name: str, *, init_options: Optional[InitHandleOptionsBase]=None, handle_options: Optional[DynamicHandleOptionsBase]=None, _router: Optional[Router]=None, _create_router: Optional[CreateRouterCallable]=None, _request_counter: Optional[metri... | 24 | 2 | 11 | 1 | 9 | 1 | 2 | 0.09 | 0 | 15 | 10 | 1 | 13 | 7 | 16 | 16 | 192 | 29 | 152 | 53 | 112 | 13 | 68 | 30 | 51 | 4 | 0 | 1 | 27 |
10,522 | ray-project/ray | python/ray/serve/handle.py | ray.serve.handle._DeploymentResponseBase | from ray.util.annotations import DeveloperAPI, PublicAPI
from typing import Any, AsyncIterator, Dict, Iterator, Optional, Tuple, Union
from ray.serve.exceptions import RayServeException, RequestCancelledError
import asyncio
from ray.serve._private.replica_result import ReplicaResult
from ray.serve._private.common impor... |
class _DeploymentResponseBase:
def __init__(self, replica_result_future: Union[concurrent.futures.Future[ReplicaResult], asyncio.Future[ReplicaResult]], request_metadata: RequestMetadata, _is_router_running_in_separate_loop: bool=True):
pass
@property
def request_id(self) -> str:
pass
... | 11 | 4 | 14 | 2 | 7 | 5 | 2 | 0.57 | 0 | 9 | 3 | 2 | 6 | 4 | 6 | 6 | 91 | 17 | 47 | 19 | 32 | 27 | 34 | 11 | 27 | 4 | 0 | 2 | 14 |
10,523 | ray-project/ray | python/ray/serve/metrics.py | ray.serve.metrics.Counter | from ray.util.annotations import PublicAPI
from ray.util import metrics
from typing import Dict, List, Optional, Tuple, Union
@PublicAPI(stability='beta')
class Counter(metrics.Counter):
"""A serve cumulative metric that is monotonically increasing.
This corresponds to Prometheus' counter metric:
https://... | @PublicAPI(stability='beta')
class Counter(metrics.Counter):
'''A serve cumulative metric that is monotonically increasing.
This corresponds to Prometheus' counter metric:
https://prometheus.io/docs/concepts/metric_types/#counter
Serve-related tags ("deployment", "replica", "application", "route")
a... | 5 | 2 | 6 | 0 | 5 | 1 | 1 | 2.25 | 1 | 7 | 0 | 0 | 3 | 0 | 3 | 12 | 63 | 11 | 16 | 6 | 10 | 36 | 12 | 4 | 8 | 2 | 2 | 1 | 4 |
10,524 | ray-project/ray | python/ray/serve/metrics.py | ray.serve.metrics.Gauge | from ray.util import metrics
from ray.util.annotations import PublicAPI
from typing import Dict, List, Optional, Tuple, Union
@PublicAPI(stability='beta')
class Gauge(metrics.Gauge):
"""Gauges keep the last recorded value and drop everything before.
This corresponds to Prometheus' gauge metric:
https://pr... | @PublicAPI(stability='beta')
class Gauge(metrics.Gauge):
'''Gauges keep the last recorded value and drop everything before.
This corresponds to Prometheus' gauge metric:
https://prometheus.io/docs/concepts/metric_types/#gauge
Serve-related tags ("deployment", "replica", "application", "route")
are a... | 5 | 2 | 6 | 0 | 5 | 1 | 1 | 1.69 | 0 | 7 | 0 | 0 | 3 | 0 | 3 | 3 | 52 | 9 | 16 | 6 | 10 | 27 | 12 | 4 | 8 | 2 | 0 | 1 | 4 |
10,525 | ray-project/ray | python/ray/serve/metrics.py | ray.serve.metrics.Histogram | from ray.util.annotations import PublicAPI
from typing import Dict, List, Optional, Tuple, Union
from ray.util import metrics
@PublicAPI(stability='beta')
class Histogram(metrics.Histogram):
"""Tracks the size and number of events in buckets.
Histograms allow you to calculate aggregate quantiles
such as 2... | @PublicAPI(stability='beta')
class Histogram(metrics.Histogram):
'''Tracks the size and number of events in buckets.
Histograms allow you to calculate aggregate quantiles
such as 25, 50, 95, 99 percentile latency for an RPC.
This corresponds to Prometheus' histogram metric:
https://prometheus.io/doc... | 5 | 2 | 7 | 0 | 6 | 1 | 1 | 1.5 | 0 | 7 | 0 | 0 | 3 | 0 | 3 | 3 | 60 | 10 | 20 | 10 | 10 | 30 | 12 | 4 | 8 | 2 | 0 | 1 | 4 |
10,526 | ray-project/ray | python/ray/serve/multiplex.py | ray.serve.multiplex._ModelMultiplexWrapper | from ray.serve._private.constants import MODEL_LOAD_LATENCY_BUCKETS_MS, PUSH_MULTIPLEXED_MODEL_IDS_INTERVAL_S, SERVE_LOGGER_NAME
from ray.serve._private.common import ReplicaID, RequestRoutingInfo
from ray.serve._private.usage import ServeUsageTag
from ray.serve.context import _get_global_client, _get_internal_replica_... |
class _ModelMultiplexWrapper:
'''A wrapper class that wraps the model load function and
provides the LRU caching functionality.
The model multiplexer is a wrapper class that wraps the model load function
and provides the LRU caching functionality, and the model load function should
be a coroutine f... | 7 | 7 | 36 | 3 | 26 | 7 | 4 | 0.33 | 0 | 18 | 6 | 0 | 6 | 18 | 6 | 6 | 237 | 29 | 156 | 43 | 144 | 52 | 95 | 35 | 88 | 8 | 0 | 4 | 21 |
10,527 | ray-project/ray | python/ray/serve/schema.py | ray.serve.schema.APIType | from ray.util.annotations import PublicAPI
from enum import Enum
@PublicAPI(stability='alpha')
class APIType(str, Enum):
"""Tracks the type of API that an application originates from."""
UNKNOWN = 'unknown'
IMPERATIVE = 'imperative'
DECLARATIVE = 'declarative'
@classmethod
def get_valid_user_v... | @PublicAPI(stability='alpha')
class APIType(str, Enum):
'''Tracks the type of API that an application originates from.'''
@classmethod
def get_valid_user_values(cls):
'''Get list of valid APIType values that users can explicitly pass.
Excludes 'unknown' which is for internal use only.
... | 4 | 2 | 0 | 0 | 0 | 0 | 0 | 0.25 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 115 | 6 | 1 | 4 | 4 | 3 | 1 | 4 | 4 | 3 | 0 | 4 | 0 | 0 |
10,528 | ray-project/ray | python/ray/serve/schema.py | ray.serve.schema.ApplicationDetails | from ray._common.pydantic_compat import BaseModel, Extra, Field, NonNegativeInt, PositiveInt, StrictInt, root_validator, validator
from typing import Any, Callable, Dict, List, Optional, Set, Union
from ray.util.annotations import PublicAPI
@PublicAPI(stability='stable')
class ApplicationDetails(BaseModel, extra=Extra... | @PublicAPI(stability='stable')
class ApplicationDetails(BaseModel, extra=Extra.forbid, frozen=True):
'''Detailed info about a Serve application.'''
pass | 2 | 1 | 0 | 0 | 0 | 0 | 0 | 0.02 | 3 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 61 | 2 | 58 | 11 | 57 | 1 | 11 | 11 | 10 | 0 | 1 | 0 | 0 |
10,529 | ray-project/ray | python/ray/serve/schema.py | ray.serve.schema.ApplicationStatus | from enum import Enum
from ray.util.annotations import PublicAPI
@PublicAPI(stability='stable')
class ApplicationStatus(str, Enum):
"""The current status of the application."""
NOT_STARTED = 'NOT_STARTED'
DEPLOYING = 'DEPLOYING'
DEPLOY_FAILED = 'DEPLOY_FAILED'
RUNNING = 'RUNNING'
UNHEALTHY = 'U... | @PublicAPI(stability='stable')
class ApplicationStatus(str, Enum):
'''The current status of the application.'''
pass | 2 | 1 | 0 | 0 | 0 | 0 | 0 | 0.14 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 115 | 9 | 1 | 7 | 7 | 6 | 1 | 7 | 7 | 6 | 0 | 4 | 0 | 0 |
10,530 | ray-project/ray | python/ray/serve/schema.py | ray.serve.schema.ApplicationStatusOverview | from typing import Any, Callable, Dict, List, Optional, Set, Union
from ray.util.annotations import PublicAPI
from dataclasses import dataclass, field
@PublicAPI(stability='alpha')
@dataclass
class ApplicationStatusOverview:
"""Describes the status of an application and all its deployments.
Attributes:
... | @PublicAPI(stability='alpha')
@dataclass
class ApplicationStatusOverview:
'''Describes the status of an application and all its deployments.
Attributes:
status: The current status of the application.
message: A message describing the application status in more
detail.
last_de... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 1.8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 16 | 2 | 5 | 1 | 4 | 9 | 5 | 1 | 4 | 0 | 0 | 0 | 0 |
10,531 | ray-project/ray | python/ray/serve/schema.py | ray.serve.schema.DeploymentDetails | from typing import Any, Callable, Dict, List, Optional, Set, Union
from ray._common.pydantic_compat import BaseModel, Extra, Field, NonNegativeInt, PositiveInt, StrictInt, root_validator, validator
from ray.util.annotations import PublicAPI
from ray.serve._private.common import DeploymentStatus, DeploymentStatusTrigger... | @PublicAPI(stability='stable')
class DeploymentDetails(BaseModel, extra=Extra.forbid, frozen=True):
'''
Detailed info about a deployment within a Serve application.
'''
pass | 2 | 1 | 0 | 0 | 0 | 0 | 0 | 0.09 | 3 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 38 | 1 | 34 | 9 | 33 | 3 | 9 | 9 | 8 | 0 | 1 | 0 | 0 |
10,532 | ray-project/ray | python/ray/serve/schema.py | ray.serve.schema.DeploymentSchema | from ray._common.pydantic_compat import BaseModel, Extra, Field, NonNegativeInt, PositiveInt, StrictInt, root_validator, validator
from dataclasses import dataclass, field
from ray.serve._private.constants import DEFAULT_GRPC_PORT, DEFAULT_MAX_ONGOING_REQUESTS, DEFAULT_UVICORN_KEEP_ALIVE_TIMEOUT_S, RAY_SERVE_LOG_ENCODI... | @PublicAPI(stability='stable')
class DeploymentSchema(BaseModel, allow_population_by_field_name=True):
'''
Specifies options for one deployment within a Serve application. For each deployment
this can optionally be included in `ServeApplicationSchema` to override deployment
options specified in code.
... | 9 | 2 | 14 | 2 | 10 | 2 | 3 | 0.08 | 2 | 4 | 1 | 0 | 4 | 0 | 4 | 4 | 187 | 16 | 159 | 29 | 151 | 12 | 39 | 25 | 34 | 4 | 1 | 2 | 10 |
10,533 | ray-project/ray | python/ray/serve/schema.py | ray.serve.schema.DeploymentStatusOverview | from ray.serve._private.common import DeploymentStatus, DeploymentStatusTrigger, ReplicaState, RequestProtocol, ServeDeployMode
from dataclasses import dataclass, field
from typing import Any, Callable, Dict, List, Optional, Set, Union
from ray.util.annotations import PublicAPI
@PublicAPI(stability='alpha')
@dataclass... | @PublicAPI(stability='alpha')
@dataclass
class DeploymentStatusOverview:
'''Describes the status of a deployment.
Attributes:
status: The current status of the deployment.
replica_states: A map indicating how many replicas there are of
each replica state.
message: A message d... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 1.6 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 15 | 2 | 5 | 1 | 4 | 8 | 5 | 1 | 4 | 0 | 0 | 0 | 0 |
10,534 | ray-project/ray | python/ray/serve/schema.py | ray.serve.schema.EncodingType | from ray.util.annotations import PublicAPI
from enum import Enum
@PublicAPI(stability='alpha')
class EncodingType(str, Enum):
"""Encoding type for the serve logs."""
TEXT = 'TEXT'
JSON = 'JSON' | @PublicAPI(stability='alpha')
class EncodingType(str, Enum):
'''Encoding type for the serve logs.'''
pass | 2 | 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,535 | ray-project/ray | python/ray/serve/schema.py | ray.serve.schema.HTTPOptionsSchema | from ray._common.pydantic_compat import BaseModel, Extra, Field, NonNegativeInt, PositiveInt, StrictInt, root_validator, validator
from ray.serve._private.utils import DEFAULT, validate_ssl_config
from typing import Any, Callable, Dict, List, Optional, Set, Union
from ray.serve._private.constants import DEFAULT_GRPC_PO... | @PublicAPI(stability='stable')
class HTTPOptionsSchema(BaseModel):
'''Options to start the HTTP Proxy with.
NOTE: This config allows extra parameters to make it forward-compatible (ie
older versions of Serve are able to accept configs from a newer versions,
simply ignoring new parameters).
... | 4 | 1 | 0 | 0 | 0 | 0 | 0 | 0.15 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 42 | 3 | 34 | 6 | 33 | 5 | 6 | 6 | 5 | 0 | 1 | 0 | 0 |
10,536 | ray-project/ray | python/ray/serve/schema.py | ray.serve.schema.LoggingConfig | from typing import Any, Callable, Dict, List, Optional, Set, Union
from ray._common.pydantic_compat import BaseModel, Extra, Field, NonNegativeInt, PositiveInt, StrictInt, root_validator, validator
from ray.serve._private.constants import DEFAULT_GRPC_PORT, DEFAULT_MAX_ONGOING_REQUESTS, DEFAULT_UVICORN_KEEP_ALIVE_TIMEO... | @PublicAPI(stability='alpha')
class LoggingConfig(BaseModel):
'''Logging config schema for configuring serve components logs.
Example:
.. code-block:: python
from ray import serve
from ray.serve.schema import LoggingConfig
# Set log level for the deployment.
... | 11 | 1 | 9 | 1 | 9 | 0 | 2 | 0.24 | 1 | 8 | 1 | 0 | 4 | 0 | 4 | 4 | 95 | 11 | 68 | 13 | 60 | 16 | 25 | 11 | 19 | 4 | 1 | 2 | 9 |
10,537 | ray-project/ray | python/ray/serve/schema.py | ray.serve.schema.ProxyDetails | from ray.util.annotations import PublicAPI
from ray._common.pydantic_compat import BaseModel, Extra, Field, NonNegativeInt, PositiveInt, StrictInt, root_validator, validator
@PublicAPI(stability='stable')
class ProxyDetails(ServeActorDetails, frozen=True):
"""Detailed info about a Ray Serve ProxyActor.
Attrib... | @PublicAPI(stability='stable')
class ProxyDetails(ServeActorDetails, frozen=True):
'''Detailed info about a Ray Serve ProxyActor.
Attributes:
status: The current status of the proxy.
'''
pass | 2 | 1 | 0 | 0 | 0 | 0 | 0 | 2 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 8 | 2 | 2 | 2 | 1 | 4 | 2 | 2 | 1 | 0 | 2 | 0 | 0 |
10,538 | ray-project/ray | python/ray/serve/schema.py | ray.serve.schema.ProxyStatus | from ray.util.annotations import PublicAPI
from enum import Enum
@PublicAPI(stability='stable')
class ProxyStatus(str, Enum):
"""The current status of the proxy."""
STARTING = 'STARTING'
HEALTHY = 'HEALTHY'
UNHEALTHY = 'UNHEALTHY'
DRAINING = 'DRAINING'
DRAINED = 'DRAINED' | @PublicAPI(stability='stable')
class ProxyStatus(str, Enum):
'''The current status of the proxy.'''
pass | 2 | 1 | 0 | 0 | 0 | 0 | 0 | 0.67 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 115 | 11 | 1 | 6 | 6 | 5 | 4 | 6 | 6 | 5 | 0 | 4 | 0 | 0 |
10,539 | ray-project/ray | python/ray/serve/schema.py | ray.serve.schema.RayActorOptionsSchema | from ray._private.runtime_env.packaging import parse_uri
from ray.util.annotations import PublicAPI
from typing import Any, Callable, Dict, List, Optional, Set, Union
from ray._common.pydantic_compat import BaseModel, Extra, Field, NonNegativeInt, PositiveInt, StrictInt, root_validator, validator
@PublicAPI(stability=... | @PublicAPI(stability='stable')
class RayActorOptionsSchema(BaseModel):
'''Options with which to start a replica actor.'''
@validator('runtime_env')
def runtime_env_contains_remote_uris(cls, v):
pass | 4 | 1 | 22 | 4 | 17 | 1 | 6 | 0.03 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 1 | 70 | 6 | 62 | 12 | 59 | 2 | 20 | 10 | 18 | 6 | 1 | 3 | 6 |
10,540 | ray-project/ray | python/ray/serve/schema.py | ray.serve.schema.ReplicaDetails | from ray._common.pydantic_compat import BaseModel, Extra, Field, NonNegativeInt, PositiveInt, StrictInt, root_validator, validator
from ray.util.annotations import PublicAPI
from typing import Any, Callable, Dict, List, Optional, Set, Union
from ray.serve._private.common import DeploymentStatus, DeploymentStatusTrigger... | @PublicAPI(stability='stable')
class ReplicaDetails(ServeActorDetails, frozen=True):
'''Detailed info about a single deployment replica.'''
pass | 2 | 1 | 0 | 0 | 0 | 0 | 0 | 0.09 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 13 | 1 | 11 | 5 | 10 | 1 | 5 | 5 | 4 | 0 | 2 | 0 | 0 |
10,541 | ray-project/ray | python/ray/serve/schema.py | ray.serve.schema.ServeActorDetails | from typing import Any, Callable, Dict, List, Optional, Set, Union
from ray._common.pydantic_compat import BaseModel, Extra, Field, NonNegativeInt, PositiveInt, StrictInt, root_validator, validator
from ray.util.annotations import PublicAPI
@PublicAPI(stability='stable')
class ServeActorDetails(BaseModel, frozen=True)... | @PublicAPI(stability='stable')
class ServeActorDetails(BaseModel, frozen=True):
'''Detailed info about a Ray Serve actor.
Attributes:
node_id: ID of the node that the actor is running on.
node_ip: IP address of the node that the actor is running on.
node_instance_id: Cloud provider insta... | 2 | 1 | 0 | 0 | 0 | 0 | 0 | 0.63 | 2 | 0 | 0 | 2 | 0 | 0 | 0 | 0 | 28 | 2 | 16 | 7 | 15 | 10 | 7 | 7 | 6 | 0 | 1 | 0 | 0 |
10,542 | ray-project/ray | python/ray/serve/schema.py | ray.serve.schema.ServeApplicationSchema | from typing import Any, Callable, Dict, List, Optional, Set, Union
from ray.serve._private.constants import DEFAULT_GRPC_PORT, DEFAULT_MAX_ONGOING_REQUESTS, DEFAULT_UVICORN_KEEP_ALIVE_TIMEOUT_S, RAY_SERVE_LOG_ENCODING, SERVE_DEFAULT_APP_NAME
from ray._private.runtime_env.packaging import parse_uri
from ray.util.annotat... | @PublicAPI(stability='stable')
class ServeApplicationSchema(BaseModel):
'''
Describes one Serve application, and currently can also be used as a standalone
config to deploy a single application to a Ray cluster.
'''
@property
def deployment_names(self) -> List[str]:
pass
@validator('... | 10 | 2 | 16 | 2 | 14 | 1 | 4 | 0.07 | 1 | 2 | 0 | 0 | 3 | 0 | 4 | 4 | 142 | 14 | 120 | 21 | 111 | 8 | 41 | 16 | 36 | 7 | 1 | 3 | 15 |
10,543 | ray-project/ray | python/ray/serve/schema.py | ray.serve.schema.ServeDeploySchema | from ray._common.pydantic_compat import BaseModel, Extra, Field, NonNegativeInt, PositiveInt, StrictInt, root_validator, validator
from ray.util.annotations import PublicAPI
from typing import Any, Callable, Dict, List, Optional, Set, Union
from ray.serve.config import ProxyLocation, RequestRouterConfig
@PublicAPI(sta... | @PublicAPI(stability='stable')
class ServeDeploySchema(BaseModel):
'''
Multi-application config for deploying a list of Serve applications to the Ray
cluster.
This is the request JSON schema for the v2 REST API
`PUT "/api/serve/applications/"`.
NOTE: This config allows extra parameters to make i... | 12 | 2 | 11 | 0 | 9 | 2 | 3 | 0.25 | 1 | 1 | 0 | 0 | 4 | 0 | 5 | 5 | 99 | 10 | 71 | 25 | 60 | 18 | 35 | 20 | 29 | 4 | 1 | 2 | 14 |
10,544 | ray-project/ray | python/ray/serve/schema.py | ray.serve.schema.ServeInstanceDetails | from ray.util.annotations import PublicAPI
from collections import Counter
from typing import Any, Callable, Dict, List, Optional, Set, Union
from ray.serve._private.common import DeploymentStatus, DeploymentStatusTrigger, ReplicaState, RequestProtocol, ServeDeployMode
from ray._common.pydantic_compat import BaseModel,... | @PublicAPI(stability='stable')
class ServeInstanceDetails(BaseModel, extra=Extra.forbid):
'''
Serve metadata with system-level info and details on all applications deployed to
the Ray cluster.
This is the response JSON schema for v2 REST API `GET /api/serve/applications`.
'''
@staticmethod
d... | 6 | 3 | 19 | 1 | 15 | 2 | 2 | 0.16 | 2 | 8 | 3 | 0 | 2 | 0 | 3 | 3 | 98 | 9 | 77 | 18 | 70 | 12 | 20 | 15 | 16 | 4 | 1 | 3 | 6 |
10,545 | ray-project/ray | python/ray/serve/schema.py | ray.serve.schema.ServeStatus | from dataclasses import dataclass, field
from ray.util.annotations import PublicAPI
from typing import Any, Callable, Dict, List, Optional, Set, Union
@PublicAPI(stability='alpha')
@dataclass(eq=True)
class ServeStatus:
"""Describes the status of Serve.
Attributes:
proxies: The proxy actors running on... | @PublicAPI(stability='alpha')
@dataclass(eq=True)
class ServeStatus:
'''Describes the status of Serve.
Attributes:
proxies: The proxy actors running on each node in the cluster.
A map from node ID to proxy status.
applications: The live applications in the cluster.
target_cap... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 14 | 2 | 4 | 4 | 3 | 8 | 4 | 4 | 3 | 0 | 0 | 0 | 0 |
10,546 | ray-project/ray | python/ray/serve/schema.py | ray.serve.schema.gRPCOptionsSchema | from ray.serve._private.constants import DEFAULT_GRPC_PORT, DEFAULT_MAX_ONGOING_REQUESTS, DEFAULT_UVICORN_KEEP_ALIVE_TIMEOUT_S, RAY_SERVE_LOG_ENCODING, SERVE_DEFAULT_APP_NAME
from typing import Any, Callable, Dict, List, Optional, Set, Union
from ray.util.annotations import PublicAPI
from ray._common.pydantic_compat im... | @PublicAPI(stability='alpha')
class gRPCOptionsSchema(BaseModel):
'''Options to start the gRPC Proxy with.'''
pass | 2 | 1 | 0 | 0 | 0 | 0 | 0 | 0.06 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 20 | 1 | 18 | 3 | 17 | 1 | 3 | 3 | 2 | 0 | 1 | 0 | 0 |
10,547 | ray-project/ray | python/ray/serve/scripts.py | ray.serve.scripts.ServeDeploySchemaDumper | import yaml
class ServeDeploySchemaDumper(yaml.SafeDumper):
"""YAML dumper object with custom formatting for ServeDeploySchema.
Reformat config to follow this spacing with appropriate line breaks:
---------------------------------------------------------------
proxy_location: EveryNode
http_optio... |
class ServeDeploySchemaDumper(yaml.SafeDumper):
'''YAML dumper object with custom formatting for ServeDeploySchema.
Reformat config to follow this spacing with appropriate line breaks:
---------------------------------------------------------------
proxy_location: EveryNode
http_options:
host... | 2 | 1 | 8 | 1 | 4 | 3 | 2 | 3.6 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 1 | 35 | 12 | 5 | 2 | 3 | 18 | 5 | 2 | 3 | 2 | 1 | 1 | 2 |
10,548 | ray-project/ray | python/ray/train/_checkpoint.py | ray.train._checkpoint.Checkpoint | from typing import Any, Dict, Iterator, List, Optional, Union
import os
import traceback
import contextlib
import shutil
from ray.train._internal.storage import _download_from_fs_path, _exists_at_fs_path
import tempfile
from pathlib import Path
from ray.util.annotations import PublicAPI
from ray.air._internal.filelock ... | @PublicAPI(stability='beta')
class Checkpoint(metaclass=_CheckpointMetaClass):
'''A reference to data persisted as a directory in local or remote storage.
Access the checkpoint contents locally using ``checkpoint.to_directory()``
or ``checkpoint.as_directory``.
Attributes
----------
path: A path... | 14 | 9 | 23 | 3 | 10 | 10 | 2 | 1.35 | 1 | 9 | 1 | 2 | 9 | 3 | 10 | 24 | 296 | 54 | 103 | 33 | 86 | 139 | 69 | 25 | 58 | 5 | 3 | 5 | 21 |
10,549 | ray-project/ray | python/ray/train/_checkpoint.py | ray.train._checkpoint._CheckpointMetaClass | class _CheckpointMetaClass(type):
def __getattr__(self, item):
try:
return super().__getattribute__(item)
except AttributeError as exc:
if item in {'from_dict', 'to_dict', 'from_bytes', 'to_bytes', 'get_internal_representation'}:
raise _get_migration_error(it... | class _CheckpointMetaClass(type):
def __getattr__(self, item):
pass | 2 | 0 | 22 | 1 | 21 | 0 | 5 | 0 | 1 | 2 | 0 | 1 | 1 | 0 | 1 | 14 | 23 | 1 | 22 | 3 | 20 | 0 | 10 | 2 | 8 | 5 | 2 | 2 | 5 |
10,550 | ray-project/ray | python/ray/train/_internal/accelerator.py | ray.train._internal.accelerator.Accelerator | import abc
class Accelerator(abc.ABC):
"""A utility that contains methods to accelerate training.""" |
class Accelerator(abc.ABC):
'''A utility that contains methods to accelerate training.'''
pass | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 2 | 0 | 0 | 0 | 20 | 2 | 0 | 1 | 1 | 0 | 1 | 1 | 1 | 0 | 0 | 4 | 0 | 0 |
10,551 | ray-project/ray | python/ray/train/_internal/backend_executor.py | ray.train._internal.backend_executor.BackendExecutor | from ray.train._internal.session import TrialInfo, _TrainingResult, get_session, init_session, shutdown_session
import ray._private.ray_constants as ray_constants
from typing import Any, Callable, Dict, List, Optional, Tuple, Type, TypeVar
from ray._private.accelerators.npu import ASCEND_RT_VISIBLE_DEVICES_ENV_VAR
from... |
class BackendExecutor:
'''Main execution class for training backends.
This class holds a worker group and is responsible for executing the
training function on the workers, and collecting intermediate results
from ``session.report()``.
Args:
backend_config: The configurations for this
... | 27 | 14 | 29 | 3 | 19 | 7 | 2 | 0.42 | 0 | 24 | 13 | 3 | 19 | 16 | 19 | 19 | 726 | 109 | 439 | 148 | 366 | 184 | 228 | 103 | 196 | 8 | 0 | 3 | 64 |
10,552 | ray-project/ray | python/ray/train/_internal/backend_executor.py | ray.train._internal.backend_executor.InactiveWorkerGroup | class InactiveWorkerGroup:
def __getstate__(self):
return vars(self)
def __setstate__(self, state):
vars(self).update(state)
def __getattr__(self, name):
raise InactiveWorkerGroupError()
def __len__(self):
raise InactiveWorkerGroupError() | class InactiveWorkerGroup:
def __getstate__(self):
pass
def __setstate__(self, state):
pass
def __getattr__(self, name):
pass
def __len__(self):
pass | 5 | 0 | 2 | 0 | 2 | 0 | 1 | 0.33 | 0 | 1 | 1 | 0 | 4 | 0 | 4 | 4 | 16 | 4 | 9 | 5 | 4 | 3 | 9 | 5 | 4 | 1 | 0 | 0 | 4 |
10,553 | ray-project/ray | python/ray/train/_internal/backend_executor.py | ray.train._internal.backend_executor.InactiveWorkerGroupError | class InactiveWorkerGroupError(Exception):
"""Raised when underlying worker group is inactive.""" | class InactiveWorkerGroupError(Exception):
'''Raised when underlying worker group is inactive.'''
pass | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 10 | 2 | 0 | 1 | 1 | 0 | 1 | 1 | 1 | 0 | 0 | 3 | 0 | 0 |
10,554 | ray-project/ray | python/ray/train/_internal/backend_executor.py | ray.train._internal.backend_executor.ResourceConfig | from dataclasses import dataclass
@dataclass
class ResourceConfig:
"""
Resource configuration for resource_ids to share between workers.
Args:
resource_name: The name of the resource to configure
(Example: "neuron_cores" or "gpu").
resource_enable_sharing_env_var: The environment ... | @dataclass
class ResourceConfig:
'''
Resource configuration for resource_ids to share between workers.
Args:
resource_name: The name of the resource to configure
(Example: "neuron_cores" or "gpu").
resource_enable_sharing_env_var: The environment variable to
check if the re... | 2 | 1 | 0 | 0 | 0 | 0 | 0 | 2.5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 16 | 2 | 4 | 1 | 3 | 10 | 4 | 1 | 3 | 0 | 0 | 0 | 0 |
10,555 | ray-project/ray | python/ray/train/_internal/backend_executor.py | ray.train._internal.backend_executor.TrainBackendError | class TrainBackendError(Exception):
"""Errors with BackendExecutor that should not be exposed to user.""" | class TrainBackendError(Exception):
'''Errors with BackendExecutor that should not be exposed to user.'''
pass | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 10 | 2 | 0 | 1 | 1 | 0 | 1 | 1 | 1 | 0 | 0 | 3 | 0 | 0 |
10,556 | ray-project/ray | python/ray/train/_internal/backend_executor.py | ray.train._internal.backend_executor.TrainingWorkerError | class TrainingWorkerError(Exception):
"""Raised if a worker fails during training.""" | class TrainingWorkerError(Exception):
'''Raised if a worker fails during training.'''
pass | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 10 | 2 | 0 | 1 | 1 | 0 | 1 | 1 | 1 | 0 | 0 | 3 | 0 | 0 |
10,557 | ray-project/ray | python/ray/train/_internal/checkpoint_manager.py | ray.train._internal.checkpoint_manager._CheckpointManager | from typing import Any, Callable, List, Optional, Tuple
import numbers
from ray._private import ray_constants
from ray.train._internal.storage import _delete_fs_path
from ray.train.constants import TUNE_ONLY_STORE_CHECKPOINT_SCORE_ATTRIBUTE
from ray.train import CheckpointConfig
from ray.air.config import MAX
from ray.... |
class _CheckpointManager:
'''Checkpoint manager that handles checkpoint book-keeping for a trial.
The main purpose of this abstraction is to keep the top K checkpoints based on
recency/a user-provided metric.
NOTE: This class interacts with `_TrainingResult` objects, which are
(checkpoint, metrics)... | 12 | 3 | 17 | 2 | 11 | 4 | 3 | 0.39 | 0 | 7 | 0 | 1 | 7 | 3 | 7 | 7 | 143 | 25 | 85 | 27 | 71 | 33 | 47 | 21 | 39 | 6 | 0 | 2 | 18 |
10,558 | ray-project/ray | python/ray/train/_internal/data_config.py | ray.train._internal.data_config.DataConfig | from typing import Dict, List, Literal, Optional, Union
from ray.data._internal.execution.interfaces.execution_options import ExecutionResources
import ray
import copy
from ray.util.annotations import DeveloperAPI, PublicAPI
from ray.actor import ActorHandle
from ray.data import DataIterator, Dataset, ExecutionOptions,... | @PublicAPI(stability='stable')
class DataConfig:
'''Class responsible for configuring Train dataset preprocessing.
For advanced use cases, this class can be subclassed and the `configure()` method
overriden for custom data preprocessing.
'''
def __init__(self, datasets_to_split: Union[Literal['all'... | 8 | 5 | 29 | 3 | 17 | 9 | 3 | 0.53 | 0 | 11 | 2 | 2 | 3 | 4 | 4 | 4 | 128 | 18 | 72 | 29 | 54 | 38 | 32 | 16 | 27 | 8 | 0 | 3 | 12 |
10,559 | ray-project/ray | python/ray/train/_internal/dl_predictor.py | ray.train._internal.dl_predictor.DLPredictor | from ray.train.predictor import Predictor
import numpy as np
from ray.util.annotations import DeveloperAPI
import pandas as pd
import abc
from ray.air.util.data_batch_conversion import BatchFormat, _convert_batch_type_to_pandas, _convert_pandas_to_batch_type
from typing import Dict, Optional, TypeVar, Union
class DLPr... |
class DLPredictor(Predictor):
@abc.abstractmethod
def _arrays_to_tensors(self, numpy_arrays: Union[np.ndarray, Dict[str, np.ndarray]], dtype: Optional[Union[TensorDtype, Dict[str, TensorDtype]]]) -> Union[TensorType, Dict[str, TensorType]]:
'''Converts a NumPy ndarray batch to the tensor type for the ... | 13 | 3 | 12 | 1 | 7 | 5 | 1 | 0.59 | 1 | 4 | 1 | 2 | 5 | 0 | 6 | 38 | 85 | 12 | 46 | 29 | 19 | 27 | 21 | 11 | 14 | 3 | 5 | 1 | 8 |
10,560 | ray-project/ray | python/ray/train/_internal/framework_checkpoint.py | ray.train._internal.framework_checkpoint.FrameworkCheckpoint | import ray.cloudpickle as ray_pickle
from ray._common.utils import binary_to_hex, hex_to_binary
from ray.train._checkpoint import Checkpoint
from ray.data.preprocessor import Preprocessor
from typing import Optional
class FrameworkCheckpoint(Checkpoint):
"""A checkpoint to preserve the functionality of legacy
... |
class FrameworkCheckpoint(Checkpoint):
'''A checkpoint to preserve the functionality of legacy
framework-specific checkpoints.
Example:
>>> import tempfile
>>> checkpoint = FrameworkCheckpoint(tempfile.mkdtemp())
>>> checkpoint.get_preprocessor() is None
True
>>> pre... | 3 | 3 | 9 | 1 | 5 | 3 | 2 | 1.73 | 1 | 0 | 0 | 4 | 2 | 0 | 2 | 26 | 35 | 5 | 11 | 5 | 8 | 19 | 9 | 5 | 6 | 2 | 4 | 1 | 3 |
10,561 | ray-project/ray | python/ray/train/_internal/session.py | ray.train._internal.session.TrialInfo | from typing import TYPE_CHECKING, Any, Callable, Dict, Optional, Set, Type
from dataclasses import dataclass
@dataclass
class TrialInfo:
"""The trial information to propagate to TrainSession."""
name: str
id: str
resources: Dict[str, float]
logdir: str
driver_ip: str
driver_node_id: str
... | @dataclass
class TrialInfo:
'''The trial information to propagate to TrainSession.'''
pass | 2 | 1 | 0 | 0 | 0 | 0 | 0 | 0.11 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 11 | 1 | 9 | 3 | 8 | 1 | 9 | 3 | 8 | 0 | 0 | 0 | 0 |
10,562 | ray-project/ray | python/ray/train/_internal/session.py | ray.train._internal.session._FutureTrainingResult | from typing import TYPE_CHECKING, Any, Callable, Dict, Optional, Set, Type
import ray
class _FutureTrainingResult:
"""A future that will be resolved to a `_TrainingResult`.
This is needed for specific schedulers such as PBT that schedule saves.
This wrapper should be removed after refactoring PBT to not ... |
class _FutureTrainingResult:
'''A future that will be resolved to a `_TrainingResult`.
This is needed for specific schedulers such as PBT that schedule saves.
This wrapper should be removed after refactoring PBT to not schedule saves anymore.
'''
def __init__(self, future: ray.ObjectRef):
... | 3 | 2 | 10 | 1 | 7 | 3 | 3 | 0.64 | 0 | 3 | 0 | 1 | 2 | 1 | 2 | 2 | 28 | 5 | 14 | 6 | 11 | 9 | 13 | 5 | 10 | 4 | 0 | 1 | 5 |
10,563 | ray-project/ray | python/ray/train/_internal/session.py | ray.train._internal.session._TrainSession | import queue
import warnings
import platform
import time
from typing import TYPE_CHECKING, Any, Callable, Dict, Optional, Set, Type
from ray.train._internal.storage import StorageContext
from datetime import datetime
from ray.air._internal.util import RunnerThread, StartTraceback
from ray.data import Dataset
from ray.u... | @DeveloperAPI
class _TrainSession:
'''Holds information for training on each worker.'''
def __init__(self, training_func: Callable, world_rank: Optional[int], local_rank: Optional[int], node_rank: Optional[int], local_world_size: Optional[int], world_size: Optional[int], trial_info: Optional[TrialInfo]=None, d... | 31 | 10 | 17 | 2 | 11 | 4 | 2 | 0.34 | 0 | 18 | 6 | 0 | 21 | 26 | 21 | 21 | 389 | 64 | 243 | 94 | 190 | 82 | 161 | 64 | 138 | 11 | 0 | 3 | 48 |
10,564 | ray-project/ray | python/ray/train/_internal/session.py | ray.train._internal.session._TrainingResult | from ray.train import Checkpoint
from typing import TYPE_CHECKING, Any, Callable, Dict, Optional, Set, Type
class _TrainingResult:
"""A (checkpoint, metrics) result reported by the user."""
def __init__(self, checkpoint: Optional[Checkpoint], metrics: Dict[str, Any]):
self.checkpoint = checkpoint
... |
class _TrainingResult:
'''A (checkpoint, metrics) result reported by the user.'''
def __init__(self, checkpoint: Optional[Checkpoint], metrics: Dict[str, Any]):
pass
def __repr__(self) -> str:
pass | 3 | 1 | 3 | 0 | 3 | 0 | 1 | 0.17 | 0 | 3 | 1 | 0 | 2 | 2 | 2 | 2 | 9 | 2 | 6 | 5 | 3 | 1 | 6 | 5 | 3 | 1 | 0 | 0 | 2 |
10,565 | ray-project/ray | python/ray/train/_internal/state/schema.py | ray.train._internal.state.schema.ActorStatusEnum | from enum import Enum
from ray.util.annotations import DeveloperAPI
@DeveloperAPI
class ActorStatusEnum(str, Enum):
DEAD = 'DEAD'
ALIVE = 'ALIVE' | @DeveloperAPI
class ActorStatusEnum(str, Enum):
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 115 | 3 | 0 | 3 | 3 | 2 | 0 | 3 | 3 | 2 | 0 | 4 | 0 | 0 |
10,566 | ray-project/ray | python/ray/train/_internal/state/schema.py | ray.train._internal.state.schema.GPUStats | from ray._common.pydantic_compat import BaseModel, Field
from typing import Dict, List, Optional
from ray.util.annotations import DeveloperAPI
@DeveloperAPI
class GPUStats(BaseModel):
uuid: str
index: int
name: str
utilizationGpu: Optional[float]
memoryUsed: float
memoryTotal: float
process... | @DeveloperAPI
class GPUStats(BaseModel):
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 8 | 0 | 8 | 1 | 7 | 0 | 8 | 1 | 7 | 0 | 1 | 0 | 0 |
10,567 | ray-project/ray | python/ray/train/_internal/state/schema.py | ray.train._internal.state.schema.MemoryInfo | from ray.util.annotations import DeveloperAPI
from typing import Dict, List, Optional
from ray._common.pydantic_compat import BaseModel, Field
@DeveloperAPI
class MemoryInfo(BaseModel):
rss: int
vms: int
pfaults: Optional[int]
pageins: Optional[int] | @DeveloperAPI
class MemoryInfo(BaseModel):
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 | 0 | 5 | 1 | 4 | 0 | 5 | 1 | 4 | 0 | 1 | 0 | 0 |
10,568 | ray-project/ray | python/ray/train/_internal/state/schema.py | ray.train._internal.state.schema.ProcessGPUUsage | from ray._common.pydantic_compat import BaseModel, Field
class ProcessGPUUsage(BaseModel):
pid: int
gpuMemoryUsage: int |
class ProcessGPUUsage(BaseModel):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0.33 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 | 0 | 3 | 1 | 2 | 1 | 3 | 1 | 2 | 0 | 1 | 0 | 0 |
10,569 | ray-project/ray | python/ray/train/_internal/state/schema.py | ray.train._internal.state.schema.ProcessStats | from typing import Dict, List, Optional
from ray._common.pydantic_compat import BaseModel, Field
from ray.util.annotations import DeveloperAPI
@DeveloperAPI
class ProcessStats(BaseModel):
cpuPercent: float
mem: Optional[List[int]]
memoryInfo: MemoryInfo | @DeveloperAPI
class ProcessStats(BaseModel):
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 | 0 | 4 | 1 | 3 | 1 | 4 | 1 | 3 | 0 | 1 | 0 | 0 |
10,570 | ray-project/ray | python/ray/train/_internal/state/schema.py | ray.train._internal.state.schema.RunStatusEnum | from enum import Enum
from ray.util.annotations import DeveloperAPI
@DeveloperAPI
class RunStatusEnum(str, Enum):
"""Enumeration for the status of a train run."""
STARTED = 'STARTED'
RUNNING = 'RUNNING'
FINISHED = 'FINISHED'
ERRORED = 'ERRORED'
ABORTED = 'ABORTED' | @DeveloperAPI
class RunStatusEnum(str, Enum):
'''Enumeration for the status of a train run.'''
pass | 2 | 1 | 0 | 0 | 0 | 0 | 0 | 1.17 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 115 | 14 | 1 | 6 | 6 | 5 | 7 | 6 | 6 | 5 | 0 | 4 | 0 | 0 |
10,571 | ray-project/ray | python/ray/train/_internal/state/schema.py | ray.train._internal.state.schema.TrainDatasetInfo | from ray._common.pydantic_compat import BaseModel, Field
from typing import Dict, List, Optional
from ray.util.annotations import DeveloperAPI
@DeveloperAPI
class TrainDatasetInfo(BaseModel):
name: str = Field(description='The key of the dataset dict specified in Ray Train Trainer.')
dataset_uuid: str = Field(... | @DeveloperAPI
class TrainDatasetInfo(BaseModel):
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 | 0 | 6 | 4 | 5 | 0 | 4 | 4 | 3 | 0 | 1 | 0 | 0 |
10,572 | ray-project/ray | python/ray/train/_internal/state/schema.py | ray.train._internal.state.schema.TrainRunInfo | from ray._common.pydantic_compat import BaseModel, Field
from typing import Dict, List, Optional
from ray.util.annotations import DeveloperAPI
@DeveloperAPI
class TrainRunInfo(BaseModel):
"""Metadata for a Ray Train run and information about its workers."""
name: str = Field(description='The name of the Train ... | @DeveloperAPI
class TrainRunInfo(BaseModel):
'''Metadata for a Ray Train run and information about its workers.'''
pass | 2 | 1 | 0 | 0 | 0 | 0 | 0 | 0.04 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 28 | 1 | 26 | 10 | 25 | 1 | 11 | 10 | 10 | 0 | 1 | 0 | 0 |
10,573 | ray-project/ray | python/ray/train/_internal/state/schema.py | ray.train._internal.state.schema.TrainRunInfoWithDetails | from typing import Dict, List, Optional
from ray._common.pydantic_compat import BaseModel, Field
from ray.util.annotations import DeveloperAPI
from ray.dashboard.modules.job.pydantic_models import JobDetails
@DeveloperAPI
class TrainRunInfoWithDetails(TrainRunInfo):
"""Metadata for a Ray Train run and information ... | @DeveloperAPI
class TrainRunInfoWithDetails(TrainRunInfo):
'''Metadata for a Ray Train run and information about its workers.'''
pass | 2 | 1 | 0 | 0 | 0 | 0 | 0 | 0.14 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 9 | 1 | 7 | 3 | 6 | 1 | 3 | 3 | 2 | 0 | 2 | 0 | 0 |
10,574 | ray-project/ray | python/ray/train/_internal/state/schema.py | ray.train._internal.state.schema.TrainRunsResponse | from ray._common.pydantic_compat import BaseModel, Field
from ray.util.annotations import DeveloperAPI
from typing import Dict, List, Optional
@DeveloperAPI
class TrainRunsResponse(BaseModel):
train_runs: List[TrainRunInfoWithDetails] | @DeveloperAPI
class TrainRunsResponse(BaseModel):
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 1 | 0 | 0 |
10,575 | ray-project/ray | python/ray/train/_internal/state/schema.py | ray.train._internal.state.schema.TrainWorkerInfo | from ray._common.pydantic_compat import BaseModel, Field
from typing import Dict, List, Optional
from ray.util.annotations import DeveloperAPI
@DeveloperAPI
class TrainWorkerInfo(BaseModel):
"""Metadata of a Ray Train worker."""
actor_id: str = Field(description='Actor ID of the worker.')
world_rank: int =... | @DeveloperAPI
class TrainWorkerInfo(BaseModel):
'''Metadata of a Ray Train worker.'''
pass | 2 | 1 | 0 | 0 | 0 | 0 | 0 | 0.06 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 18 | 1 | 16 | 10 | 15 | 1 | 10 | 10 | 9 | 0 | 1 | 0 | 0 |
10,576 | ray-project/ray | python/ray/train/_internal/state/schema.py | ray.train._internal.state.schema.TrainWorkerInfoWithDetails | from ray._common.pydantic_compat import BaseModel, Field
from ray.util.annotations import DeveloperAPI
from typing import Dict, List, Optional
@DeveloperAPI
class TrainWorkerInfoWithDetails(TrainWorkerInfo):
"""Metadata of a Ray Train worker."""
processStats: Optional[ProcessStats] = Field(None, description='P... | @DeveloperAPI
class TrainWorkerInfoWithDetails(TrainWorkerInfo):
'''Metadata of a Ray Train worker.'''
pass | 2 | 1 | 0 | 0 | 0 | 0 | 0 | 0.09 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 13 | 1 | 11 | 3 | 10 | 1 | 3 | 3 | 2 | 0 | 2 | 0 | 0 |
10,577 | ray-project/ray | python/ray/train/_internal/state/state_actor.py | ray.train._internal.state.state_actor.TrainStateActor | from ray.train._internal.state.schema import TrainRunInfo
import os
from typing import Dict, Optional
import logging
from ray._private.event.export_event_logger import EventLogType, check_export_api_enabled, get_export_event_logger
import ray
@ray.remote(num_cpus=0)
class TrainStateActor:
def __init__(self):
... | @ray.remote(num_cpus=0)
class TrainStateActor:
def __init__(self):
pass
def register_train_run(self, run_info: TrainRunInfo) -> None:
pass
def get_train_run(self, run_id: str) -> Optional[TrainRunInfo]:
pass
def get_all_train_runs(self) -> Dict[str, TrainRunInfo]:
pas... | 10 | 1 | 3 | 0 | 2 | 1 | 1 | 0.33 | 0 | 2 | 1 | 0 | 4 | 1 | 4 | 4 | 15 | 3 | 9 | 6 | 4 | 3 | 9 | 6 | 4 | 1 | 0 | 0 | 4 |
10,578 | ray-project/ray | python/ray/train/_internal/state/state_manager.py | ray.train._internal.state.state_manager.TrainRunStateManager | import ray
import os
from typing import Any, Dict, List
from ray.train._internal.utils import check_for_failure
from ray.data import Dataset
from ray.train._internal.worker_group import WorkerGroup
from ray.train._internal.state.schema import ActorStatusEnum, RunStatusEnum, TrainDatasetInfo, TrainRunInfo, TrainWorkerIn... |
class TrainRunStateManager:
'''A class that aggregates and reports train run info to TrainStateActor.
This manager class is created on the train controller layer for each run.
'''
def __init__(self, state_actor) -> None:
pass
def register_train_run(self, run_id: str, job_id: str, run_... | 6 | 4 | 22 | 2 | 20 | 1 | 2 | 0.08 | 0 | 11 | 5 | 0 | 4 | 2 | 4 | 4 | 107 | 14 | 86 | 34 | 63 | 7 | 31 | 17 | 25 | 3 | 0 | 1 | 8 |
10,579 | ray-project/ray | python/ray/train/_internal/storage.py | ray.train._internal.storage.StorageContext | from ray.util.annotations import DeveloperAPI
import os
from typing import TYPE_CHECKING, Callable, Dict, List, Optional, Tuple, Type, Union
from ray.train.constants import _get_ray_train_session_dir
from ray.train._internal.syncer import SyncConfig, Syncer, _BackgroundSyncer
from pathlib import Path
@DeveloperAPI
cla... | @DeveloperAPI
class StorageContext:
'''Shared context that holds the source of truth for all paths and
storage utilities, passed along from the driver to workers.
This object defines a few types of paths:
1. *_fs_path: A path on the `storage_filesystem`. This is a regular path
which has been pre... | 28 | 14 | 16 | 2 | 9 | 5 | 1 | 0.98 | 0 | 9 | 3 | 1 | 15 | 9 | 17 | 17 | 367 | 61 | 155 | 52 | 117 | 152 | 78 | 35 | 57 | 4 | 0 | 1 | 25 |
10,580 | ray-project/ray | python/ray/train/_internal/storage.py | ray.train._internal.storage._ExcludingLocalFilesystem | from typing import TYPE_CHECKING, Callable, Dict, List, Optional, Tuple, Type, Union
import fnmatch
from pathlib import Path
class _ExcludingLocalFilesystem(LocalFileSystem):
"""LocalFileSystem wrapper to exclude files according to patterns.
Args:
root_path: Root path to strip when matching with the e... |
class _ExcludingLocalFilesystem(LocalFileSystem):
'''LocalFileSystem wrapper to exclude files according to patterns.
Args:
root_path: Root path to strip when matching with the exclude pattern.
Ex: root_path="/tmp/a/b/c", exclude=["*a*"], will exclude
/tmp/a/b/c/_a_.txt but not A... | 6 | 3 | 8 | 0 | 7 | 1 | 2 | 0.43 | 1 | 4 | 0 | 0 | 4 | 2 | 4 | 127 | 50 | 7 | 30 | 12 | 24 | 13 | 22 | 11 | 17 | 4 | 5 | 2 | 8 |
10,581 | ray-project/ray | python/ray/train/_internal/storage.py | ray.train._internal.storage._FilesystemSyncer | from ray.train._internal.syncer import SyncConfig, Syncer, _BackgroundSyncer
from typing import TYPE_CHECKING, Callable, Dict, List, Optional, Tuple, Type, Union
class _FilesystemSyncer(_BackgroundSyncer):
"""Syncer between local filesystem and a `storage_filesystem`."""
def __init__(self, storage_filesystem:... |
class _FilesystemSyncer(_BackgroundSyncer):
'''Syncer between local filesystem and a `storage_filesystem`.'''
def __init__(self, storage_filesystem: Optional['pyarrow.fs.FileSystem'], **kwargs):
pass
def _sync_up_command(self, local_path: str, uri: str, exclude: Optional[List]=None) -> Tuple[Call... | 5 | 1 | 8 | 0 | 7 | 1 | 1 | 0.1 | 1 | 3 | 0 | 3 | 4 | 1 | 4 | 48 | 37 | 4 | 30 | 11 | 23 | 3 | 13 | 9 | 8 | 1 | 6 | 0 | 4 |
10,582 | ray-project/ray | python/ray/train/_internal/syncer.py | ray.train._internal.syncer.SyncConfig | from dataclasses import dataclass
from ray.util.annotations import Deprecated, DeveloperAPI
from ray.widgets import Template
from ray._private.thirdparty.tabulate.tabulate import tabulate
@Deprecated
@dataclass
class SyncConfig:
sync_period: int = DEFAULT_SYNC_PERIOD
sync_timeout: int = DEFAULT_SYNC_TIMEOUT
... | @Deprecated
@dataclass
class SyncConfig:
def _repr_html_(self) -> str:
'''Generate an HTML representation of the SyncConfig.'''
pass | 4 | 1 | 14 | 0 | 13 | 1 | 1 | 0.06 | 0 | 2 | 1 | 1 | 1 | 0 | 1 | 1 | 20 | 1 | 18 | 6 | 16 | 1 | 7 | 6 | 5 | 1 | 0 | 0 | 1 |
10,583 | ray-project/ray | python/ray/train/_internal/syncer.py | ray.train._internal.syncer.Syncer | from ray.util.annotations import Deprecated, DeveloperAPI
import abc
import time
import traceback
from typing import Any, Callable, Dict, List, Optional, Tuple
@DeveloperAPI
class Syncer(abc.ABC):
"""Syncer class for synchronizing data between Ray nodes and remote (cloud) storage.
This class handles data tran... | @DeveloperAPI
class Syncer(abc.ABC):
'''Syncer class for synchronizing data between Ray nodes and remote (cloud) storage.
This class handles data transfer for two cases:
1. Synchronizing data such as experiment state snapshots from the driver to
cloud storage.
2. Synchronizing data such as trial ... | 17 | 8 | 13 | 2 | 6 | 5 | 1 | 1 | 1 | 8 | 0 | 1 | 12 | 4 | 12 | 32 | 193 | 35 | 79 | 40 | 51 | 79 | 52 | 24 | 39 | 4 | 4 | 3 | 17 |
10,584 | ray-project/ray | python/ray/train/_internal/syncer.py | ray.train._internal.syncer._BackgroundProcess | import time
import threading
from typing import Any, Callable, Dict, List, Optional, Tuple
class _BackgroundProcess:
def __init__(self, fn: Callable):
self._fn = fn
self._process = None
self._result = {}
self._start_time = float('-inf')
@property
def is_running(self):
... |
class _BackgroundProcess:
def __init__(self, fn: Callable):
pass
@property
def is_running(self):
pass
@property
def start_time(self):
pass
def start_time(self):
pass
def entrypoint():
pass
def wait(self, timeout: Optional[float]=Non... | 9 | 1 | 11 | 2 | 9 | 1 | 2 | 0.06 | 0 | 6 | 0 | 1 | 5 | 4 | 5 | 5 | 66 | 15 | 48 | 19 | 39 | 3 | 43 | 16 | 36 | 5 | 0 | 1 | 12 |
10,585 | ray-project/ray | python/ray/train/_internal/syncer.py | ray.train._internal.syncer._BackgroundSyncer | import traceback
from typing import Any, Callable, Dict, List, Optional, Tuple
import time
class _BackgroundSyncer(Syncer):
"""Syncer using a background process for asynchronous file transfer."""
def __init__(self, sync_period: float=DEFAULT_SYNC_PERIOD, sync_timeout: float=DEFAULT_SYNC_TIMEOUT):
supe... |
class _BackgroundSyncer(Syncer):
'''Syncer using a background process for asynchronous file transfer.'''
def __init__(self, sync_period: float=DEFAULT_SYNC_PERIOD, sync_timeout: float=DEFAULT_SYNC_TIMEOUT):
pass
def _should_continue_existing_sync(self):
'''Returns whether a previous sync ... | 13 | 3 | 8 | 1 | 7 | 0 | 2 | 0.07 | 1 | 8 | 1 | 1 | 12 | 2 | 12 | 44 | 114 | 19 | 89 | 31 | 66 | 6 | 59 | 20 | 46 | 3 | 5 | 2 | 20 |
10,586 | ray-project/ray | python/ray/train/_internal/utils.py | ray.train._internal.utils.ActorWrapper | from ray.actor import ActorHandle
import ray
class ActorWrapper:
"""Wraps an actor to provide same API as using the base class directly."""
def __init__(self, actor: ActorHandle):
self.actor = actor
def __getattr__(self, item):
actor_method = getattr(self.actor, item)
return lambd... |
class ActorWrapper:
'''Wraps an actor to provide same API as using the base class directly.'''
def __init__(self, actor: ActorHandle):
pass
def __getattr__(self, item):
pass | 3 | 1 | 4 | 0 | 3 | 1 | 1 | 0.5 | 0 | 1 | 1 | 0 | 2 | 1 | 2 | 2 | 11 | 2 | 6 | 5 | 3 | 3 | 6 | 5 | 3 | 1 | 0 | 0 | 2 |
10,587 | ray-project/ray | python/ray/train/_internal/utils.py | ray.train._internal.utils.Singleton | import abc
class Singleton(abc.ABCMeta):
"""Singleton Abstract Base Class
https://stackoverflow.com/questions/33364070/implementing
-singleton-as-metaclass-but-for-abstract-classes
"""
_instances = {}
def __call__(cls, *args, **kwargs):
if cls not in cls._instances:
cls._i... |
class Singleton(abc.ABCMeta):
'''Singleton Abstract Base Class
https://stackoverflow.com/questions/33364070/implementing
-singleton-as-metaclass-but-for-abstract-classes
'''
def __call__(cls, *args, **kwargs):
pass | 2 | 1 | 4 | 0 | 4 | 0 | 2 | 0.67 | 1 | 1 | 0 | 1 | 1 | 0 | 1 | 21 | 13 | 3 | 6 | 3 | 4 | 4 | 6 | 3 | 4 | 2 | 3 | 1 | 2 |
10,588 | ray-project/ray | python/ray/train/_internal/worker_group.py | ray.train._internal.worker_group.RayTrainWorker | from typing import Callable, Dict, List, Optional, Tuple, Type, TypeVar, Union
from ray.air._internal.util import exception_cause, skip_exceptions
class RayTrainWorker:
"""A class to execute arbitrary functions. Does not hold any state."""
def __execute(self, func: Callable[..., T], *args, **kwargs) -> T:
... |
class RayTrainWorker:
'''A class to execute arbitrary functions. Does not hold any state.'''
def __execute(self, func: Callable[..., T], *args, **kwargs) -> T:
'''Executes the input function and returns the output.
Args:
func: The function to execute.
args, kwargs: The ... | 2 | 2 | 12 | 1 | 6 | 5 | 2 | 0.86 | 0 | 1 | 0 | 1 | 1 | 0 | 1 | 1 | 15 | 2 | 7 | 4 | 5 | 6 | 7 | 3 | 5 | 2 | 0 | 1 | 2 |
10,589 | ray-project/ray | python/ray/train/_internal/worker_group.py | ray.train._internal.worker_group.Worker | from ray.actor import ActorHandle
from dataclasses import dataclass
@dataclass
class Worker:
"""Class representing a Worker."""
actor: ActorHandle
metadata: WorkerMetadata | @dataclass
class Worker:
'''Class representing a Worker.'''
pass | 2 | 1 | 0 | 0 | 0 | 0 | 0 | 0.33 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 | 1 | 3 | 1 | 2 | 1 | 3 | 1 | 2 | 0 | 0 | 0 | 0 |
10,590 | ray-project/ray | python/ray/train/_internal/worker_group.py | ray.train._internal.worker_group.WorkerGroup | import ray
from typing import Callable, Dict, List, Optional, Tuple, Type, TypeVar, Union
from ray.util.placement_group import PlacementGroup
from collections import defaultdict
from ray.types import ObjectRef
class WorkerGroup:
"""Group of Ray Actors that can execute arbitrary functions.
``WorkerGroup`` laun... |
class WorkerGroup:
'''Group of Ray Actors that can execute arbitrary functions.
``WorkerGroup`` launches Ray actors according to the given
specification. It can then execute arbitrary Python functions in each of
these workers.
If not enough resources are available to launch the actors, the Ray
... | 13 | 10 | 24 | 4 | 13 | 8 | 3 | 0.77 | 0 | 11 | 4 | 0 | 11 | 10 | 11 | 11 | 325 | 61 | 149 | 52 | 124 | 115 | 92 | 40 | 79 | 5 | 0 | 3 | 33 |
10,591 | ray-project/ray | python/ray/train/_internal/worker_group.py | ray.train._internal.worker_group.WorkerMetadata | from typing import Callable, Dict, List, Optional, Tuple, Type, TypeVar, Union
from dataclasses import dataclass
@dataclass
class WorkerMetadata:
"""Metadata for each worker/actor.
This information is expected to stay the same throughout the lifetime of
actor.
Args:
node_id: ID of the node th... | @dataclass
class WorkerMetadata:
'''Metadata for each worker/actor.
This information is expected to stay the same throughout the lifetime of
actor.
Args:
node_id: ID of the node this worker is on.
node_ip: IP address of the node this worker is on.
hostname: Hostname that this wor... | 2 | 1 | 0 | 0 | 0 | 0 | 0 | 1.83 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 20 | 3 | 6 | 1 | 5 | 11 | 6 | 1 | 5 | 0 | 0 | 0 | 0 |
10,592 | ray-project/ray | python/ray/train/backend.py | ray.train.backend.Backend | from ray.train._internal.utils import Singleton
from ray.util.annotations import DeveloperAPI
from ray.train._internal.worker_group import WorkerGroup
@DeveloperAPI
class Backend(metaclass=Singleton):
"""Singleton for distributed communication backend.
Attributes:
share_cuda_visible_devices: If True, ... | @DeveloperAPI
class Backend(metaclass=Singleton):
'''Singleton for distributed communication backend.
Attributes:
share_cuda_visible_devices: If True, each worker
process will have CUDA_VISIBLE_DEVICES set as the visible device
IDs of all workers on the same node for this trainin... | 5 | 4 | 4 | 0 | 3 | 1 | 1 | 1.2 | 1 | 2 | 2 | 14 | 3 | 0 | 3 | 24 | 28 | 6 | 10 | 7 | 4 | 12 | 8 | 5 | 4 | 1 | 4 | 0 | 3 |
10,593 | ray-project/ray | python/ray/train/backend.py | ray.train.backend.BackendConfig | from contextlib import nullcontext
from ray.widgets import make_table_html_repr
from ray.util.annotations import DeveloperAPI
@DeveloperAPI
class BackendConfig:
"""Parent class for configurations of training backend."""
@property
def backend_cls(self):
return Backend
@property
def train_f... | @DeveloperAPI
class BackendConfig:
'''Parent class for configurations of training backend.'''
@property
def backend_cls(self):
pass
@property
def train_func_context(self):
pass
def _repr_html_(self) -> str:
pass | 7 | 1 | 2 | 0 | 2 | 0 | 1 | 0.11 | 0 | 4 | 1 | 12 | 3 | 0 | 3 | 3 | 13 | 3 | 9 | 6 | 3 | 1 | 7 | 4 | 3 | 1 | 0 | 0 | 3 |
10,594 | ray-project/ray | python/ray/train/base_trainer.py | ray.train.base_trainer.BaseTrainer | from ray.train.utils import _log_deprecation_warning
from ray._private.dict import deep_update
from ray.train import Checkpoint
from functools import partial
from ray.train._internal.storage import StorageContext, _exists_at_fs_path, get_fs_and_path
from ray.air._internal.usage import AirEntrypoint
from ray.air._intern... | @DeveloperAPI
class BaseTrainer(abc.ABC):
'''Defines interface for distributed training on Ray.
Note: The base ``BaseTrainer`` class cannot be instantiated directly. Only
one of its subclasses can be used.
Note to developers: If a new trainer is added, please update
`air/_internal/usage.py`.
**H... | 36 | 18 | 32 | 5 | 17 | 10 | 3 | 0.75 | 1 | 29 | 12 | 7 | 13 | 7 | 16 | 36 | 784 | 142 | 367 | 134 | 292 | 275 | 217 | 90 | 185 | 10 | 4 | 3 | 71 |
10,595 | ray-project/ray | python/ray/train/base_trainer.py | ray.train.base_trainer.TrainingFailedError | from ray.util.annotations import Deprecated, DeveloperAPI, PublicAPI
@PublicAPI(stability='beta')
class TrainingFailedError(RuntimeError):
"""An error indicating that training has failed."""
_RESTORE_MSG = 'The Ray Train run failed. Please inspect the previous error messages for a cause. After fixing the issue... | @PublicAPI(stability='beta')
class TrainingFailedError(RuntimeError):
'''An error indicating that training has failed.'''
pass | 2 | 1 | 0 | 0 | 0 | 0 | 0 | 0.07 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 11 | 18 | 2 | 15 | 3 | 14 | 1 | 3 | 3 | 2 | 0 | 4 | 0 | 0 |
10,596 | ray-project/ray | python/ray/train/context.py | ray.train.context.TrainContext | from ray.train.utils import _copy_doc, _log_deprecation_warning
from ray.train.constants import V2_MIGRATION_GUIDE_MESSAGE, _v2_migration_warnings_enabled
from ray.train._internal import session
from typing import TYPE_CHECKING, Any, Dict, Optional
from ray.util.annotations import Deprecated, DeveloperAPI, PublicAPI
fr... | @PublicAPI(stability='stable')
class TrainContext:
'''Context containing metadata that can be accessed within Ray Train workers.'''
@_copy_doc(session.get_experiment_name)
def get_experiment_name(self) -> str:
pass
@_copy_doc(session.get_world_size)
def get_world_size(self) -> int:
p... | 32 | 1 | 2 | 0 | 2 | 0 | 1 | 0.03 | 0 | 4 | 1 | 1 | 12 | 0 | 12 | 12 | 75 | 13 | 60 | 42 | 12 | 2 | 25 | 13 | 12 | 1 | 0 | 0 | 12 |
10,597 | ray-project/ray | python/ray/train/data_parallel_trainer.py | ray.train.data_parallel_trainer.DataParallelTrainer | import ray
from ray._private.thirdparty.tabulate.tabulate import tabulate
from ray.train import BackendConfig, Checkpoint, TrainingIterator
from ray._private.ray_constants import env_integer
from ray.air.config import RunConfig, ScalingConfig
from ray.train._internal.data_config import DataConfig
from ray.widgets.util ... | @DeveloperAPI
class DataParallelTrainer(BaseTrainer):
'''A Trainer for data parallel training.
You should subclass this Trainer if your Trainer follows SPMD (single program,
multiple data) programming paradigm - you want multiple processes to run the same
function, but on different data.
This Traine... | 19 | 5 | 27 | 4 | 19 | 4 | 3 | 0.72 | 1 | 10 | 6 | 13 | 11 | 6 | 13 | 49 | 563 | 111 | 263 | 78 | 220 | 189 | 117 | 51 | 100 | 6 | 5 | 3 | 36 |
10,598 | ray-project/ray | python/ray/train/error.py | ray.train.error.SessionMisuseError | from ray.util.annotations import PublicAPI
@PublicAPI(stability='beta')
class SessionMisuseError(Exception):
"""Indicates a method or function was used outside of a session.""" | @PublicAPI(stability='beta')
class SessionMisuseError(Exception):
'''Indicates a method or function was used outside of a session.'''
pass | 2 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 10 | 2 | 0 | 1 | 1 | 0 | 1 | 1 | 1 | 0 | 0 | 3 | 0 | 0 |
10,599 | ray-project/ray | python/ray/train/examples/horovod/horovod_example.py | ray.train.examples.horovod.horovod_example.HorovodTrainClass | import torch.utils.data.distributed
import torch.nn as nn
import horovod.torch as hvd
import torch.nn.functional as F
import torch.optim as optim
class HorovodTrainClass:
def __init__(self, config):
self.log_interval = config.get('log_interval', 10)
self.use_cuda = config.get('use_cuda', False)
... |
class HorovodTrainClass:
def __init__(self, config):
pass
def train(self, epoch):
pass | 3 | 0 | 11 | 1 | 10 | 0 | 2 | 0 | 0 | 0 | 0 | 0 | 2 | 6 | 2 | 2 | 23 | 3 | 20 | 7 | 17 | 0 | 10 | 7 | 7 | 2 | 0 | 1 | 3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.