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,900 | ray-project/ray | python/ray/tune/utils/mock_trainable.py | ray.tune.utils.mock_trainable.MyTrainableClass | import time
import numpy as np
import json
import os
from ray.tune import Trainable
class MyTrainableClass(Trainable):
"""Example agent whose learning curve is a random sigmoid.
The dummy hyperparameters "width" and "height" determine the slope and
maximum reward value reached.
"""
def setup(self... |
class MyTrainableClass(Trainable):
'''Example agent whose learning curve is a random sigmoid.
The dummy hyperparameters "width" and "height" determine the slope and
maximum reward value reached.
'''
def setup(self, config):
pass
def step(self):
pass
def save_checkpoint(se... | 5 | 1 | 9 | 1 | 7 | 1 | 2 | 0.24 | 1 | 2 | 0 | 1 | 4 | 5 | 4 | 4 | 45 | 10 | 29 | 15 | 24 | 7 | 25 | 13 | 20 | 3 | 1 | 1 | 6 |
10,901 | ray-project/ray | python/ray/tune/utils/object_cache.py | ray.tune.utils.object_cache._ObjectCache | from collections import Counter, defaultdict
from typing import Dict, Generator, List, Optional, TypeVar
class _ObjectCache:
"""Cache up to some maximum count given a grouping key.
This object cache can e.g. be used to cache Ray Tune trainable actors
given their resource requirements (reuse_actors=True).
... |
class _ObjectCache:
'''Cache up to some maximum count given a grouping key.
This object cache can e.g. be used to cache Ray Tune trainable actors
given their resource requirements (reuse_actors=True).
If the max number of cached objects for a grouping key is reached,
no more objects for this group ... | 12 | 7 | 15 | 3 | 5 | 7 | 2 | 1.57 | 0 | 4 | 0 | 0 | 9 | 4 | 9 | 9 | 164 | 43 | 47 | 19 | 35 | 74 | 41 | 17 | 31 | 5 | 0 | 2 | 18 |
10,902 | ray-project/ray | python/ray/tune/utils/resource_updater.py | ray.tune.utils.resource_updater._ResourceUpdater | import time
from ray._common.constants import NODE_ID_PREFIX
import os
import ray
from typing import Any, Dict, Optional
class _ResourceUpdater:
"""Periodic Resource updater for Tune.
Initially, all resources are set to 0. The updater will try to update resources
when (1) init ResourceUpdater (2) call "up... |
class _ResourceUpdater:
'''Periodic Resource updater for Tune.
Initially, all resources are set to 0. The updater will try to update resources
when (1) init ResourceUpdater (2) call "update_avail_resources", "num_cpus"
or "num_gpus".
The update takes effect when (1) Ray is initialized (2) the inter... | 8 | 2 | 18 | 1 | 15 | 1 | 2 | 0.15 | 0 | 7 | 1 | 1 | 7 | 3 | 7 | 7 | 142 | 18 | 109 | 30 | 101 | 16 | 62 | 26 | 54 | 7 | 0 | 2 | 17 |
10,903 | ray-project/ray | python/ray/tune/utils/resource_updater.py | ray.tune.utils.resource_updater._Resources | from numbers import Number
from ray._common.constants import NODE_ID_PREFIX
from typing import Any, Dict, Optional
from collections import namedtuple
class _Resources(namedtuple('_Resources', ['cpu', 'gpu', 'memory', 'object_store_memory', 'extra_cpu', 'extra_gpu', 'extra_memory', 'extra_object_store_memory', 'custom_... |
class _Resources(namedtuple('_Resources', ['cpu', 'gpu', 'memory', 'object_store_memory', 'extra_cpu', 'extra_gpu', 'extra_memory', 'extra_object_store_memory', 'custom_resources', 'extra_custom_resources', 'has_placement_group'])):
'''Ray resources required to schedule a trial.
Parameters:
cpu: Number... | 12 | 1 | 15 | 0 | 15 | 0 | 2 | 0.14 | 1 | 7 | 0 | 0 | 9 | 0 | 10 | 15 | 206 | 16 | 167 | 61 | 125 | 23 | 66 | 30 | 55 | 4 | 1 | 1 | 15 |
10,904 | ray-project/ray | python/ray/tune/utils/serialization.py | ray.tune.utils.serialization.TuneFunctionDecoder | from ray import cloudpickle as cloudpickle
from ray.util.annotations import DeveloperAPI
from ray._common.utils import binary_to_hex, hex_to_binary
import json
@DeveloperAPI
class TuneFunctionDecoder(json.JSONDecoder):
def __init__(self, *args, **kwargs):
json.JSONDecoder.__init__(self, *args, object_hook... | @DeveloperAPI
class TuneFunctionDecoder(json.JSONDecoder):
def __init__(self, *args, **kwargs):
pass
def object_hook(self, obj):
pass
def _from_cloudpickle(self, obj):
pass | 5 | 0 | 3 | 0 | 3 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 3 | 0 | 3 | 6 | 11 | 2 | 9 | 4 | 5 | 0 | 9 | 4 | 5 | 2 | 2 | 1 | 4 |
10,905 | ray-project/ray | python/ray/tune/utils/serialization.py | ray.tune.utils.serialization.TuneFunctionEncoder | from ray.util.annotations import DeveloperAPI
import types
from ray.util.debug import log_once
from ray._common.utils import binary_to_hex, hex_to_binary
import json
from ray import cloudpickle as cloudpickle
@DeveloperAPI
class TuneFunctionEncoder(json.JSONEncoder):
def default(self, obj):
if isinstance(... | @DeveloperAPI
class TuneFunctionEncoder(json.JSONEncoder):
def default(self, obj):
pass
def _to_cloudpickle(self, obj):
pass | 4 | 0 | 7 | 0 | 7 | 0 | 3 | 0 | 1 | 3 | 0 | 0 | 2 | 0 | 2 | 6 | 16 | 1 | 15 | 3 | 12 | 0 | 12 | 3 | 9 | 4 | 2 | 2 | 5 |
10,906 | ray-project/ray | python/ray/tune/utils/util.py | ray.tune.utils.util.Tee | from ray.util.annotations import DeveloperAPI, PublicAPI
@DeveloperAPI
class Tee(object):
def __init__(self, stream1, stream2):
self.stream1 = stream1
self.stream2 = stream2
self._handling_warning = False
def _warn(self, op, s, args, kwargs):
if self._handling_warning:
... | @DeveloperAPI
class Tee(object):
def __init__(self, stream1, stream2):
pass
def _warn(self, op, s, args, kwargs):
pass
def seek(self, *args, **kwargs):
pass
def write(self, *args, **kwargs):
pass
def flush(self, *args, **kwargs):
pass
@property
de... | 17 | 0 | 5 | 0 | 4 | 1 | 2 | 0.11 | 1 | 2 | 0 | 0 | 12 | 3 | 12 | 12 | 74 | 14 | 54 | 23 | 38 | 6 | 51 | 20 | 38 | 3 | 1 | 2 | 22 |
10,907 | ray-project/ray | python/ray/tune/utils/util.py | ray.tune.utils.util.UtilMonitor | import time
from collections import defaultdict
from threading import Thread
import numpy as np
import copy
from ray.util.annotations import DeveloperAPI, PublicAPI
import threading
import psutil
@DeveloperAPI
class UtilMonitor(Thread):
"""Class for system usage utilization monitoring.
It keeps track of CPU, ... | @DeveloperAPI
class UtilMonitor(Thread):
'''Class for system usage utilization monitoring.
It keeps track of CPU, RAM, GPU, VRAM usage (each gpu separately) by
pinging for information every x seconds in a separate thread.
Requires psutil and GPUtil to be installed. Can be enabled with
Tuner(param_sp... | 7 | 1 | 12 | 1 | 11 | 0 | 3 | 0.13 | 1 | 5 | 0 | 0 | 5 | 6 | 5 | 30 | 72 | 11 | 55 | 17 | 49 | 7 | 47 | 17 | 41 | 5 | 1 | 3 | 16 |
10,908 | ray-project/ray | python/ray/tune/utils/util.py | ray.tune.utils.util.warn_if_slow | from ray.util.annotations import DeveloperAPI, PublicAPI
import os
import time
from typing import Any, Callable, Dict, List, Optional, Sequence, Type, Union
@DeveloperAPI
class warn_if_slow:
"""Prints a warning if a given operation is slower than 500ms.
Example:
>>> from ray.tune.utils.util import war... | @DeveloperAPI
class warn_if_slow:
'''Prints a warning if a given operation is slower than 500ms.
Example:
>>> from ray.tune.utils.util import warn_if_slow
>>> something = ... # doctest: +SKIP
>>> with warn_if_slow("some_operation"): # doctest: +SKIP
... ray.get(something) # do... | 5 | 1 | 8 | 0 | 8 | 0 | 2 | 0.24 | 0 | 3 | 0 | 0 | 3 | 6 | 3 | 3 | 41 | 5 | 29 | 20 | 19 | 7 | 20 | 14 | 16 | 3 | 0 | 1 | 5 |
10,909 | ray-project/ray | python/ray/types.py | ray.types.ObjectRef | from typing import Generic, TypeVar
from ray.util.annotations import PublicAPI
@PublicAPI
class ObjectRef(Generic[T]):
pass | @PublicAPI
class ObjectRef(Generic[T]):
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 1 | 0 | 0 |
10,910 | ray-project/ray | python/ray/util/actor_group.py | ray.util.actor_group.ActorConfig | from typing import Dict, List, Optional, Tuple, Type, TypeVar
from dataclasses import dataclass
@dataclass
class ActorConfig:
num_cpus: float
num_gpus: float
resources: Optional[Dict[str, float]]
init_args: Tuple
init_kwargs: Dict | @dataclass
class ActorConfig:
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 | 0 | 6 | 1 | 5 | 0 | 6 | 1 | 5 | 0 | 0 | 0 | 0 |
10,911 | ray-project/ray | python/ray/util/actor_group.py | ray.util.actor_group.ActorGroup | from typing import Dict, List, Optional, Tuple, Type, TypeVar
from ray.util.annotations import Deprecated
from ray._private.utils import get_ray_doc_version
import ray
@Deprecated(message=f'For stateless/task processing, use ray.util.multiprocessing, see details in https://docs.ray.io/en/{get_ray_doc_version()}/ray-mo... | @Deprecated(message=f'For stateless/task processing, use ray.util.multiprocessing, see details in https://docs.ray.io/en/{get_ray_doc_version()}/ray-more-libs/multiprocessing.html. For stateful/actor processing such as batch prediction, use Datasets.map_batches(compute=ActorPoolStrategy, ...), see details in https://do... | 12 | 5 | 15 | 2 | 11 | 2 | 3 | 0.42 | 0 | 9 | 3 | 0 | 9 | 4 | 9 | 9 | 169 | 28 | 99 | 36 | 78 | 42 | 61 | 26 | 50 | 5 | 0 | 3 | 23 |
10,912 | ray-project/ray | python/ray/util/actor_group.py | ray.util.actor_group.ActorGroupMethod | import weakref
class ActorGroupMethod:
def __init__(self, actor_group: 'ActorGroup', method_name: str):
self.actor_group = weakref.ref(actor_group)
self._method_name = method_name
def __call__(self, *args, **kwargs):
raise TypeError(f"ActorGroup methods cannot be called directly. Inst... |
class ActorGroupMethod:
def __init__(self, actor_group: 'ActorGroup', method_name: str):
pass
def __call__(self, *args, **kwargs):
pass
def remote(self, *args, **kwargs):
pass | 4 | 0 | 5 | 0 | 5 | 0 | 1 | 0 | 0 | 2 | 0 | 0 | 3 | 2 | 3 | 3 | 18 | 2 | 16 | 6 | 12 | 0 | 8 | 6 | 4 | 1 | 0 | 0 | 3 |
10,913 | ray-project/ray | python/ray/util/actor_group.py | ray.util.actor_group.ActorWrapper | from ray.actor import ActorHandle
from dataclasses import dataclass
@dataclass
class ActorWrapper:
"""Class containing an actor and its metadata."""
actor: ActorHandle
metadata: ActorMetadata | @dataclass
class ActorWrapper:
'''Class containing an actor and its metadata.'''
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,914 | ray-project/ray | python/ray/util/actor_pool.py | ray.util.actor_pool.ActorPool | import ray
from ray.util.annotations import DeveloperAPI
from typing import TYPE_CHECKING, Any, Callable, List, TypeVar
@DeveloperAPI
class ActorPool:
"""Utility class to operate on a fixed pool of actors.
Arguments:
actors: List of Ray actor handles to use in this pool.
Examples:
.. test... | @DeveloperAPI
class ActorPool:
'''Utility class to operate on a fixed pool of actors.
Arguments:
actors: List of Ray actor handles to use in this pool.
Examples:
.. testcode::
import ray
from ray.util.actor_pool import ActorPool
@ray.remote
cla... | 15 | 10 | 32 | 6 | 9 | 17 | 3 | 2.04 | 0 | 8 | 0 | 0 | 11 | 6 | 11 | 11 | 451 | 101 | 115 | 40 | 98 | 235 | 102 | 38 | 87 | 8 | 0 | 3 | 38 |
10,915 | ray-project/ray | python/ray/util/annotations.py | ray.util.annotations.AnnotationType | from enum import Enum
class AnnotationType(Enum):
PUBLIC_API = 'PublicAPI'
DEVELOPER_API = 'DeveloperAPI'
DEPRECATED = 'Deprecated'
UNKNOWN = 'Unknown' |
class AnnotationType(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,916 | ray-project/ray | python/ray/util/annotations.py | ray.util.annotations.RayDeprecationWarning | class RayDeprecationWarning(DeprecationWarning):
"""Specialized Deprecation Warning for fine grained filtering control"""
pass | class RayDeprecationWarning(DeprecationWarning):
'''Specialized Deprecation Warning for fine grained filtering control'''
pass | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 12 | 4 | 1 | 2 | 1 | 1 | 1 | 2 | 1 | 1 | 0 | 5 | 0 | 0 |
10,917 | ray-project/ray | python/ray/util/check_serialize.py | ray.util.check_serialize.FailureTuple | from ray.util.annotations import DeveloperAPI
from typing import Any, Optional, Set, Tuple
@DeveloperAPI
class FailureTuple:
"""Represents the serialization 'frame'.
Attributes:
obj: The object that fails serialization.
name: The variable name of the object.
parent: The object that ref... | @DeveloperAPI
class FailureTuple:
'''Represents the serialization 'frame'.
Attributes:
obj: The object that fails serialization.
name: The variable name of the object.
parent: The object that references the `obj`.
'''
def __init__(self, obj: Any, name: str, parent: Any):
... | 4 | 1 | 3 | 0 | 3 | 0 | 1 | 0.86 | 0 | 2 | 0 | 0 | 2 | 3 | 2 | 2 | 16 | 3 | 7 | 6 | 4 | 6 | 7 | 6 | 4 | 1 | 0 | 0 | 2 |
10,918 | ray-project/ray | python/ray/util/check_serialize.py | ray.util.check_serialize._Printer | class _Printer:
def __init__(self, print_file):
self.level = 0
self.print_file = print_file
def indent(self):
return _indent(self)
def print(self, msg):
indent = ' ' * self.level
print(indent + msg, file=self.print_file) | class _Printer:
def __init__(self, print_file):
pass
def indent(self):
pass
def print(self, msg):
pass | 4 | 0 | 3 | 0 | 3 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 | 2 | 3 | 3 | 11 | 2 | 9 | 7 | 5 | 0 | 9 | 7 | 5 | 1 | 0 | 0 | 3 |
10,919 | ray-project/ray | python/ray/util/client/__init__.py | ray.util.client.RayAPIStub | import threading
from ray._private.client_mode_hook import _explicitly_disable_client_mode, _explicitly_enable_client_mode
from ray.util.annotations import DeveloperAPI
@DeveloperAPI
class RayAPIStub:
"""This class stands in as the replacement API for the `import ray` module.
Much like the ray module, this mo... | @DeveloperAPI
class RayAPIStub:
'''This class stands in as the replacement API for the `import ray` module.
Much like the ray module, this mostly delegates the work to the
_client_worker. As parts of the ray API are covered, they are piped through
here or on the client worker API.
'''
def __ini... | 13 | 1 | 6 | 0 | 6 | 0 | 2 | 0.08 | 0 | 4 | 1 | 0 | 11 | 2 | 11 | 11 | 82 | 12 | 65 | 23 | 49 | 5 | 62 | 23 | 46 | 5 | 0 | 3 | 21 |
10,920 | ray-project/ray | python/ray/util/client/__init__.py | ray.util.client._ClientContext | from typing import Any, Dict, List, Optional, Tuple
import os
from ray._private.utils import check_version_info
from ray._private.ray_logging import setup_logger
from ray.job_config import JobConfig
from ray._private.client_mode_hook import _explicitly_disable_client_mode, _explicitly_enable_client_mode
import ray._pri... |
class _ClientContext:
def __init__(self):
pass
def connect(self, conn_str: str, job_config: JobConfig=None, secure: bool=False, metadata: List[Tuple[str, str]]=None, connection_retries: int=3, namespace: str=None, *, ignore_version: bool=False, _credentials: Optional['grpc.ChannelCredentials']=None, ... | 11 | 4 | 16 | 2 | 11 | 3 | 2 | 0.3 | 0 | 9 | 4 | 0 | 10 | 5 | 10 | 10 | 168 | 26 | 110 | 40 | 80 | 33 | 81 | 28 | 63 | 9 | 0 | 2 | 24 |
10,921 | ray-project/ray | python/ray/util/client/api.py | ray.util.client.api._ClientAPI | from concurrent.futures import Future
from ray.util.client.runtime_context import _ClientWorkerPropertyAPI
import json
from typing import TYPE_CHECKING, Any, Callable, List, Optional, Union
from ray._common import ray_option_utils
class _ClientAPI:
"""The Client-side methods corresponding to the ray API. Delegates... |
class _ClientAPI:
'''The Client-side methods corresponding to the ray API. Delegates
to the Client Worker that contains the connection to the ClientServer.
'''
def __init__(self, worker=None):
pass
def get(self, vals, *, timeout=None):
'''get is the hook stub passed on to replace ... | 37 | 30 | 10 | 1 | 5 | 4 | 1 | 0.94 | 0 | 9 | 1 | 0 | 35 | 1 | 35 | 35 | 380 | 71 | 159 | 76 | 90 | 150 | 99 | 49 | 56 | 3 | 0 | 2 | 42 |
10,922 | ray-project/ray | python/ray/util/client/client_app.py | ray.util.client.client_app.HelloActor | from typing import Tuple
from ray.util.client import ray
@ray.remote
class HelloActor:
def __init__(self):
self.count = 0
def say_hello(self, whom: str) -> Tuple[str, int]:
self.count += 1
return ('Hello ' + whom, self.count) | @ray.remote
class HelloActor:
def __init__(self):
pass
def say_hello(self, whom: str) -> Tuple[str, int]:
pass | 4 | 0 | 3 | 0 | 3 | 0 | 1 | 0 | 0 | 2 | 0 | 0 | 2 | 1 | 2 | 2 | 7 | 1 | 6 | 4 | 3 | 0 | 6 | 4 | 3 | 1 | 0 | 0 | 2 |
10,923 | ray-project/ray | python/ray/util/client/client_pickler.py | ray.util.client.client_pickler.ClientPickler | from ray.util.client import RayAPIStub
import ray.cloudpickle as cloudpickle
from ray.util.client.common import ClientActorClass, ClientActorHandle, ClientActorRef, ClientObjectRef, ClientRemoteFunc, ClientRemoteMethod, InProgressSentinel, OptionWrapper
class ClientPickler(cloudpickle.CloudPickler):
def __init__(... |
class ClientPickler(cloudpickle.CloudPickler):
def __init__(self, client_id, *args, **kwargs):
pass
def persistent_id(self, obj):
pass | 3 | 0 | 38 | 0 | 38 | 0 | 7 | 0 | 1 | 12 | 9 | 0 | 2 | 1 | 2 | 2 | 77 | 1 | 76 | 4 | 73 | 0 | 22 | 4 | 19 | 12 | 1 | 2 | 13 |
10,924 | ray-project/ray | python/ray/util/client/client_pickler.py | ray.util.client.client_pickler.PickleStub | from typing import Any, Dict, NamedTuple, Optional
class PickleStub(NamedTuple('PickleStub', [('type', str), ('client_id', str), ('ref_id', bytes), ('name', Optional[str]), ('baseline_options', Optional[Dict])])):
def __reduce__(self):
return object.__reduce__(self) |
class PickleStub(NamedTuple('PickleStub', [('type', str), ('client_id', str), ('ref_id', bytes), ('name', Optional[str]), ('baseline_options', Optional[Dict])])):
def __reduce__(self):
pass | 2 | 0 | 4 | 0 | 2 | 2 | 1 | 0.14 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 1 | 16 | 0 | 14 | 13 | 1 | 2 | 3 | 2 | 1 | 1 | 1 | 0 | 1 |
10,925 | ray-project/ray | python/ray/util/client/client_pickler.py | ray.util.client.client_pickler.ServerUnpickler | import pickle
from ray.util.client.common import ClientActorClass, ClientActorHandle, ClientActorRef, ClientObjectRef, ClientRemoteFunc, ClientRemoteMethod, InProgressSentinel, OptionWrapper
class ServerUnpickler(pickle.Unpickler):
def persistent_load(self, pid):
assert isinstance(pid, PickleStub)
... |
class ServerUnpickler(pickle.Unpickler):
def persistent_load(self, pid):
pass | 2 | 0 | 8 | 0 | 8 | 0 | 3 | 0 | 0 | 5 | 4 | 0 | 1 | 0 | 1 | 1 | 9 | 0 | 9 | 2 | 7 | 0 | 7 | 2 | 5 | 3 | 0 | 1 | 3 |
10,926 | ray-project/ray | python/ray/util/client/common.py | ray.util.client.common.ActorOptionWrapper | import ray.core.generated.ray_client_pb2_grpc as ray_client_pb2_grpc
from ray.util.client import ray
import ray._raylet as raylet
import ray.core.generated.ray_client_pb2 as ray_client_pb2
class ActorOptionWrapper(OptionWrapper):
def remote(self, *args, **kwargs):
self._remote_stub._init_signature.bind(*a... |
class ActorOptionWrapper(OptionWrapper):
def remote(self, *args, **kwargs):
pass | 2 | 0 | 8 | 0 | 8 | 0 | 2 | 0 | 1 | 3 | 3 | 0 | 1 | 0 | 1 | 6 | 9 | 0 | 9 | 4 | 7 | 0 | 9 | 4 | 7 | 2 | 1 | 1 | 2 |
10,927 | ray-project/ray | python/ray/util/client/common.py | ray.util.client.common.ClientActorClass | import inspect
import ray.core.generated.ray_client_pb2 as ray_client_pb2
import threading
import ray._raylet as raylet
from ray._private.utils import check_oversized_function
from ray.util.client import ray
from ray.util.client.options import validate_options
from ray._common.signature import extract_signature, get_si... |
class ClientActorClass(ClientStub):
'''A stub created on the Ray Client to represent an actor class.
It is wrapped by ray.remote and can be executed on the cluster.
Args:
actor_cls: The actual class to execute remotely
_name: The original name of the class
_ref: The ClientObjectRef ... | 12 | 1 | 6 | 0 | 5 | 1 | 1 | 0.24 | 1 | 10 | 5 | 0 | 9 | 7 | 10 | 10 | 80 | 12 | 55 | 22 | 43 | 13 | 47 | 21 | 36 | 3 | 1 | 2 | 14 |
10,928 | ray-project/ray | python/ray/util/client/common.py | ray.util.client.common.ClientActorHandle | import ray.core.generated.ray_client_pb2_grpc as ray_client_pb2_grpc
import ray._raylet as raylet
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
import inspect
from ray.util.client import ray
import ray.core.generated.ray_client_pb2 as ray_client_pb2
from ray._common.signature import extract_signa... |
class ClientActorHandle(ClientStub):
'''Client-side stub for instantiated actor.
A stub created on the Ray Client to represent a remote actor that
has been started on the cluster. This class is allowed to be passed
around between remote functions.
Args:
actor_ref: A reference to the runnin... | 12 | 1 | 9 | 0 | 8 | 1 | 2 | 0.21 | 1 | 9 | 3 | 0 | 8 | 4 | 8 | 8 | 98 | 13 | 70 | 23 | 54 | 15 | 42 | 17 | 32 | 4 | 1 | 2 | 17 |
10,929 | ray-project/ray | python/ray/util/client/common.py | ray.util.client.common.ClientActorRef | from concurrent.futures import Future
import ray.core.generated.ray_client_pb2_grpc as ray_client_pb2_grpc
import ray.core.generated.ray_client_pb2 as ray_client_pb2
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
import ray._raylet as raylet
import threading
from ray.util.client import ray
class ... |
class ClientActorRef(raylet.ActorID):
def __init__(self, id: Union[bytes, Future], weak_ref: Optional[bool]=False):
pass
def __del__(self):
pass
def binary(self):
pass
def hex(self):
pass
def is_nil(self):
pass
def __hash__(self):
pass
@... | 11 | 0 | 6 | 0 | 6 | 0 | 2 | 0 | 1 | 6 | 0 | 0 | 9 | 4 | 9 | 9 | 63 | 9 | 54 | 19 | 39 | 0 | 42 | 14 | 32 | 5 | 1 | 3 | 17 |
10,930 | ray-project/ray | python/ray/util/client/common.py | ray.util.client.common.ClientObjectRef | import ray.core.generated.ray_client_pb2_grpc as ray_client_pb2_grpc
import ray._raylet as raylet
import threading
import ray.core.generated.ray_client_pb2 as ray_client_pb2
from ray.util.client import ray
from concurrent.futures import Future
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
class ... |
class ClientObjectRef(raylet.ObjectRef):
def __init__(self, id: Union[bytes, Future]):
pass
def __del__(self):
pass
def binary(self):
pass
def hex(self):
pass
def is_nil(self):
pass
def __hash__(self):
pass
def task_id(self):
pa... | 16 | 2 | 8 | 1 | 7 | 1 | 2 | 0.1 | 1 | 7 | 0 | 0 | 12 | 3 | 12 | 12 | 105 | 19 | 78 | 25 | 59 | 8 | 64 | 22 | 48 | 4 | 1 | 3 | 25 |
10,931 | ray-project/ray | python/ray/util/client/common.py | ray.util.client.common.ClientRemoteFunc | import ray.core.generated.ray_client_pb2 as ray_client_pb2
import ray.core.generated.ray_client_pb2_grpc as ray_client_pb2_grpc
from ray._common.signature import extract_signature, get_signature
from ray._private.utils import check_oversized_function
from ray.util.client import ray
import threading
from ray.util.client... |
class ClientRemoteFunc(ClientStub):
'''A stub created on the Ray Client to represent a remote
function that can be exectued on the cluster.
This class is allowed to be passed around between remote functions.
Args:
_func: The actual function to execute remotely
_name: The original name o... | 10 | 1 | 7 | 0 | 5 | 1 | 1 | 0.42 | 1 | 5 | 3 | 0 | 9 | 7 | 9 | 9 | 79 | 11 | 48 | 19 | 38 | 20 | 43 | 19 | 33 | 3 | 1 | 2 | 13 |
10,932 | ray-project/ray | python/ray/util/client/common.py | ray.util.client.common.ClientRemoteMethod | import ray.core.generated.ray_client_pb2 as ray_client_pb2
from ray.util.client import ray
import inspect
import ray._raylet as raylet
import ray.core.generated.ray_client_pb2_grpc as ray_client_pb2_grpc
class ClientRemoteMethod(ClientStub):
"""A stub for a method on a remote actor.
Can be annotated with exec... |
class ClientRemoteMethod(ClientStub):
'''A stub for a method on a remote actor.
Can be annotated with execution options.
Args:
actor_handle: A reference to the ClientActorHandle that generated
this method and will have this method called upon it.
method_name: The name of this meth... | 9 | 1 | 5 | 0 | 5 | 0 | 1 | 0.16 | 1 | 6 | 2 | 0 | 8 | 4 | 8 | 8 | 60 | 10 | 43 | 20 | 28 | 7 | 29 | 14 | 20 | 3 | 1 | 1 | 10 |
10,933 | ray-project/ray | python/ray/util/client/common.py | ray.util.client.common.ClientServerHandle | import ray.core.generated.ray_client_pb2_grpc as ray_client_pb2_grpc
from dataclasses import dataclass
import grpc
@dataclass
class ClientServerHandle:
"""Holds the handles to the registered gRPC servicers and their server."""
task_servicer: ray_client_pb2_grpc.RayletDriverServicer
data_servicer: ray_clien... | @dataclass
class ClientServerHandle:
'''Holds the handles to the registered gRPC servicers and their server.'''
def stop(self, grace: int) -> None:
pass
def __getattr__(self, attr):
pass | 4 | 1 | 4 | 0 | 3 | 2 | 1 | 0.6 | 0 | 1 | 0 | 0 | 2 | 0 | 2 | 2 | 19 | 3 | 10 | 3 | 7 | 6 | 10 | 3 | 7 | 1 | 0 | 0 | 2 |
10,934 | ray-project/ray | python/ray/util/client/common.py | ray.util.client.common.ClientSideRefID | import uuid
class ClientSideRefID:
"""An ID generated by the client for objects not yet given an ObjectRef"""
def __init__(self, id: bytes):
assert len(id) != 0
self.id = id
@staticmethod
def generate_id() -> 'ClientSideRefID':
tid = uuid.uuid4()
return ClientSideRefID... |
class ClientSideRefID:
'''An ID generated by the client for objects not yet given an ObjectRef'''
def __init__(self, id: bytes):
pass
@staticmethod
def generate_id() -> 'ClientSideRefID':
pass | 4 | 1 | 3 | 0 | 3 | 0 | 1 | 0.13 | 0 | 1 | 0 | 0 | 1 | 1 | 2 | 2 | 11 | 2 | 8 | 6 | 4 | 1 | 7 | 5 | 4 | 1 | 0 | 0 | 2 |
10,935 | ray-project/ray | python/ray/util/client/common.py | ray.util.client.common.ClientStub | class ClientStub:
pass | class ClientStub:
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 | 0 | 0 | 0 | 0 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 0 | 0 | 0 |
10,936 | ray-project/ray | python/ray/util/client/common.py | ray.util.client.common.InProgressSentinel | class InProgressSentinel:
def __repr__(self) -> str:
return self.__class__.__name__ | class InProgressSentinel:
def __repr__(self) -> str:
pass | 2 | 0 | 2 | 0 | 2 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 1 | 3 | 0 | 3 | 2 | 1 | 0 | 3 | 2 | 1 | 1 | 0 | 0 | 1 |
10,937 | ray-project/ray | python/ray/util/client/common.py | ray.util.client.common.OptionWrapper | from ray.util.client.options import validate_options
import ray._raylet as raylet
import ray.core.generated.ray_client_pb2_grpc as ray_client_pb2_grpc
from ray.util.client import ray
import ray.core.generated.ray_client_pb2 as ray_client_pb2
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
class Op... |
class OptionWrapper:
def __init__(self, stub: ClientStub, options: Optional[Dict[str, Any]]):
pass
def remote(self, *args, **kwargs):
pass
def __getattr__(self, key):
pass
def _prepare_client_task(self):
pass
def _num_returns(self) -> int:
pass | 6 | 0 | 4 | 0 | 4 | 0 | 1 | 0 | 0 | 4 | 1 | 1 | 5 | 2 | 5 | 5 | 23 | 4 | 19 | 10 | 13 | 0 | 19 | 10 | 13 | 3 | 0 | 2 | 7 |
10,938 | ray-project/ray | python/ray/util/client/common.py | ray.util.client.common.OrderedResponseCache | from collections import OrderedDict
import threading
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
class OrderedResponseCache:
"""
Cache for streaming RPCs, i.e. the DataServicer. Relies on explicit
ack's from the client to determine when it can clean up cache entries.
"""
d... |
class OrderedResponseCache:
'''
Cache for streaming RPCs, i.e. the DataServicer. Relies on explicit
ack's from the client to determine when it can clean up cache entries.
'''
def __init__(self):
pass
def check_cache(self, req_id: int) -> Optional[Any]:
'''
Check the ca... | 6 | 5 | 17 | 0 | 12 | 5 | 3 | 0.45 | 0 | 7 | 0 | 0 | 5 | 3 | 5 | 5 | 93 | 6 | 60 | 14 | 54 | 27 | 47 | 14 | 41 | 5 | 0 | 4 | 17 |
10,939 | ray-project/ray | python/ray/util/client/common.py | ray.util.client.common.ResponseCache | import threading
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
class ResponseCache:
"""
Cache for blocking method calls. Needed to prevent retried requests from
being applied multiple times on the server, for example when the client
disconnects. This is used to cache requests/res... |
class ResponseCache:
'''
Cache for blocking method calls. Needed to prevent retried requests from
being applied multiple times on the server, for example when the client
disconnects. This is used to cache requests/responses sent through
unary-unary RPCs to the RayletServicer.
Note that no clean... | 4 | 3 | 25 | 1 | 14 | 10 | 3 | 1.3 | 0 | 4 | 0 | 0 | 3 | 2 | 3 | 3 | 108 | 9 | 43 | 8 | 39 | 56 | 26 | 8 | 22 | 6 | 0 | 5 | 9 |
10,940 | ray-project/ray | python/ray/util/client/dataclient.py | ray.util.client.dataclient.ChunkCollector | from typing import TYPE_CHECKING, Any, Callable, Dict, Optional, Union
import warnings
import ray.core.generated.ray_client_pb2 as ray_client_pb2
from ray.util.client.common import INT32_MAX, OBJECT_TRANSFER_CHUNK_SIZE, OBJECT_TRANSFER_WARNING_SIZE
from ray.util.debug import log_once
class ChunkCollector:
"""
... |
class ChunkCollector:
'''
This object collects chunks from async get requests via __call__, and
calls the underlying callback when the object is fully received, or if an
exception while retrieving the object occurs.
This is not used in synchronous gets (synchronous gets interact with the
raylet... | 3 | 1 | 31 | 1 | 24 | 7 | 4 | 0.43 | 0 | 5 | 0 | 0 | 2 | 4 | 2 | 2 | 75 | 5 | 49 | 12 | 46 | 21 | 32 | 12 | 29 | 7 | 0 | 1 | 8 |
10,941 | ray-project/ray | python/ray/util/client/dataclient.py | ray.util.client.dataclient.DataClient | import ray.core.generated.ray_client_pb2_grpc as ray_client_pb2_grpc
from ray.util.client.common import INT32_MAX, OBJECT_TRANSFER_CHUNK_SIZE, OBJECT_TRANSFER_WARNING_SIZE
import ray.core.generated.ray_client_pb2 as ray_client_pb2
from collections import OrderedDict
import grpc
import queue
from typing import TYPE_CHEC... |
class DataClient:
def __init__(self, client_worker: 'Worker', client_id: str, metadata: list):
'''Initializes a thread-safe datapath over a Ray Client gRPC channel.
Args:
client_worker: The Ray Client worker that manages this client
client_id: the generated ID representing ... | 27 | 6 | 15 | 1 | 12 | 3 | 2 | 0.24 | 0 | 12 | 1 | 0 | 24 | 14 | 25 | 25 | 414 | 45 | 298 | 103 | 248 | 71 | 214 | 79 | 187 | 8 | 0 | 4 | 59 |
10,942 | ray-project/ray | python/ray/util/client/logsclient.py | ray.util.client.logsclient.LogstreamClient | import threading
import ray.core.generated.ray_client_pb2 as ray_client_pb2
import sys
import grpc
import ray.core.generated.ray_client_pb2_grpc as ray_client_pb2_grpc
from ray.util.debug import log_once
import queue
import time
class LogstreamClient:
def __init__(self, client_worker: 'Worker', metadata: list):
... |
class LogstreamClient:
def __init__(self, client_worker: 'Worker', metadata: list):
'''Initializes a thread-safe log stream over a Ray Client gRPC channel.
Args:
client_worker: The Ray Client worker that manages this client
metadata: metadata to pass to gRPC requests
... | 10 | 4 | 11 | 0 | 8 | 3 | 2 | 0.36 | 0 | 7 | 0 | 0 | 9 | 5 | 9 | 9 | 109 | 11 | 72 | 23 | 62 | 26 | 65 | 22 | 55 | 9 | 0 | 4 | 22 |
10,943 | ray-project/ray | python/ray/util/client/runtime_context.py | ray.util.client.runtime_context._ClientWorkerPropertyAPI | from types import SimpleNamespace
class _ClientWorkerPropertyAPI:
"""Emulates the properties of the ray._private.worker object for the client"""
def __init__(self, worker):
assert worker is not None
self.worker = worker
def build_runtime_context(self) -> 'RuntimeContext':
"""Creat... |
class _ClientWorkerPropertyAPI:
'''Emulates the properties of the ray._private.worker object for the client'''
def __init__(self, worker):
pass
def build_runtime_context(self) -> 'RuntimeContext':
'''Creates a RuntimeContext backed by the properites of this API'''
pass
def _f... | 19 | 2 | 3 | 0 | 3 | 0 | 1 | 0.08 | 0 | 3 | 1 | 0 | 11 | 1 | 11 | 11 | 57 | 16 | 38 | 25 | 14 | 3 | 29 | 18 | 12 | 1 | 0 | 0 | 11 |
10,944 | ray-project/ray | python/ray/util/client/server/dataservicer.py | ray.util.client.server.dataservicer.ChunkCollector | from typing import TYPE_CHECKING, Any, Dict, Iterator, Union
import ray.core.generated.ray_client_pb2 as ray_client_pb2
class ChunkCollector:
"""
Helper class for collecting chunks from PutObject or ClientTask messages
"""
def __init__(self):
self.curr_req_id = None
self.last_seen_chun... |
class ChunkCollector:
'''
Helper class for collecting chunks from PutObject or ClientTask messages
'''
def __init__(self):
pass
def add_chunk(self, req: ray_client_pb2.DataRequest, chunk: Union[ray_client_pb2.PutRequest, ray_client_pb2.ClientTask]):
pass
def reset(self):
... | 4 | 1 | 11 | 0 | 10 | 0 | 2 | 0.13 | 0 | 2 | 0 | 0 | 3 | 3 | 3 | 3 | 39 | 3 | 32 | 12 | 24 | 4 | 21 | 8 | 17 | 5 | 0 | 1 | 7 |
10,945 | ray-project/ray | python/ray/util/client/server/dataservicer.py | ray.util.client.server.dataservicer.DataServicer | from collections import defaultdict
import ray.core.generated.ray_client_pb2 as ray_client_pb2
from ray.util.client.server.server_pickler import loads_from_client
import ray.core.generated.ray_client_pb2_grpc as ray_client_pb2_grpc
from threading import Event, Lock, Thread
import ray
from ray._private.client_mode_hook ... |
class DataServicer(ray_client_pb2_grpc.RayletDataStreamerServicer):
def __init__(self, basic_service: 'RayletServicer'):
pass
def Datapath(self, request_iterator, context):
pass
def _init(self, client_id: str, context: Any, start_time: float):
'''
Checks if resources allo... | 5 | 1 | 70 | 1 | 58 | 12 | 11 | 0.2 | 1 | 11 | 2 | 0 | 4 | 9 | 4 | 4 | 285 | 7 | 232 | 47 | 227 | 47 | 156 | 46 | 151 | 35 | 1 | 5 | 42 |
10,946 | ray-project/ray | python/ray/util/client/server/logservicer.py | ray.util.client.server.logservicer.LogstreamHandler | import ray.core.generated.ray_client_pb2 as ray_client_pb2
import logging
import queue
class LogstreamHandler(logging.Handler):
def __init__(self, queue, level):
super().__init__()
self.queue = queue
self.level = level
def emit(self, record: logging.LogRecord):
logdata = ray_c... |
class LogstreamHandler(logging.Handler):
def __init__(self, queue, level):
pass
def emit(self, record: logging.LogRecord):
pass | 3 | 0 | 5 | 0 | 5 | 0 | 1 | 0 | 1 | 2 | 0 | 0 | 2 | 2 | 2 | 22 | 12 | 1 | 11 | 6 | 8 | 0 | 11 | 6 | 8 | 1 | 3 | 0 | 2 |
10,947 | ray-project/ray | python/ray/util/client/server/logservicer.py | ray.util.client.server.logservicer.LogstreamServicer | import queue
from ray.util.client.common import CLIENT_SERVER_MAX_THREADS
import ray.core.generated.ray_client_pb2_grpc as ray_client_pb2_grpc
import grpc
import threading
class LogstreamServicer(ray_client_pb2_grpc.RayletLogStreamerServicer):
def __init__(self):
super().__init__()
self.num_client... |
class LogstreamServicer(ray_client_pb2_grpc.RayletLogStreamerServicer):
def __init__(self):
pass
def Logstream(self, request_iterator, context):
pass | 3 | 0 | 20 | 0 | 20 | 0 | 4 | 0 | 1 | 3 | 0 | 0 | 2 | 2 | 2 | 2 | 42 | 1 | 41 | 12 | 38 | 0 | 31 | 11 | 28 | 6 | 1 | 3 | 7 |
10,948 | ray-project/ray | python/ray/util/client/server/logservicer.py | ray.util.client.server.logservicer.StdStreamHandler | from ray._private.ray_logging import global_worker_stdstream_dispatcher
import io
from ray._private.worker import print_worker_logs
import uuid
import queue
import ray.core.generated.ray_client_pb2 as ray_client_pb2
class StdStreamHandler:
def __init__(self, queue):
self.queue = queue
self.id = st... |
class StdStreamHandler:
def __init__(self, queue):
pass
def handle(self, data):
pass
def register_global(self):
pass
def unregister_global(self):
pass | 5 | 0 | 4 | 0 | 4 | 0 | 2 | 0 | 0 | 1 | 0 | 0 | 4 | 2 | 4 | 4 | 19 | 3 | 16 | 9 | 11 | 0 | 16 | 8 | 11 | 3 | 0 | 1 | 6 |
10,949 | ray-project/ray | python/ray/util/client/server/proxier.py | ray.util.client.server.proxier.DataServicerProxy | import traceback
from threading import Event, Lock, RLock, Thread
import ray.core.generated.ray_client_pb2 as ray_client_pb2
from itertools import chain
import time
import grpc
from typing import Callable, Dict, List, Optional, Tuple
import ray.core.generated.ray_client_pb2_grpc as ray_client_pb2_grpc
from ray.util.cli... |
class DataServicerProxy(ray_client_pb2_grpc.RayletDataStreamerServicer):
def __init__(self, proxy_manager: ProxyManager):
pass
def modify_connection_info_resp(self, init_resp: ray_client_pb2.DataResponse) -> ray_client_pb2.DataResponse:
'''
Modify the `num_clients` returned the Connec... | 4 | 1 | 48 | 1 | 41 | 6 | 6 | 0.14 | 1 | 8 | 2 | 0 | 3 | 6 | 3 | 3 | 146 | 6 | 123 | 33 | 117 | 17 | 91 | 30 | 87 | 16 | 1 | 4 | 19 |
10,950 | ray-project/ray | python/ray/util/client/server/proxier.py | ray.util.client.server.proxier.LogstreamServicerProxy | import grpc
import ray.core.generated.ray_client_pb2_grpc as ray_client_pb2_grpc
from ray.util.client.common import CLIENT_SERVER_MAX_THREADS, GRPC_OPTIONS, ClientServerHandle, _get_client_id_from_context, _propagate_error_in_context
import time
class LogstreamServicerProxy(ray_client_pb2_grpc.RayletLogStreamerService... |
class LogstreamServicerProxy(ray_client_pb2_grpc.RayletLogStreamerServicer):
def __init__(self, proxy_manager: ProxyManager):
pass
def Logstream(self, request_iterator, context):
pass | 3 | 0 | 20 | 3 | 16 | 1 | 4 | 0.06 | 1 | 5 | 2 | 0 | 2 | 1 | 2 | 2 | 41 | 6 | 33 | 10 | 30 | 2 | 28 | 10 | 25 | 7 | 1 | 2 | 8 |
10,951 | ray-project/ray | python/ray/util/client/server/proxier.py | ray.util.client.server.proxier.ProxyManager | import psutil
import ray.core.generated.runtime_env_agent_pb2 as runtime_env_agent_pb2
import ray.core.generated.ray_client_pb2_grpc as ray_client_pb2_grpc
from threading import Event, Lock, RLock, Thread
from ray.job_config import JobConfig
import atexit
import time
import ray.core.generated.ray_client_pb2 as ray_clie... | null | 15 | 9 | 24 | 2 | 19 | 4 | 3 | 0.19 | 0 | 17 | 4 | 0 | 12 | 11 | 12 | 12 | 298 | 29 | 227 | 77 | 195 | 42 | 137 | 57 | 124 | 6 | 0 | 4 | 33 |
10,952 | ray-project/ray | python/ray/util/client/server/proxier.py | ray.util.client.server.proxier.RayletServicerProxy | import json
import ray
import grpc
from typing import Callable, Dict, List, Optional, Tuple
from ray.util.client.common import CLIENT_SERVER_MAX_THREADS, GRPC_OPTIONS, ClientServerHandle, _get_client_id_from_context, _propagate_error_in_context
from ray._private.client_mode_hook import disable_client_hook
import ray.co... |
class RayletServicerProxy(ray_client_pb2_grpc.RayletDriverServicer):
def __init__(self, ray_connect_handler: Callable, proxy_manager: ProxyManager):
pass
def _call_inner_function(self, request, context, method: str) -> Optional[ray_client_pb2_grpc.RayletDriverStub]:
pass
def _has_channel... | 18 | 6 | 9 | 1 | 5 | 2 | 2 | 0.43 | 1 | 3 | 1 | 0 | 17 | 2 | 17 | 17 | 170 | 36 | 94 | 40 | 68 | 40 | 82 | 30 | 64 | 4 | 1 | 2 | 28 |
10,953 | ray-project/ray | python/ray/util/client/server/proxier.py | ray.util.client.server.proxier.RequestIteratorProxy | import grpc
class RequestIteratorProxy:
def __init__(self, request_iterator):
self.request_iterator = request_iterator
def __iter__(self):
return self
def __next__(self):
try:
return next(self.request_iterator)
except grpc.RpcError as e:
if type(e)... |
class RequestIteratorProxy:
def __init__(self, request_iterator):
pass
def __iter__(self):
pass
def __next__(self):
pass | 4 | 0 | 6 | 0 | 5 | 2 | 2 | 0.4 | 0 | 2 | 0 | 0 | 3 | 1 | 3 | 3 | 22 | 2 | 15 | 6 | 11 | 6 | 13 | 5 | 9 | 3 | 0 | 2 | 5 |
10,954 | ray-project/ray | python/ray/util/client/server/proxier.py | ray.util.client.server.proxier.SpecificServer | from typing import Callable, Dict, List, Optional, Tuple
from ray._private.services import ProcessInfo, start_ray_client_server
from dataclasses import dataclass
from concurrent import futures
@dataclass
class SpecificServer:
port: int
process_handle_future: futures.Future
channel: 'grpc._channel.Channel'
... | @dataclass
class SpecificServer:
def is_ready(self) -> bool:
'''Check if the server is ready or not (doesn't block).'''
pass
def wait_ready(self, timeout: Optional[float]=None) -> None:
'''
Wait for the server to actually start up.
'''
pass
def poll(self) -... | 7 | 5 | 6 | 0 | 5 | 2 | 2 | 0.33 | 0 | 4 | 0 | 0 | 5 | 0 | 5 | 5 | 41 | 5 | 27 | 9 | 21 | 9 | 27 | 9 | 21 | 3 | 0 | 2 | 11 |
10,955 | ray-project/ray | python/ray/util/client/server/server.py | ray.util.client.server.server.RayletServicer | from collections import defaultdict
import json
from typing import Any, Callable, Dict, List, Optional, Set, Union
import ray.core.generated.ray_client_pb2 as ray_client_pb2
import pickle
import gc
import inspect
import ray
from ray import cloudpickle
import queue
import ray.core.generated.ray_client_pb2_grpc as ray_cl... |
class RayletServicer(ray_client_pb2_grpc.RayletDriverServicer):
def __init__(self, ray_connect_handler: Callable):
'''Construct a raylet service
Args:
ray_connect_handler: Function to connect to ray cluster
'''
pass
def Init(self, request: ray_client_pb2.InitRequest... | 35 | 6 | 21 | 0 | 19 | 1 | 3 | 0.07 | 1 | 18 | 1 | 0 | 30 | 10 | 30 | 30 | 646 | 43 | 561 | 188 | 476 | 42 | 363 | 122 | 331 | 7 | 1 | 4 | 102 |
10,956 | ray-project/ray | python/ray/util/client/server/server_pickler.py | ray.util.client.server.server_pickler.ClientUnpickler | from ray.util.client.server.server_stubs import ClientReferenceActor, ClientReferenceFunction
from ray.util.client.client_pickler import PickleStub
import pickle
import ray.cloudpickle as cloudpickle
import ray
class ClientUnpickler(pickle.Unpickler):
def __init__(self, server, *args, **kwargs):
super()._... |
class ClientUnpickler(pickle.Unpickler):
def __init__(self, server, *args, **kwargs):
pass
def persistent_load(self, pid):
pass | 3 | 0 | 14 | 0 | 14 | 0 | 5 | 0 | 0 | 5 | 3 | 0 | 2 | 1 | 2 | 2 | 30 | 1 | 29 | 5 | 26 | 0 | 17 | 5 | 14 | 9 | 0 | 1 | 10 |
10,957 | ray-project/ray | python/ray/util/client/server/server_pickler.py | ray.util.client.server.server_pickler.ServerPickler | from ray.util.client.client_pickler import PickleStub
import ray.cloudpickle as cloudpickle
import ray
class ServerPickler(cloudpickle.CloudPickler):
def __init__(self, client_id: str, server: 'RayletServicer', *args, **kwargs):
super().__init__(*args, **kwargs)
self.client_id = client_id
... |
class ServerPickler(cloudpickle.CloudPickler):
def __init__(self, client_id: str, server: 'RayletServicer', *args, **kwargs):
pass
def persistent_id(self, obj):
pass | 3 | 0 | 17 | 0 | 15 | 2 | 4 | 0.1 | 1 | 4 | 2 | 0 | 2 | 2 | 2 | 2 | 35 | 1 | 31 | 7 | 28 | 3 | 18 | 7 | 15 | 6 | 1 | 2 | 7 |
10,958 | ray-project/ray | python/ray/util/client/server/server_stubs.py | ray.util.client.server.server_stubs.ClientReferenceActor | class ClientReferenceActor(ClientReferenceSentinel):
def get_remote_obj(self):
global _current_server
real_ref_id = self.get_real_ref_from_server()
if real_ref_id is None:
return None
return _current_server.lookup_or_register_actor(real_ref_id, self.client_id, None) | class ClientReferenceActor(ClientReferenceSentinel):
def get_remote_obj(self):
pass | 2 | 0 | 8 | 0 | 8 | 0 | 2 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 1 | 25 | 9 | 0 | 9 | 4 | 6 | 0 | 7 | 4 | 4 | 2 | 5 | 1 | 2 |
10,959 | ray-project/ray | python/ray/util/client/server/server_stubs.py | ray.util.client.server.server_stubs.ClientReferenceFunction | class ClientReferenceFunction(ClientReferenceSentinel):
def get_remote_obj(self):
global _current_server
real_ref_id = self.get_real_ref_from_server()
if real_ref_id is None:
return None
return _current_server.lookup_or_register_func(real_ref_id, self.client_id, None) | class ClientReferenceFunction(ClientReferenceSentinel):
def get_remote_obj(self):
pass | 2 | 0 | 8 | 0 | 8 | 0 | 2 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 1 | 25 | 9 | 0 | 9 | 4 | 6 | 0 | 7 | 4 | 4 | 2 | 5 | 1 | 2 |
10,960 | ray-project/ray | python/ray/util/client/server/server_stubs.py | ray.util.client.server.server_stubs.ClientReferenceSentinel | from abc import ABC, abstractmethod
class ClientReferenceSentinel(ABC):
def __init__(self, client_id, id):
self.client_id = client_id
self.id = id
def __reduce__(self):
remote_obj = self.get_remote_obj()
if remote_obj is None:
return (self.__class__, (self.client_i... |
class ClientReferenceSentinel(ABC):
def __init__(self, client_id, id):
pass
def __reduce__(self):
pass
@abstractmethod
def get_remote_obj(self):
pass
def get_real_ref_from_server(self):
pass | 6 | 0 | 5 | 0 | 5 | 0 | 2 | 0 | 1 | 0 | 0 | 2 | 4 | 2 | 4 | 24 | 23 | 3 | 20 | 11 | 13 | 0 | 19 | 10 | 13 | 3 | 4 | 1 | 7 |
10,961 | ray-project/ray | python/ray/util/client/worker.py | ray.util.client.worker.Worker | from ray.util.client.client_pickler import dumps_from_client, loads_from_server
import ray.cloudpickle as cloudpickle
import uuid
from ray._private.ray_constants import DEFAULT_CLIENT_RECONNECT_GRACE_PERIOD
import warnings
from ray._private.runtime_env.py_modules import upload_py_modules_if_needed
from ray.cloudpickle.... |
class Worker:
def __init__(self, conn_str: str='', secure: bool=False, metadata: List[Tuple[str, str]]=None, connection_retries: int=3, _credentials: Optional[grpc.ChannelCredentials]=None):
'''Initializes the worker side grpc client.
Args:
conn_str: The host:port connection string for... | 42 | 12 | 19 | 1 | 16 | 3 | 3 | 0.18 | 0 | 32 | 10 | 0 | 40 | 22 | 40 | 40 | 811 | 71 | 630 | 200 | 542 | 111 | 438 | 137 | 396 | 14 | 0 | 4 | 141 |
10,962 | ray-project/ray | python/ray/util/collective/collective.py | ray.util.collective.collective.GroupManager | import ray
from ray.util.collective import types
class GroupManager(object):
"""Use this class to manage the collective groups we created so far.
Each process will have an instance of `GroupManager`. Each process
could belong to multiple collective groups. The membership information
and other metadata... |
class GroupManager(object):
'''Use this class to manage the collective groups we created so far.
Each process will have an instance of `GroupManager`. Each process
could belong to multiple collective groups. The membership information
and other metadata are stored in the global `_group_mgr` object.
... | 6 | 4 | 12 | 1 | 9 | 2 | 2 | 0.33 | 1 | 5 | 3 | 0 | 5 | 2 | 5 | 5 | 70 | 9 | 46 | 12 | 40 | 15 | 38 | 12 | 32 | 4 | 1 | 1 | 11 |
10,963 | ray-project/ray | python/ray/util/collective/collective_group/base_collective_group.py | ray.util.collective.collective_group.base_collective_group.BaseGroup | from ray.util.collective.types import AllGatherOptions, AllReduceOptions, BarrierOptions, BroadcastOptions, RecvOptions, ReduceOptions, ReduceScatterOptions, SendOptions
from abc import ABCMeta, abstractmethod
class BaseGroup(metaclass=ABCMeta):
def __init__(self, world_size, rank, group_name):
"""Init th... |
class BaseGroup(metaclass=ABCMeta):
def __init__(self, world_size, rank, group_name):
'''Init the process group with basic information.
Args:
world_size: The total number of processes in the group.
rank: The rank of the current process.
group_name: The group nam... | 27 | 6 | 3 | 0 | 2 | 1 | 1 | 0.24 | 1 | 7 | 6 | 2 | 13 | 3 | 14 | 34 | 70 | 14 | 45 | 32 | 16 | 11 | 31 | 18 | 16 | 1 | 3 | 0 | 14 |
10,964 | ray-project/ray | python/ray/util/collective/collective_group/cuda_stream.py | ray.util.collective.collective_group.cuda_stream.StreamPool | from ray.util.collective.const import ENV
import threading
from ray.util.collective.collective_group import nccl_util
import cupy
class StreamPool:
"""The class that represents a stream pool associated with a GPU.
When multistream is enabled, we will allocate a pool of streams for each
GPU, and get availa... |
class StreamPool:
'''The class that represents a stream pool associated with a GPU.
When multistream is enabled, we will allocate a pool of streams for each
GPU, and get available stream from this pool when a collective kernel is
initialized. This enables overlapping computation/communication kernels
... | 4 | 3 | 14 | 2 | 9 | 3 | 2 | 0.68 | 0 | 2 | 1 | 0 | 3 | 7 | 3 | 3 | 59 | 12 | 28 | 13 | 24 | 19 | 27 | 13 | 23 | 3 | 0 | 3 | 6 |
10,965 | ray-project/ray | python/ray/util/collective/collective_group/gloo_collective_group.py | ray.util.collective.collective_group.gloo_collective_group.GLOOGroup | import pygloo
import shutil
from ray.util.collective.collective_group import gloo_util
import os
from ray.util.collective.const import get_store_name
from ray.util.collective.collective_group.base_collective_group import BaseGroup
from ray.util.collective.types import AllGatherOptions, AllReduceOptions, Backend, Barrie... |
class GLOOGroup(BaseGroup):
def __init__(self, world_size, rank, group_name, store_type='ray_internal_kv', device_type='tcp', gloo_timeout=30000):
'''Init an GLOO collective group.
Args:
world_size: The number of processes.
rank: The id of process
group_name: Th... | 24 | 12 | 16 | 2 | 10 | 4 | 1 | 0.59 | 1 | 14 | 10 | 0 | 12 | 2 | 13 | 47 | 300 | 55 | 154 | 56 | 114 | 91 | 77 | 38 | 54 | 4 | 4 | 2 | 31 |
10,966 | ray-project/ray | python/ray/util/collective/collective_group/gloo_collective_group.py | ray.util.collective.collective_group.gloo_collective_group.Rendezvous | from ray._common.network_utils import parse_address
from ray.util.collective.collective_group import gloo_util
from ray._private import ray_constants
from ray.util.collective.const import get_store_name
import time
import datetime
import os
import ray
import pygloo
import shutil
class Rendezvous:
"""A rendezvous c... |
class Rendezvous:
'''A rendezvous class for different actor/task processes to meet.
To initialize an GLOO collective communication group, different
actors/tasks spawned in Ray in a collective group needs to meet
each other to synchronize the GLOOUniqueID. This class guarantees
they meet via the GLO... | 14 | 3 | 14 | 1 | 13 | 1 | 4 | 0.15 | 0 | 10 | 3 | 0 | 9 | 9 | 9 | 9 | 152 | 16 | 118 | 36 | 104 | 18 | 90 | 32 | 80 | 12 | 0 | 5 | 32 |
10,967 | ray-project/ray | python/ray/util/collective/collective_group/gloo_util.py | ray.util.collective.collective_group.gloo_util.RayInternalKvStore | from typing import List
import time
import ray
import ray.experimental.internal_kv as internal_kv
from ray._raylet import GcsClient
class RayInternalKvStore:
def __init__(self, group_name: str):
self._group_name = group_name
self._job_id = ray.get_runtime_context().get_job_id()
gcs_address... |
class RayInternalKvStore:
def __init__(self, group_name: str):
pass
def set(self, key: str, data: bytes) -> bool:
pass
def get(self, key: str) -> bytes:
pass
def delete(self, key: str) -> int:
pass
def del_keys(self, keys: List[str]) -> List[int]:
pass
... | 8 | 1 | 6 | 0 | 5 | 0 | 2 | 0.05 | 0 | 4 | 0 | 0 | 7 | 3 | 7 | 7 | 46 | 6 | 38 | 20 | 30 | 2 | 38 | 20 | 30 | 5 | 0 | 3 | 12 |
10,968 | ray-project/ray | python/ray/util/collective/collective_group/gloo_util.py | ray.util.collective.collective_group.gloo_util.SignalActor | import ray.experimental.internal_kv as internal_kv
import asyncio
import ray
@ray.remote(num_cpus=0)
class SignalActor:
def __init__(self, world_size):
self.ready_events = [asyncio.Event() for _ in range(world_size)]
self.world_size = world_size
def send(self, rank, clear=False):
self... | @ray.remote(num_cpus=0)
class SignalActor:
def __init__(self, world_size):
pass
def send(self, rank, clear=False):
pass
async def wait(self, should_wait=True):
pass | 5 | 0 | 4 | 0 | 4 | 0 | 2 | 0 | 0 | 1 | 0 | 0 | 3 | 2 | 3 | 3 | 14 | 2 | 12 | 7 | 8 | 0 | 12 | 7 | 8 | 3 | 0 | 2 | 6 |
10,969 | ray-project/ray | python/ray/util/collective/collective_group/gloo_util.py | ray.util.collective.collective_group.gloo_util.glooQueue | from ray.util.queue import _QueueActor
class glooQueue(_QueueActor):
def index(self, group_name):
try:
return self.queue._queue.index(group_name)
except ValueError:
return -1 |
class glooQueue(_QueueActor):
def index(self, group_name):
pass | 2 | 0 | 5 | 0 | 5 | 0 | 2 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 11 | 6 | 0 | 6 | 2 | 4 | 0 | 6 | 2 | 4 | 2 | 1 | 1 | 2 |
10,970 | ray-project/ray | python/ray/util/collective/collective_group/nccl_collective_group.py | ray.util.collective.collective_group.nccl_collective_group.NCCLGroup | from ray.util.collective.types import AllGatherOptions, AllReduceOptions, Backend, BarrierOptions, BroadcastOptions, RecvOptions, ReduceOptions, ReduceScatterOptions, SendOptions, torch_available
from ray.util.collective.const import ENV, get_store_name
from ray.util.collective.collective_group import nccl_util
import ... |
class NCCLGroup(BaseGroup):
def __init__(self, world_size, rank, group_name):
'''Init an NCCL collective group.'''
pass
def destroy_group(self):
'''Destroy the group and release NCCL communicators.'''
pass
@classmethod
def backend(cls):
pass
def allreduce(... | 32 | 18 | 21 | 3 | 12 | 6 | 2 | 0.61 | 1 | 19 | 12 | 0 | 16 | 5 | 19 | 53 | 540 | 89 | 280 | 97 | 238 | 171 | 181 | 85 | 151 | 6 | 4 | 3 | 61 |
10,971 | ray-project/ray | python/ray/util/collective/collective_group/nccl_collective_group.py | ray.util.collective.collective_group.nccl_collective_group.Rendezvous | from ray.util.collective.const import ENV, get_store_name
import datetime
import time
import ray
class Rendezvous:
"""A rendezvous class for different actor/task processes to meet.
To initialize an NCCL collective communication group, different
actors/tasks spawned in Ray in a collective group needs to me... |
class Rendezvous:
'''A rendezvous class for different actor/task processes to meet.
To initialize an NCCL collective communication group, different
actors/tasks spawned in Ray in a collective group needs to meet
each other to synchronize the NCCLUniqueID. This class guarantees
they meet via the NCC... | 6 | 3 | 20 | 1 | 16 | 3 | 3 | 0.36 | 0 | 4 | 0 | 0 | 4 | 3 | 4 | 4 | 97 | 10 | 64 | 16 | 58 | 23 | 46 | 15 | 41 | 5 | 0 | 2 | 13 |
10,972 | ray-project/ray | python/ray/util/collective/const.py | ray.util.collective.const.ENV | from enum import Enum, auto
import os
class ENV(Enum):
"""ray.util.collective environment variables."""
NCCL_USE_MULTISTREAM = (auto(), lambda v: (v or 'True') == 'True')
@property
def val(self):
"""Return the output of the lambda against the system's env value."""
_, default_fn = self... |
class ENV(Enum):
'''ray.util.collective environment variables.'''
@property
def val(self):
'''Return the output of the lambda against the system's env value.'''
pass | 3 | 2 | 4 | 0 | 3 | 1 | 1 | 0.33 | 1 | 0 | 0 | 0 | 1 | 0 | 1 | 50 | 10 | 2 | 6 | 5 | 3 | 2 | 5 | 4 | 3 | 1 | 4 | 0 | 1 |
10,973 | ray-project/ray | python/ray/util/collective/types.py | ray.util.collective.types.AllGatherOptions | from dataclasses import dataclass
@dataclass
class AllGatherOptions:
timeout_ms = unset_timeout_ms | @dataclass
class AllGatherOptions:
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 2 | 2 | 1 | 0 | 2 | 2 | 1 | 0 | 0 | 0 | 0 |
10,974 | ray-project/ray | python/ray/util/collective/types.py | ray.util.collective.types.AllReduceOptions | from dataclasses import dataclass
@dataclass
class AllReduceOptions:
reduceOp = ReduceOp.SUM
timeout_ms = unset_timeout_ms | @dataclass
class AllReduceOptions:
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 | 0 | 3 | 3 | 2 | 0 | 3 | 3 | 2 | 0 | 0 | 0 | 0 |
10,975 | ray-project/ray | python/ray/util/collective/types.py | ray.util.collective.types.Backend | class Backend(object):
"""A class to represent different backends."""
NCCL = 'nccl'
MPI = 'mpi'
GLOO = 'gloo'
TORCH_GLOO = 'torch_gloo'
NIXL = 'nixl'
UNRECOGNIZED = 'unrecognized'
def __new__(cls, name: str):
backend = getattr(Backend, name.upper(), Backend.UNRECOGNIZED)
... | class Backend(object):
'''A class to represent different backends.'''
def __new__(cls, name: str):
pass | 2 | 1 | 9 | 0 | 9 | 0 | 3 | 0.07 | 1 | 3 | 0 | 0 | 1 | 0 | 1 | 1 | 17 | 2 | 14 | 7 | 12 | 1 | 12 | 7 | 10 | 3 | 1 | 1 | 3 |
10,976 | ray-project/ray | python/ray/util/collective/types.py | ray.util.collective.types.BarrierOptions | from dataclasses import dataclass
@dataclass
class BarrierOptions:
timeout_ms = unset_timeout_ms | @dataclass
class BarrierOptions:
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 2 | 2 | 1 | 0 | 2 | 2 | 1 | 0 | 0 | 0 | 0 |
10,977 | ray-project/ray | python/ray/util/collective/types.py | ray.util.collective.types.BroadcastOptions | from dataclasses import dataclass
@dataclass
class BroadcastOptions:
root_rank = 0
root_tensor = 0
timeout_ms = unset_timeout_ms | @dataclass
class BroadcastOptions:
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,978 | ray-project/ray | python/ray/util/collective/types.py | ray.util.collective.types.RecvOptions | from dataclasses import dataclass
@dataclass
class RecvOptions:
src_rank = 0
src_gpu_index = 0
n_elements = 0
unset_timeout_ms = unset_timeout_ms | @dataclass
class RecvOptions:
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 | 0 | 5 | 5 | 4 | 0 | 5 | 5 | 4 | 0 | 0 | 0 | 0 |
10,979 | ray-project/ray | python/ray/util/collective/types.py | ray.util.collective.types.ReduceOp | from enum import Enum
class ReduceOp(Enum):
SUM = 0
PRODUCT = 1
MIN = 2
MAX = 3 |
class ReduceOp(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,980 | ray-project/ray | python/ray/util/collective/types.py | ray.util.collective.types.ReduceOptions | from dataclasses import dataclass
@dataclass
class ReduceOptions:
reduceOp = ReduceOp.SUM
root_rank = 0
root_tensor = 0
timeout_ms = unset_timeout_ms | @dataclass
class ReduceOptions:
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0.2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 | 0 | 5 | 5 | 4 | 1 | 5 | 5 | 4 | 0 | 0 | 0 | 0 |
10,981 | ray-project/ray | python/ray/util/collective/types.py | ray.util.collective.types.ReduceScatterOptions | from dataclasses import dataclass
@dataclass
class ReduceScatterOptions:
reduceOp = ReduceOp.SUM
timeout_ms = unset_timeout_ms | @dataclass
class ReduceScatterOptions:
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 | 0 | 3 | 3 | 2 | 0 | 3 | 3 | 2 | 0 | 0 | 0 | 0 |
10,982 | ray-project/ray | python/ray/util/collective/types.py | ray.util.collective.types.SendOptions | from dataclasses import dataclass
@dataclass
class SendOptions:
dst_rank = 0
dst_gpu_index = 0
n_elements = 0
timeout_ms = unset_timeout_ms | @dataclass
class SendOptions:
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 | 0 | 5 | 5 | 4 | 0 | 5 | 5 | 4 | 0 | 0 | 0 | 0 |
10,983 | ray-project/ray | python/ray/util/collective/util.py | ray.util.collective.util.Info | import ray
@ray.remote
class Info:
"""Store the group information created via `create_collective_group`.
Note: Should be used as a NamedActor.
"""
def __init__(self):
self.ids = None
self.world_size = -1
self.rank = -1
self.backend = None
self.gloo_timeout = 30... | @ray.remote
class Info:
'''Store the group information created via `create_collective_group`.
Note: Should be used as a NamedActor.
'''
def __init__(self):
pass
def set_info(self, ids, world_size, rank, backend, gloo_timeout):
'''Store collective information.'''
pass
d... | 5 | 3 | 5 | 0 | 4 | 1 | 1 | 0.38 | 0 | 0 | 0 | 0 | 3 | 4 | 3 | 3 | 22 | 4 | 13 | 8 | 9 | 5 | 13 | 8 | 9 | 1 | 0 | 0 | 3 |
10,984 | ray-project/ray | python/ray/util/collective/util.py | ray.util.collective.util.NCCLUniqueIDStore | import asyncio
import ray
@ray.remote
class NCCLUniqueIDStore:
"""NCCLUniqueID Store as a named actor class.
Args:
name: the unique name for this named actor.
Attributes:
name: the unique name for this named actor.
nccl_id: the NCCLUniqueID held in this store.
"""
def __i... | @ray.remote
class NCCLUniqueIDStore:
'''NCCLUniqueID Store as a named actor class.
Args:
name: the unique name for this named actor.
Attributes:
name: the unique name for this named actor.
nccl_id: the NCCLUniqueID held in this store.
'''
def __init__(self, name):
pa... | 6 | 4 | 7 | 1 | 4 | 3 | 1 | 1.15 | 0 | 0 | 0 | 0 | 3 | 2 | 3 | 3 | 35 | 7 | 13 | 6 | 9 | 15 | 11 | 6 | 7 | 2 | 0 | 1 | 4 |
10,985 | ray-project/ray | python/ray/util/dask/callbacks.py | ray.util.dask.callbacks.ProgressBarCallback | from collections import defaultdict, namedtuple
from datetime import datetime
import ray
class ProgressBarCallback(RayDaskCallback):
def __init__(self):
@ray.remote
class ProgressBarActor:
def __init__(self):
self._init()
def submit(self, key, deps, now):... |
class ProgressBarCallback(RayDaskCallback):
def __init__(self):
pass
@ray.remote
class ProgressBarActor:
def __init__(self):
pass
def submit(self, key, deps, now):
pass
def task_scheduled(self, key, now):
... | 17 | 0 | 8 | 1 | 6 | 1 | 1 | 0.15 | 1 | 3 | 1 | 0 | 5 | 1 | 5 | 17 | 77 | 14 | 55 | 29 | 37 | 8 | 50 | 28 | 33 | 2 | 2 | 1 | 17 |
10,986 | ray-project/ray | python/ray/util/dask/callbacks.py | ray.util.dask.callbacks.RayDaskCallback | import ray
from typing import Any, List, Optional
from dask.callbacks import Callback
class RayDaskCallback(Callback):
"""
Extends Dask's `Callback` class with Ray-specific hooks. When instantiating
or subclassing this class, both the normal Dask hooks (e.g. pretask,
posttask, etc.) and the Ray-specifi... |
class RayDaskCallback(Callback):
'''
Extends Dask's `Callback` class with Ray-specific hooks. When instantiating
or subclassing this class, both the normal Dask hooks (e.g. pretask,
posttask, etc.) and the Ray-specific hooks can be provided.
See `dask.callbacks.Callback` for usage.
Caveats: Any... | 14 | 7 | 9 | 1 | 3 | 5 | 1 | 2 | 1 | 4 | 1 | 13 | 12 | 1 | 12 | 12 | 139 | 28 | 37 | 18 | 23 | 74 | 36 | 17 | 23 | 3 | 1 | 2 | 14 |
10,987 | ray-project/ray | python/ray/util/dask/callbacks.py | ray.util.dask.callbacks.add_ray_callbacks | class add_ray_callbacks:
def __init__(self, *callbacks):
self.callbacks = [normalize_ray_callback(c) for c in callbacks]
RayDaskCallback.ray_active.update(self.callbacks)
def __enter__(self):
return self
def __exit__(self, *args):
for c in self.callbacks:
RayDa... | class add_ray_callbacks:
def __init__(self, *callbacks):
pass
def __enter__(self):
pass
def __exit__(self, *args):
pass | 4 | 0 | 3 | 0 | 3 | 0 | 1 | 0 | 0 | 1 | 1 | 0 | 3 | 1 | 3 | 3 | 11 | 2 | 9 | 6 | 5 | 0 | 9 | 6 | 5 | 2 | 0 | 1 | 4 |
10,988 | ray-project/ray | python/ray/util/dask/scheduler.py | ray.util.dask.scheduler.MultipleReturnFunc | from collections import OrderedDict, defaultdict
from dataclasses import dataclass
@dataclass
class MultipleReturnFunc:
func: callable
num_returns: int
def __call__(self, *args, **kwargs):
returns = self.func(*args, **kwargs)
if isinstance(returns, dict) or isinstance(returns, OrderedDict)... | @dataclass
class MultipleReturnFunc:
def __call__(self, *args, **kwargs):
pass | 3 | 0 | 5 | 0 | 5 | 0 | 2 | 0 | 0 | 3 | 0 | 0 | 1 | 0 | 1 | 1 | 9 | 1 | 8 | 3 | 6 | 0 | 8 | 3 | 6 | 2 | 0 | 1 | 2 |
10,989 | ray-project/ray | python/ray/util/iter.py | ray.util.iter.LocalIterator | from ray.util.iter_metrics import MetricsContext, SharedMetrics
from contextlib import contextmanager
from ray.util.annotations import Deprecated
from typing import Any, Callable, Generic, Iterable, List, TypeVar
import threading
import ray
import collections
import random
@Deprecated
class LocalIterator(Generic[T]):
... | @Deprecated
class LocalIterator(Generic[T]):
'''An iterator over a single shard of data.
It implements similar transformations as ParallelIterator[T], but the
transforms will be applied locally and not remotely in parallel.
This class is **serializable** and can be passed to other remote
tasks and a... | 37 | 8 | 16 | 1 | 13 | 2 | 3 | 0.23 | 1 | 17 | 3 | 0 | 19 | 6 | 20 | 22 | 428 | 59 | 300 | 105 | 250 | 70 | 216 | 89 | 182 | 9 | 1 | 6 | 93 |
10,990 | ray-project/ray | python/ray/util/iter.py | ray.util.iter.ParallelIterator | from ray.util.iter_metrics import MetricsContext, SharedMetrics
from ray.util.annotations import Deprecated
import collections
from typing import Any, Callable, Generic, Iterable, List, TypeVar
import ray
@Deprecated
class ParallelIterator(Generic[T]):
"""A parallel iterator over a set of remote actors.
This ... | @Deprecated
class ParallelIterator(Generic[T]):
'''A parallel iterator over a set of remote actors.
This can be used to iterate over a fixed set of task results
(like an actor pool), or a stream of data (e.g., a fixed range of numbers,
an infinite stream of RLlib rollout results).
This class is **se... | 30 | 21 | 22 | 2 | 13 | 7 | 3 | 0.95 | 1 | 17 | 5 | 0 | 23 | 3 | 23 | 25 | 570 | 78 | 252 | 95 | 208 | 240 | 191 | 79 | 162 | 11 | 1 | 4 | 72 |
10,991 | ray-project/ray | python/ray/util/iter.py | ray.util.iter.ParallelIteratorWorker | from typing import Any, Callable, Generic, Iterable, List, TypeVar
from ray.util.iter_metrics import MetricsContext, SharedMetrics
import collections
from ray.util.annotations import Deprecated
import time
@Deprecated
class ParallelIteratorWorker(object):
"""Worker actor for a ParallelIterator.
Actors that ar... | @Deprecated
class ParallelIteratorWorker(object):
'''Worker actor for a ParallelIterator.
Actors that are passed to iter.from_actors() must subclass this interface.
'''
def __init__(self, item_generator: Any, repeat: bool):
'''Create an iterator worker.
Subclasses must call this ini... | 10 | 7 | 15 | 1 | 12 | 2 | 3 | 0.21 | 1 | 9 | 2 | 2 | 6 | 4 | 6 | 6 | 116 | 18 | 81 | 24 | 72 | 17 | 72 | 24 | 63 | 6 | 1 | 3 | 27 |
10,992 | ray-project/ray | python/ray/util/iter.py | ray.util.iter._ActorSet | import ray
from typing import Any, Callable, Generic, Iterable, List, TypeVar
class _ActorSet(object):
"""Helper class that represents a set of actors and transforms."""
def __init__(self, actors: List['ray.actor.ActorHandle'], transforms: List[Callable[['LocalIterator'], 'LocalIterator']]):
self.acto... |
class _ActorSet(object):
'''Helper class that represents a set of actors and transforms.'''
def __init__(self, actors: List['ray.actor.ActorHandle'], transforms: List[Callable[['LocalIterator'], 'LocalIterator']]):
pass
def init_actors(self):
pass
def with_transform(self, fn):
... | 4 | 1 | 4 | 0 | 4 | 0 | 1 | 0.08 | 1 | 0 | 0 | 0 | 3 | 2 | 3 | 3 | 16 | 3 | 12 | 10 | 4 | 1 | 8 | 6 | 4 | 1 | 1 | 0 | 3 |
10,993 | ray-project/ray | python/ray/util/iter.py | ray.util.iter._NextValueNotReady | class _NextValueNotReady(Exception):
"""Indicates that a local iterator has no value currently available.
This is used internally to implement the union() of multiple blocking
local generators."""
pass | class _NextValueNotReady(Exception):
'''Indicates that a local iterator has no value currently available.
This is used internally to implement the union() of multiple blocking
local generators.'''
pass | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 1.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 10 | 7 | 2 | 2 | 1 | 1 | 3 | 2 | 1 | 1 | 0 | 3 | 0 | 0 |
10,994 | ray-project/ray | python/ray/util/iter_metrics.py | ray.util.iter_metrics.MetricsContext | from ray.util.timer import _Timer
from ray.util.annotations import Deprecated
import collections
@Deprecated
class MetricsContext:
"""Metrics context object for a local iterator.
This object is accessible by all operators of a local iterator. It can be
used to store and retrieve global execution metrics f... | @Deprecated
class MetricsContext:
'''Metrics context object for a local iterator.
This object is accessible by all operators of a local iterator. It can be
used to store and retrieve global execution metrics for the iterator.
It can be accessed by calling LocalIterator.get_metrics(), which is only
a... | 5 | 3 | 6 | 0 | 5 | 1 | 1 | 0.94 | 0 | 3 | 1 | 0 | 3 | 4 | 3 | 3 | 37 | 5 | 17 | 8 | 13 | 16 | 13 | 8 | 9 | 1 | 0 | 0 | 3 |
10,995 | ray-project/ray | python/ray/util/iter_metrics.py | ray.util.iter_metrics.SharedMetrics | from typing import List
from ray.util.annotations import Deprecated
@Deprecated
class SharedMetrics:
"""Holds an indirect reference to a (shared) metrics context.
This is used by LocalIterator.union() to point the metrics contexts of
entirely separate iterator chains to the same underlying context."""
... | @Deprecated
class SharedMetrics:
'''Holds an indirect reference to a (shared) metrics context.
This is used by LocalIterator.union() to point the metrics contexts of
entirely separate iterator chains to the same underlying context.'''
def __init__(self, metrics: MetricsContext=None, parents: List['Shar... | 5 | 2 | 4 | 0 | 4 | 0 | 1 | 0.31 | 0 | 1 | 1 | 0 | 3 | 2 | 3 | 3 | 21 | 4 | 13 | 9 | 7 | 4 | 11 | 7 | 7 | 2 | 0 | 1 | 4 |
10,996 | ray-project/ray | python/ray/util/joblib/ray_backend.py | ray.util.joblib.ray_backend.RayBackend | from ray.util.multiprocessing.pool import Pool
from joblib.pool import PicklingPool
from joblib import Parallel
import ray
from ray._common.usage import usage_lib
from typing import Any, Dict, Optional
from joblib._parallel_backends import MultiprocessingBackend
class RayBackend(MultiprocessingBackend):
"""Ray bac... |
class RayBackend(MultiprocessingBackend):
'''Ray backend uses ray, a system for scalable distributed computing.
More info about Ray is available here: https://docs.ray.io.
'''
def __init__(self, nesting_level: Optional[int]=None, inner_max_num_threads: Optional[int]=None, ray_remote_args: Optional[Dic... | 4 | 3 | 24 | 1 | 18 | 4 | 3 | 0.32 | 1 | 6 | 1 | 0 | 3 | 1 | 3 | 54 | 82 | 8 | 56 | 24 | 37 | 18 | 24 | 10 | 19 | 5 | 5 | 3 | 8 |
10,997 | ray-project/ray | python/ray/util/metrics.py | ray.util.metrics.Counter | from ray._raylet import Count as CythonCount, Gauge as CythonGauge, Histogram as CythonHistogram, Sum as CythonSum
from typing import Any, Dict, List, Optional, Tuple, Union
from ray.util.annotations import DeveloperAPI
import os
@DeveloperAPI
class Counter(Metric):
"""A cumulative metric that is monotonically inc... | @DeveloperAPI
class Counter(Metric):
'''A cumulative metric that is monotonically increasing.
This corresponds to Prometheus' counter metric:
https://prometheus.io/docs/concepts/metric_types/#counter
Before Ray 2.10, this exports a Prometheus gauge metric instead of
a counter metric, which is wrong.... | 5 | 2 | 9 | 1 | 6 | 2 | 2 | 1 | 1 | 7 | 0 | 1 | 3 | 1 | 3 | 9 | 47 | 9 | 19 | 12 | 10 | 19 | 14 | 7 | 10 | 3 | 1 | 1 | 5 |
10,998 | ray-project/ray | python/ray/util/metrics.py | ray.util.metrics.Gauge | from typing import Any, Dict, List, Optional, Tuple, Union
from ray.util.annotations import DeveloperAPI
from ray._raylet import Count as CythonCount, Gauge as CythonGauge, Histogram as CythonHistogram, Sum as CythonSum
@DeveloperAPI
class Gauge(Metric):
"""Gauges keep the last recorded value and drop everything b... | @DeveloperAPI
class Gauge(Metric):
'''Gauges keep the last recorded value and drop everything before.
Unlike counters, gauges can go up or down over time.
This corresponds to Prometheus' gauge metric:
https://prometheus.io/docs/concepts/metric_types/#gauge
Args:
name: Name of the metric.
... | 5 | 2 | 10 | 1 | 6 | 2 | 2 | 0.84 | 1 | 6 | 0 | 0 | 3 | 1 | 3 | 9 | 45 | 10 | 19 | 12 | 10 | 16 | 14 | 7 | 10 | 3 | 1 | 1 | 5 |
10,999 | ray-project/ray | python/ray/util/metrics.py | ray.util.metrics.Histogram | from typing import Any, Dict, List, Optional, Tuple, Union
from ray.util.annotations import DeveloperAPI
from ray._raylet import Count as CythonCount, Gauge as CythonGauge, Histogram as CythonHistogram, Sum as CythonSum
@DeveloperAPI
class Histogram(Metric):
"""Tracks the size and number of events in buckets.
... | @DeveloperAPI
class Histogram(Metric):
'''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/docs/concepts/metric_types/#h... | 7 | 3 | 13 | 1 | 10 | 2 | 2 | 0.42 | 1 | 8 | 0 | 0 | 4 | 2 | 4 | 10 | 72 | 11 | 43 | 18 | 31 | 18 | 22 | 11 | 17 | 4 | 1 | 2 | 8 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.