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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
9,400 | ray-project/ray | doc/source/serve/doc_code/intel_gaudi_inference_serve_deepspeed.py | intel_gaudi_inference_serve_deepspeed.DeepSpeedLlamaModel | from starlette.requests import Request
import ray
from typing import Dict, Any
from ray.runtime_env import RuntimeEnv
from starlette.responses import StreamingResponse
from ray import serve
@serve.deployment
class DeepSpeedLlamaModel:
def __init__(self, world_size: int, model_id_or_path: str):
self._world... | @serve.deployment
class DeepSpeedLlamaModel:
def __init__(self, world_size: int, model_id_or_path: str):
pass
def generate(self, prompt: str, **config: Dict[str, Any]):
'''Send the prompt to workers for generation.
Return after all workers finish the generation.
Only return the... | 7 | 4 | 16 | 3 | 9 | 4 | 2 | 0.42 | 0 | 8 | 2 | 0 | 5 | 3 | 5 | 5 | 85 | 17 | 48 | 19 | 42 | 20 | 34 | 19 | 28 | 3 | 0 | 1 | 11 |
9,401 | ray-project/ray | doc/source/serve/doc_code/intel_gaudi_inference_serve_deepspeed.py | intel_gaudi_inference_serve_deepspeed.RayTextIteratorStreamer | from typing import Dict, Any
from transformers import TextStreamer
from ray.util.queue import Queue
class RayTextIteratorStreamer(TextStreamer):
def __init__(self, tokenizer, skip_prompt: bool=False, timeout: int=None, **decode_kwargs: Dict[str, Any]):
super().__init__(tokenizer, skip_prompt, **decode_kwa... |
class RayTextIteratorStreamer(TextStreamer):
def __init__(self, tokenizer, skip_prompt: bool=False, timeout: int=None, **decode_kwargs: Dict[str, Any]):
pass
def on_finalized_text(self, text: str, stream_end: bool=False):
pass
def __iter__(self):
pass
def __next__(self):
... | 5 | 0 | 6 | 0 | 6 | 0 | 2 | 0 | 1 | 7 | 1 | 0 | 4 | 3 | 4 | 11 | 27 | 3 | 24 | 15 | 13 | 0 | 17 | 9 | 12 | 2 | 2 | 1 | 6 |
9,402 | ray-project/ray | doc/source/serve/doc_code/key_concepts.py | key_concepts.FastAPIIngress | from fastapi.responses import PlainTextResponse
from ray import serve
@serve.deployment
@serve.ingress(fastapi_app)
class FastAPIIngress:
@fastapi_app.get('/{name}')
async def say_hi(self, name: str) -> str:
return PlainTextResponse(f'Hello {name}!') | @serve.deployment
@serve.ingress(fastapi_app)
class FastAPIIngress:
@fastapi_app.get('/{name}')
async def say_hi(self, name: str) -> str:
pass | 5 | 0 | 2 | 0 | 2 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 1 | 4 | 0 | 4 | 3 | 1 | 0 | 3 | 2 | 1 | 1 | 0 | 0 | 1 |
9,403 | ray-project/ray | doc/source/serve/doc_code/key_concepts.py | key_concepts.Hello | from ray import serve
@serve.deployment
class Hello:
def __call__(self) -> str:
return 'Hello' | @serve.deployment
class Hello:
def __call__(self) -> str:
pass | 3 | 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 |
9,404 | ray-project/ray | doc/source/serve/doc_code/key_concepts.py | key_concepts.Ingress | from ray.serve.handle import DeploymentHandle
from ray import serve
@serve.deployment
class Ingress:
def __init__(self, hello_handle: DeploymentHandle, world_handle: DeploymentHandle):
self._hello_handle = hello_handle
self._world_handle = world_handle
async def __call__(self) -> str:
... | @serve.deployment
class Ingress:
def __init__(self, hello_handle: DeploymentHandle, world_handle: DeploymentHandle):
pass
async def __call__(self) -> str:
pass | 4 | 0 | 4 | 0 | 4 | 0 | 1 | 0 | 0 | 2 | 1 | 0 | 2 | 2 | 2 | 2 | 9 | 1 | 8 | 7 | 5 | 0 | 8 | 7 | 5 | 1 | 0 | 0 | 2 |
9,405 | ray-project/ray | doc/source/serve/doc_code/key_concepts.py | key_concepts.MostBasicIngress | from starlette.requests import Request
from ray import serve
@serve.deployment
class MostBasicIngress:
async def __call__(self, request: Request) -> str:
name = (await request.json())['name']
return f'Hello {name}!' | @serve.deployment
class MostBasicIngress:
async def __call__(self, request: Request) -> str:
pass | 3 | 0 | 3 | 0 | 3 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 1 | 4 | 0 | 4 | 3 | 2 | 0 | 4 | 3 | 2 | 1 | 0 | 0 | 1 |
9,406 | ray-project/ray | doc/source/serve/doc_code/key_concepts.py | key_concepts.MyFirstDeployment | from ray import serve
@serve.deployment
class MyFirstDeployment:
def __init__(self, msg):
self.msg = msg
def __call__(self):
return self.msg | @serve.deployment
class MyFirstDeployment:
def __init__(self, msg):
pass
def __call__(self):
pass | 4 | 0 | 2 | 0 | 2 | 0 | 1 | 0.2 | 0 | 0 | 0 | 0 | 2 | 1 | 2 | 2 | 7 | 1 | 5 | 4 | 2 | 1 | 5 | 4 | 2 | 1 | 0 | 0 | 2 |
9,407 | ray-project/ray | doc/source/tune/doc_code/key_concepts.py | key_concepts.Trainable | from ray import tune
class Trainable(tune.Trainable):
def setup(self, config):
self.x = 0
self.a = config['a']
self.b = config['b']
def step(self):
score = objective(self.x, self.a, self.b)
self.x += 1
return {'score': score}
def save_checkpoint(self, chec... |
class Trainable(tune.Trainable):
def setup(self, config):
pass
def step(self):
pass
def save_checkpoint(self, checkpoint_dir):
pass
def load_checkpoint(self, checkpoint_dir):
pass | 5 | 0 | 3 | 0 | 3 | 1 | 1 | 0.31 | 1 | 0 | 0 | 0 | 4 | 3 | 4 | 4 | 20 | 4 | 13 | 9 | 8 | 4 | 13 | 9 | 8 | 1 | 1 | 0 | 4 |
9,408 | ray-project/ray | doc/source/serve/doc_code/key_concepts.py | key_concepts.World | from ray import serve
@serve.deployment
class World:
def __call__(self) -> str:
return ' world!' | @serve.deployment
class World:
def __call__(self) -> str:
pass | 3 | 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 |
9,409 | ray-project/ray | doc/source/serve/doc_code/model_composition/language_example.py | language_example.EchoClass | from starlette.requests import Request
from ray import serve
@serve.deployment
class EchoClass:
def __init__(self, echo_str: str):
self.echo_str = echo_str
def __call__(self, request: Request) -> str:
return self.echo_str | @serve.deployment
class EchoClass:
def __init__(self, echo_str: str):
pass
def __call__(self, request: Request) -> str:
pass | 4 | 0 | 2 | 0 | 2 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 2 | 1 | 2 | 2 | 6 | 1 | 5 | 4 | 2 | 0 | 5 | 4 | 2 | 1 | 0 | 0 | 2 |
9,410 | ray-project/ray | doc/source/serve/doc_code/model_composition/language_example.py | language_example.FrenchResponder | from ray import serve
@serve.deployment
class FrenchResponder:
def say_hello(self, name: str):
return f'Bonjour {name}' | @serve.deployment
class FrenchResponder:
def say_hello(self, name: str):
pass | 3 | 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 |
9,411 | ray-project/ray | doc/source/serve/doc_code/model_composition/language_example.py | language_example.LanguageClassifer | from ray import serve
from ray.serve.handle import DeploymentHandle
@serve.deployment
class LanguageClassifer:
def __init__(self, spanish_responder: DeploymentHandle, french_responder: DeploymentHandle):
self.spanish_responder = spanish_responder
self.french_responder = french_responder
async... | @serve.deployment
class LanguageClassifer:
def __init__(self, spanish_responder: DeploymentHandle, french_responder: DeploymentHandle):
pass
async def __call__(self, http_request):
pass | 4 | 0 | 9 | 1 | 8 | 0 | 2 | 0 | 0 | 1 | 1 | 0 | 2 | 2 | 2 | 2 | 19 | 3 | 16 | 10 | 11 | 0 | 12 | 8 | 9 | 3 | 0 | 1 | 4 |
9,412 | ray-project/ray | doc/source/serve/doc_code/model_composition/language_example.py | language_example.SpanishResponder | from ray import serve
@serve.deployment
class SpanishResponder:
def say_hello(self, name: str):
return f'Hola {name}' | @serve.deployment
class SpanishResponder:
def say_hello(self, name: str):
pass | 3 | 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 |
9,413 | ray-project/ray | python/ray/train/examples/experiment_tracking/lightning_exp_tracking_model_dl.py | lightning_exp_tracking_model_dl.DummyModel | import torch.nn.functional as F
import pytorch_lightning as pl
import torch
class DummyModel(pl.LightningModule):
def __init__(self):
super().__init__()
self.layer = torch.nn.Linear(3, 1)
def forward(self, x):
return self.layer(x)
def training_step(self, batch, batch_idx):
... |
class DummyModel(pl.LightningModule):
def __init__(self):
pass
def forward(self, x):
pass
def training_step(self, batch, batch_idx):
pass
def configure_optimizers(self):
pass | 5 | 0 | 5 | 0 | 4 | 0 | 1 | 0.06 | 1 | 1 | 0 | 0 | 4 | 1 | 4 | 4 | 22 | 4 | 17 | 9 | 12 | 1 | 15 | 9 | 10 | 1 | 1 | 0 | 4 |
9,414 | ray-project/ray | doc/source/ray-core/doc_code/limit_pending_tasks.py | limit_pending_tasks.Actor | import ray
@ray.remote
class Actor:
async def heavy_compute(self):
return | @ray.remote
class Actor:
async def heavy_compute(self):
pass | 3 | 0 | 4 | 0 | 2 | 2 | 1 | 0.67 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 5 | 0 | 3 | 2 | 1 | 2 | 3 | 2 | 1 | 1 | 0 | 0 | 1 |
9,415 | ray-project/ray | ci/ray_ci/linux_container.py | linux_container.LinuxContainer | import sys
from typing import List, Optional, Tuple
import subprocess
import os
from ci.ray_ci.container import Container
class LinuxContainer(Container):
def __init__(self, docker_tag: str, volumes: Optional[List[str]]=None, envs: Optional[List[str]]=None, tmp_filesystem: Optional[str]=None, privileged: bool=Fal... |
class LinuxContainer(Container):
def __init__(self, docker_tag: str, volumes: Optional[List[str]]=None, envs: Optional[List[str]]=None, tmp_filesystem: Optional[str]=None, privileged: bool=False) -> None:
pass
def install_ray(self, build_type: Optional[str]=None, mask: Optional[str]=None) -> List[str... | 6 | 0 | 14 | 1 | 13 | 0 | 2 | 0 | 1 | 5 | 0 | 3 | 5 | 1 | 5 | 34 | 73 | 7 | 66 | 20 | 51 | 0 | 26 | 11 | 20 | 4 | 5 | 2 | 10 |
9,416 | ray-project/ray | ci/ray_ci/linux_tester_container.py | linux_tester_container.LinuxTesterContainer | from typing import List, Optional
from ci.ray_ci.linux_container import LinuxContainer
import os
from ci.ray_ci.tester_container import TesterContainer
class LinuxTesterContainer(TesterContainer, LinuxContainer):
def __init__(self, docker_tag: str, shard_count: int=1, gpus: int=0, network: Optional[str]=None, tes... |
class LinuxTesterContainer(TesterContainer, LinuxContainer):
def __init__(self, docker_tag: str, shard_count: int=1, gpus: int=0, network: Optional[str]=None, test_envs: Optional[List[str]]=None, shard_ids: Optional[List[int]]=None, skip_ray_installation: bool=False, build_type: Optional[str]=None, install_mask: ... | 2 | 0 | 33 | 0 | 33 | 0 | 1 | 0 | 2 | 3 | 0 | 0 | 1 | 0 | 1 | 45 | 34 | 0 | 34 | 13 | 21 | 0 | 4 | 2 | 2 | 1 | 6 | 0 | 1 |
9,417 | ray-project/ray | doc/source/serve/doc_code/load_shedding.py | load_shedding.Requester | import ray
import aiohttp
@ray.remote
class Requester:
async def do_request(self) -> int:
async with aiohttp.ClientSession('http://localhost:8000/') as session:
return (await session.get('/')).status | @ray.remote
class Requester:
async def do_request(self) -> int:
pass | 3 | 0 | 3 | 0 | 3 | 0 | 1 | 0 | 0 | 2 | 0 | 0 | 1 | 0 | 1 | 1 | 4 | 0 | 4 | 3 | 2 | 0 | 4 | 2 | 2 | 1 | 0 | 1 | 1 |
9,418 | ray-project/ray | doc/source/serve/doc_code/load_shedding.py | load_shedding.SlowDeployment | from ray import serve
import time
from starlette.requests import Request
@serve.deployment(max_ongoing_requests=2, max_queued_requests=2)
class SlowDeployment:
def __call__(self, request: Request) -> str:
time.sleep(2)
return 'Hello!' | @serve.deployment(max_ongoing_requests=2, max_queued_requests=2)
class SlowDeployment:
def __call__(self, request: Request) -> str:
pass | 3 | 0 | 4 | 0 | 3 | 1 | 1 | 0.25 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 1 | 5 | 0 | 4 | 2 | 2 | 1 | 4 | 2 | 2 | 1 | 0 | 0 | 1 |
9,419 | ray-project/ray | doc/source/serve/doc_code/local_dev.py | local_dev.Doubler | from ray import serve
@serve.deployment
class Doubler:
def double(self, s: str):
return s + ' ' + s | @serve.deployment
class Doubler:
def double(self, s: str):
pass | 3 | 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 |
9,420 | ray-project/ray | doc/source/serve/doc_code/local_dev.py | local_dev.HelloDeployment | from ray import serve
from ray.serve.handle import DeploymentHandle, DeploymentResponse
from starlette.requests import Request
@serve.deployment
class HelloDeployment:
def __init__(self, doubler: DeploymentHandle):
self.doubler = doubler
async def say_hello_twice(self, name: str):
return awai... | @serve.deployment
class HelloDeployment:
def __init__(self, doubler: DeploymentHandle):
pass
async def say_hello_twice(self, name: str):
pass
async def __call__(self, request: Request):
pass | 5 | 0 | 2 | 0 | 2 | 0 | 1 | 0 | 0 | 2 | 1 | 0 | 3 | 1 | 3 | 3 | 9 | 2 | 7 | 5 | 3 | 0 | 7 | 5 | 3 | 1 | 0 | 0 | 3 |
9,421 | ray-project/ray | release/serve_tests/workloads/locust_utils.py | locust_utils.LocustLoadTestConfig | from dataclasses import asdict, dataclass
from typing import Any, List
from ray.serve._private.benchmarks.locust_utils import LocustStage, LocustTestResults, PerformanceStats
@dataclass
class LocustLoadTestConfig:
num_workers: int
host_url: str
auth_token: str
data: Any
stages: List[LocustStage]
... | @dataclass
class LocustLoadTestConfig:
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 | 0 | 7 | 2 | 6 | 0 | 7 | 2 | 6 | 0 | 0 | 0 | 0 |
9,422 | ray-project/ray | release/k8s_tests/locustfile.py | locustfile.TimeoutHTTPAdapter | from requests.adapters import HTTPAdapter
class TimeoutHTTPAdapter(HTTPAdapter):
def __init__(self, timeout, *args, **kwargs):
self.timeout = timeout
super().__init__(*args, **kwargs)
def send(self, request, **kwargs):
timeout = kwargs.get('timeout')
if timeout is None:
... |
class TimeoutHTTPAdapter(HTTPAdapter):
def __init__(self, timeout, *args, **kwargs):
pass
def send(self, request, **kwargs):
pass | 3 | 0 | 4 | 0 | 4 | 0 | 2 | 0 | 1 | 1 | 0 | 0 | 2 | 1 | 2 | 20 | 10 | 1 | 9 | 5 | 6 | 0 | 9 | 5 | 6 | 2 | 2 | 1 | 3 |
9,423 | ray-project/ray | doc/source/serve/doc_code/monitoring/logging_config.py | logging_config.Model | from ray import serve
from ray.serve.schema import LoggingConfig
@serve.deployment(logging_config=LoggingConfig(encoding='JSON'))
class Model:
def __call__(self) -> int:
return 'hello world' | @serve.deployment(logging_config=LoggingConfig(encoding='JSON'))
class Model:
def __call__(self) -> int:
pass | 3 | 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 |
9,424 | ray-project/ray | doc/source/serve/doc_code/monitoring/logging_config.py | logging_config.Router | import logging
from ray import serve
@serve.deployment
class Router:
def __init__(self, handle):
self.handle = handle
async def __call__(self):
logger = logging.getLogger('ray.serve')
logger.debug('This debug message is from the router.')
return await self.handle.remote() | @serve.deployment
class Router:
def __init__(self, handle):
pass
async def __call__(self):
pass | 4 | 0 | 3 | 0 | 3 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 | 1 | 2 | 2 | 8 | 1 | 7 | 5 | 4 | 0 | 7 | 5 | 4 | 1 | 0 | 0 | 2 |
9,425 | ray-project/ray | release/tune_tests/cloud_tests/workloads/long_running_cloud_storage.py | long_running_cloud_storage.ProgressCallback | from ray.tune import Callback
import os
import time
from collections import Counter
import json
class ProgressCallback(Callback):
def __init__(self):
self.last_update = 0
self.update_interval = 60
def on_step_end(self, iteration, trials, **kwargs):
if time.time() - self.last_update > ... |
class ProgressCallback(Callback):
def __init__(self):
pass
def on_step_end(self, iteration, trials, **kwargs):
pass | 3 | 0 | 11 | 1 | 10 | 0 | 2 | 0 | 1 | 2 | 0 | 0 | 2 | 2 | 2 | 2 | 23 | 3 | 20 | 10 | 17 | 0 | 16 | 9 | 13 | 2 | 1 | 2 | 3 |
9,426 | ray-project/ray | release/air_tests/air_benchmarks/mlperf-train/make_fake_dataset.py | make_fake_dataset.ImageCoder | import tensorflow.compat.v1 as tf
class ImageCoder(object):
"""Helper class that provides TensorFlow image coding utilities."""
def __init__(self):
tf.disable_v2_behavior()
self._sess = tf.Session()
self._png_data = tf.placeholder(dtype=tf.string)
image = tf.image.decode_png(se... |
class ImageCoder(object):
'''Helper class that provides TensorFlow image coding utilities.'''
def __init__(self):
pass
def png_to_jpeg(self, image_data: bytes) -> tf.Tensor:
'''Converts a PNG compressed image to a JPEG Tensor.'''
pass
def cmyk_to_rgb(self, image_data: bytes) ... | 5 | 4 | 9 | 1 | 6 | 2 | 1 | 0.32 | 1 | 1 | 0 | 0 | 4 | 7 | 4 | 4 | 41 | 8 | 25 | 14 | 20 | 8 | 21 | 14 | 16 | 1 | 1 | 0 | 4 |
9,427 | ray-project/ray | doc/source/serve/doc_code/managing_deployments.py | managing_deployments.MyDeployment | import os
from ray import serve
@serve.deployment
class MyDeployment:
def __init__(self, parallelism: str):
os.environ['OMP_NUM_THREADS'] = parallelism
def __call__(self):
pass | @serve.deployment
class MyDeployment:
def __init__(self, parallelism: str):
pass
def __call__(self):
pass | 4 | 0 | 2 | 0 | 2 | 0 | 1 | 0.2 | 0 | 1 | 0 | 0 | 2 | 0 | 2 | 2 | 7 | 1 | 5 | 3 | 2 | 1 | 5 | 3 | 2 | 1 | 0 | 0 | 2 |
9,428 | ray-project/ray | doc/source/serve/doc_code/managing_deployments.py | managing_deployments.SimpleDeployment | from ray import serve
@serve.deployment(name='my_deployment', num_replicas=1)
class SimpleDeployment:
pass | @serve.deployment(name='my_deployment', num_replicas=1)
class SimpleDeployment:
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 0 | 0 | 0 |
9,429 | ray-project/ray | release/long_running_tests/workloads/many_actor_tasks.py | many_actor_tasks.Actor | import ray
import numpy as np
@ray.remote
class Actor(object):
def __init__(self):
self.value = 0
def method(self):
self.value += 1
return np.zeros(1024, dtype=np.uint8) | @ray.remote
class Actor(object):
def __init__(self):
pass
def method(self):
pass | 4 | 0 | 3 | 0 | 3 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 2 | 1 | 2 | 2 | 7 | 1 | 6 | 4 | 3 | 0 | 6 | 4 | 3 | 1 | 1 | 0 | 2 |
9,430 | ray-project/ray | doc/source/ray-observability/doc_code/memray_profiling.py | memray_profiling.Actor | import memray
import ray
import memray
import ray
@ray.remote
class Actor:
def __init__(self):
memray.Tracker(f'/tmp/ray/session_latest/logs/{ray.get_runtime_context().get_actor_id()}_mem_profile.bin').__enter__()
self.arr = [bytearray(b'1' * 1000000)]
def append(self):
self.arr.appen... | @ray.remote
class Actor:
def __init__(self):
pass
def append(self):
pass | 4 | 0 | 5 | 0 | 4 | 1 | 1 | 0.11 | 0 | 1 | 0 | 0 | 2 | 1 | 2 | 2 | 11 | 1 | 9 | 4 | 6 | 1 | 6 | 4 | 3 | 1 | 0 | 0 | 2 |
9,431 | ray-project/ray | release/air_tests/air_benchmarks/mlperf-train/metric_utils.py | metric_utils.MaxMemoryUtilizationTracker | import time
import threading
class MaxMemoryUtilizationTracker:
"""
Class that enables tracking of the maximum memory utilization on a
system.
This creates a thread which samples the available memory every sample_interval_s
seconds. The "available" memory is reported directly from psutil.
See ... |
class MaxMemoryUtilizationTracker:
'''
Class that enables tracking of the maximum memory utilization on a
system.
This creates a thread which samples the available memory every sample_interval_s
seconds. The "available" memory is reported directly from psutil.
See https://psutil.readthedocs.io/... | 6 | 1 | 13 | 2 | 12 | 0 | 2 | 0.17 | 0 | 6 | 0 | 0 | 3 | 4 | 4 | 4 | 67 | 11 | 48 | 18 | 36 | 8 | 25 | 12 | 19 | 4 | 0 | 3 | 7 |
9,432 | ray-project/ray | doc/source/ray-observability/doc_code/metrics_example.py | metrics_example.MyActor | from ray.util.metrics import Counter, Gauge, Histogram
import time
import ray
@ray.remote
class MyActor:
def __init__(self, name):
self._curr_count = 0
self.counter = Counter('num_requests', description='Number of requests processed by the actor.', tag_keys=('actor_name',))
self.counter.se... | @ray.remote
class MyActor:
def __init__(self, name):
pass
def process_request(self, num):
pass | 4 | 0 | 18 | 3 | 14 | 2 | 1 | 0.1 | 0 | 1 | 1 | 0 | 2 | 4 | 2 | 2 | 38 | 6 | 29 | 8 | 26 | 3 | 16 | 8 | 13 | 1 | 0 | 0 | 2 |
9,433 | ray-project/ray | rllib/examples/catalogs/mobilenet_v2_encoder.py | mobilenet_v2_encoder.MobileNetEnhancedPPOCatalog | import gymnasium as gym
from ray.rllib.examples._old_api_stack.models.mobilenet_v2_encoder import MobileNetV2EncoderConfig, MOBILENET_INPUT_SHAPE
from ray.rllib.algorithms.ppo.ppo_catalog import PPOCatalog
class MobileNetEnhancedPPOCatalog(PPOCatalog):
@classmethod
def _get_encoder_config(cls, observation_spa... |
class MobileNetEnhancedPPOCatalog(PPOCatalog):
@classmethod
def _get_encoder_config(cls, observation_space: gym.Space, **kwargs):
pass | 3 | 0 | 13 | 0 | 12 | 1 | 2 | 0.07 | 1 | 1 | 0 | 0 | 0 | 0 | 1 | 1 | 15 | 0 | 14 | 7 | 7 | 1 | 5 | 2 | 3 | 2 | 1 | 1 | 2 |
9,434 | ray-project/ray | doc/source/serve/doc_code/configure_serve_deployment/model_deployment.py | model_deployment.Example | from ray import serve
@serve.deployment(name='Translator', num_replicas=2, ray_actor_options={'num_cpus': 0.2, 'num_gpus': 0}, max_ongoing_requests=100, health_check_period_s=10, health_check_timeout_s=30, graceful_shutdown_timeout_s=20, graceful_shutdown_wait_loop_s=2)
class Example:
... | @serve.deployment(name='Translator', num_replicas=2, ray_actor_options={'num_cpus': 0.2, 'num_gpus': 0}, max_ongoing_requests=100, health_check_period_s=10, health_check_timeout_s=30, graceful_shutdown_timeout_s=20, graceful_shutdown_wait_loop_s=2)
class Example:
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 0 | 0 | 0 |
9,435 | ray-project/ray | doc/source/serve/doc_code/getting_started/model_deployment.py | model_deployment.Translator | from transformers import pipeline
from starlette.requests import Request
from ray import serve
@serve.deployment(num_replicas=2, ray_actor_options={'num_cpus': 0.2, 'num_gpus': 0})
class Translator:
def __init__(self):
self.model = pipeline('translation_en_to_fr', model='t5-small')
def translate(self... | @serve.deployment(num_replicas=2, ray_actor_options={'num_cpus': 0.2, 'num_gpus': 0})
class Translator:
def __init__(self):
pass
def translate(self, text: str) -> str:
pass
async def __call__(self, http_request: Request) -> str:
pass | 5 | 0 | 5 | 1 | 3 | 1 | 1 | 0.3 | 0 | 1 | 0 | 0 | 3 | 1 | 3 | 3 | 17 | 4 | 10 | 8 | 6 | 3 | 10 | 8 | 6 | 1 | 0 | 0 | 3 |
9,436 | ray-project/ray | doc/source/serve/doc_code/getting_started/model_deployment_full.py | model_deployment_full.Translator | from starlette.requests import Request
from transformers import pipeline
from ray import serve
@serve.deployment(num_replicas=2, ray_actor_options={'num_cpus': 0.2, 'num_gpus': 0})
class Translator:
def __init__(self):
self.model = pipeline('translation_en_to_fr', model='t5-small')
def translate(self... | @serve.deployment(num_replicas=2, ray_actor_options={'num_cpus': 0.2, 'num_gpus': 0})
class Translator:
def __init__(self):
pass
def translate(self, text: str) -> str:
pass
async def __call__(self, http_request: Request) -> str:
pass | 5 | 0 | 5 | 1 | 3 | 1 | 1 | 0.3 | 0 | 1 | 0 | 0 | 3 | 1 | 3 | 3 | 17 | 4 | 10 | 8 | 6 | 3 | 10 | 8 | 6 | 1 | 0 | 0 | 3 |
9,437 | ray-project/ray | doc/source/serve/doc_code/getting_started/models.py | models.Summarizer | from transformers import pipeline
class Summarizer:
def __init__(self):
self.model = pipeline('summarization', model='t5-small')
def summarize(self, text: str) -> str:
model_output = self.model(text, min_length=5, max_length=15)
summary = model_output[0]['summary_text']
return... |
class Summarizer:
def __init__(self):
pass
def summarize(self, text: str) -> str:
pass | 3 | 0 | 6 | 1 | 3 | 2 | 1 | 0.43 | 0 | 1 | 0 | 0 | 2 | 1 | 2 | 2 | 13 | 3 | 7 | 6 | 4 | 3 | 7 | 6 | 4 | 1 | 0 | 0 | 2 |
9,438 | ray-project/ray | doc/source/serve/doc_code/getting_started/models.py | models.Translator | from transformers import pipeline
class Translator:
def __init__(self):
self.model = pipeline('translation_en_to_fr', model='t5-small')
def translate(self, text: str) -> str:
model_output = self.model(text)
translation = model_output[0]['translation_text']
return translation |
class Translator:
def __init__(self):
pass
def translate(self, text: str) -> str:
pass | 3 | 0 | 6 | 1 | 3 | 2 | 1 | 0.43 | 0 | 1 | 0 | 0 | 2 | 1 | 2 | 2 | 13 | 3 | 7 | 6 | 4 | 3 | 7 | 6 | 4 | 1 | 0 | 0 | 2 |
9,439 | ray-project/ray | ci/ray_ci/doc/module.py | module.Module | from ci.ray_ci.doc.api import API, AnnotationType, CodeType
from typing import List
import inspect
import importlib
from types import ModuleType
class Module:
"""
Module class represents the top level module to walk through and find annotated
APIs.
"""
def __init__(self, module: str):
self... |
class Module:
'''
Module class represents the top level module to walk through and find annotated
APIs.
'''
def __init__(self, module: str):
pass
def walk(self) -> None:
pass
def get_apis(self) -> List[API]:
pass
def _walk(self, module: ModuleType) -> None:
... | 9 | 3 | 8 | 1 | 6 | 1 | 2 | 0.24 | 0 | 6 | 3 | 0 | 8 | 3 | 8 | 8 | 75 | 12 | 51 | 14 | 42 | 12 | 39 | 14 | 30 | 9 | 0 | 3 | 17 |
9,440 | ray-project/ray | doc/source/serve/doc_code/monitoring/monitoring.py | monitoring.SayHello | from ray import serve
from starlette.requests import Request
@serve.deployment
class SayHello:
async def __call__(self, request: Request) -> str:
logger.info('Hello world!')
return 'hi' | @serve.deployment
class SayHello:
async def __call__(self, request: Request) -> str:
pass | 3 | 0 | 3 | 0 | 3 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 1 | 4 | 0 | 4 | 2 | 2 | 0 | 4 | 2 | 2 | 1 | 0 | 0 | 1 |
9,441 | ray-project/ray | doc/source/ray-core/doc_code/monte_carlo_pi.py | monte_carlo_pi.ProgressActor | import ray
@ray.remote
class ProgressActor:
def __init__(self, total_num_samples: int):
self.total_num_samples = total_num_samples
self.num_samples_completed_per_task = {}
def report_progress(self, task_id: int, num_samples_completed: int) -> None:
self.num_samples_completed_per_task[... | @ray.remote
class ProgressActor:
def __init__(self, total_num_samples: int):
pass
def report_progress(self, task_id: int, num_samples_completed: int) -> None:
pass
def get_progress(self) -> float:
pass | 5 | 0 | 3 | 0 | 3 | 0 | 1 | 0 | 0 | 2 | 0 | 0 | 3 | 2 | 3 | 3 | 12 | 2 | 10 | 6 | 6 | 0 | 8 | 6 | 4 | 1 | 0 | 0 | 3 |
9,442 | ray-project/ray | doc/source/serve/doc_code/multiplexed.py | multiplexed.Downstream | from ray import serve
@serve.deployment
class Downstream:
def __call__(self):
return serve.get_multiplexed_model_id() | @serve.deployment
class Downstream:
def __call__(self):
pass | 3 | 0 | 2 | 0 | 2 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 3 | 0 | 3 | 2 | 1 | 0 | 3 | 2 | 1 | 1 | 0 | 0 | 1 |
9,443 | ray-project/ray | doc/source/serve/doc_code/multiplexed.py | multiplexed.ModelInferencer | import starlette
from ray import serve
import torch
import aioboto3
@serve.deployment
class ModelInferencer:
def __init__(self):
self.bucket_name = 'my_bucket'
@serve.multiplexed(max_num_models_per_replica=3)
async def get_model(self, model_id: str):
session = aioboto3.Session()
a... | @serve.deployment
class ModelInferencer:
def __init__(self):
pass
@serve.multiplexed(max_num_models_per_replica=3)
async def get_model(self, model_id: str):
pass
async def __call__(self, request: starlette.requests.Request):
pass | 6 | 0 | 4 | 0 | 4 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 | 1 | 3 | 3 | 16 | 2 | 14 | 11 | 9 | 0 | 13 | 9 | 9 | 1 | 0 | 1 | 3 |
9,444 | ray-project/ray | doc/source/serve/doc_code/multiplexed.py | multiplexed.Upstream | from ray import serve
import starlette
from ray.serve.handle import DeploymentHandle
@serve.deployment
class Upstream:
def __init__(self, downstream: DeploymentHandle):
self._h = downstream
async def __call__(self, request: starlette.requests.Request):
return await self._h.options(multiplexed... | @serve.deployment
class Upstream:
def __init__(self, downstream: DeploymentHandle):
pass
async def __call__(self, request: starlette.requests.Request):
pass | 4 | 0 | 2 | 0 | 2 | 0 | 1 | 0 | 0 | 1 | 1 | 0 | 2 | 1 | 2 | 2 | 6 | 1 | 5 | 4 | 2 | 0 | 5 | 4 | 2 | 1 | 0 | 0 | 2 |
9,445 | ray-project/ray | python/ray/util/collective/examples/nccl_allreduce_example.py | nccl_allreduce_example.Worker | import ray
import ray.util.collective as collective
import cupy as cp
@ray.remote(num_gpus=1)
class Worker:
def __init__(self):
self.send = cp.ones((4,), dtype=cp.float32)
self.recv = cp.zeros((4,), dtype=cp.float32)
def setup(self, world_size, rank):
collective.init_collective_group(... | @ray.remote(num_gpus=1)
class Worker:
def __init__(self):
pass
def setup(self, world_size, rank):
pass
def compute(self):
pass
def destroy(self):
pass | 6 | 0 | 3 | 0 | 3 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 4 | 2 | 4 | 4 | 15 | 3 | 12 | 7 | 7 | 0 | 12 | 7 | 7 | 1 | 0 | 0 | 4 |
9,446 | ray-project/ray | python/ray/util/collective/examples/nccl_allreduce_example_declare_collective_group.py | nccl_allreduce_example_declare_collective_group.Worker | import ray.util.collective as collective
import ray
import cupy as cp
@ray.remote(num_gpus=1)
class Worker:
def __init__(self):
self.send = cp.ones((4,), dtype=cp.float32)
def compute(self):
collective.allreduce(self.send, '177')
return self.send | @ray.remote(num_gpus=1)
class Worker:
def __init__(self):
pass
def compute(self):
pass | 4 | 0 | 3 | 0 | 3 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 | 1 | 2 | 2 | 7 | 1 | 6 | 4 | 3 | 0 | 6 | 4 | 3 | 1 | 0 | 0 | 2 |
9,447 | ray-project/ray | python/ray/util/collective/examples/nccl_allreduce_multigpu_example.py | nccl_allreduce_multigpu_example.Worker | import ray
import cupy as cp
import ray.util.collective as collective
from cupy.cuda import Device
@ray.remote(num_gpus=2)
class Worker:
def __init__(self):
with Device(0):
self.send1 = cp.ones((4,), dtype=cp.float32)
with Device(1):
self.send2 = cp.ones((4,), dtype=cp.floa... | @ray.remote(num_gpus=2)
class Worker:
def __init__(self):
pass
def setup(self, world_size, rank):
pass
def compute(self):
pass
def destroy(self):
pass | 6 | 0 | 4 | 0 | 4 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 4 | 3 | 4 | 4 | 19 | 4 | 15 | 8 | 10 | 0 | 15 | 8 | 10 | 1 | 0 | 1 | 4 |
9,448 | ray-project/ray | python/ray/util/collective/examples/nccl_p2p_example_multigpu.py | nccl_p2p_example_multigpu.Worker | from cupy.cuda import Device
import ray.util.collective as collective
import cupy as cp
import ray
@ray.remote(num_gpus=2)
class Worker:
def __init__(self):
with Device(0):
self.send1 = cp.ones((4,), dtype=cp.float32)
with Device(1):
self.send2 = cp.ones((4,), dtype=cp.floa... | @ray.remote(num_gpus=2)
class Worker:
def __init__(self):
pass
def setup(self, world_size, rank):
pass
def compute(self):
pass
def destroy(self):
pass | 6 | 0 | 6 | 0 | 6 | 0 | 1 | 0.04 | 0 | 0 | 0 | 0 | 4 | 5 | 4 | 4 | 29 | 4 | 24 | 10 | 19 | 1 | 23 | 10 | 18 | 2 | 0 | 2 | 5 |
9,449 | ray-project/ray | release/serve_tests/workloads/noop.py | noop.Noop | from ray import serve
@serve.deployment
class Noop:
async def __call__(self):
return 0 | @serve.deployment
class Noop:
async def __call__(self):
pass | 3 | 0 | 2 | 0 | 2 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 3 | 0 | 3 | 2 | 1 | 0 | 3 | 2 | 1 | 1 | 0 | 0 | 1 |
9,450 | ray-project/ray | doc/source/serve/doc_code/object_detection.py | object_detection.APIIngress | from ray import serve
from io import BytesIO
from fastapi.responses import Response
from ray.serve.handle import DeploymentHandle
@serve.deployment(num_replicas=1)
@serve.ingress(app)
class APIIngress:
def __init__(self, object_detection_handle: DeploymentHandle):
self.handle = object_detection_handle
... | @serve.deployment(num_replicas=1)
@serve.ingress(app)
class APIIngress:
def __init__(self, object_detection_handle: DeploymentHandle):
pass
@app.get('/detect', responses={200: {'content': {'image/jpeg': {}}}}, response_class=Response)
async def detect(self, image_url: str):
pass | 6 | 0 | 4 | 0 | 4 | 0 | 1 | 0 | 0 | 2 | 1 | 0 | 2 | 1 | 2 | 2 | 14 | 1 | 13 | 11 | 5 | 0 | 8 | 6 | 5 | 1 | 0 | 0 | 2 |
9,451 | ray-project/ray | doc/source/serve/doc_code/object_detection.py | object_detection.ObjectDetection | from ray import serve
import torch
import numpy as np
from PIL import Image
@serve.deployment(ray_actor_options={'num_gpus': 1}, autoscaling_config={'min_replicas': 1, 'max_replicas': 2})
class ObjectDetection:
def __init__(self):
self.model = torch.hub.load('ultralytics/yolov5', 'yolov5s')
self.m... | @serve.deployment(ray_actor_options={'num_gpus': 1}, autoscaling_config={'min_replicas': 1, 'max_replicas': 2})
class ObjectDetection:
def __init__(self):
pass
def detect(self, image_url: str):
pass | 4 | 0 | 4 | 0 | 4 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 2 | 1 | 2 | 2 | 9 | 1 | 8 | 5 | 5 | 0 | 8 | 5 | 5 | 1 | 0 | 0 | 2 |
9,452 | ray-project/ray | doc/source/ray-core/doc_code/pattern_async_actor.py | pattern_async_actor.AsyncTaskExecutor | import ray
@ray.remote
class AsyncTaskExecutor:
def __init__(self, task_store):
self.task_store = task_store
self.num_executed_tasks = 0
async def run(self):
while True:
task = await task_store.get_next_task.remote()
self._execute_task(task)
def _execute_t... | @ray.remote
class AsyncTaskExecutor:
def __init__(self, task_store):
pass
async def run(self):
pass
def _execute_task(self, task):
pass
def get_num_executed_tasks(self):
pass | 6 | 0 | 4 | 0 | 3 | 1 | 1 | 0.33 | 0 | 0 | 0 | 0 | 4 | 2 | 4 | 4 | 19 | 3 | 12 | 8 | 7 | 4 | 12 | 8 | 7 | 2 | 0 | 1 | 5 |
9,453 | ray-project/ray | doc/source/ray-core/doc_code/pattern_async_actor.py | pattern_async_actor.TaskExecutor | import ray
@ray.remote
class TaskExecutor:
def __init__(self, task_store):
self.task_store = task_store
self.num_executed_tasks = 0
def run(self):
while True:
task = ray.get(task_store.get_next_task.remote())
self._execute_task(task)
def _execute_task(self... | @ray.remote
class TaskExecutor:
def __init__(self, task_store):
pass
def run(self):
pass
def _execute_task(self, task):
pass
def get_num_executed_tasks(self):
pass | 6 | 0 | 3 | 0 | 3 | 0 | 1 | 0.08 | 0 | 0 | 0 | 0 | 4 | 2 | 4 | 4 | 16 | 3 | 12 | 8 | 7 | 1 | 12 | 8 | 7 | 2 | 0 | 1 | 5 |
9,454 | ray-project/ray | doc/source/ray-core/doc_code/pattern_async_actor.py | pattern_async_actor.TaskStore | import ray
@ray.remote
class TaskStore:
def get_next_task(self):
return 'task' | @ray.remote
class TaskStore:
def get_next_task(self):
pass | 3 | 0 | 2 | 0 | 2 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 3 | 0 | 3 | 2 | 1 | 0 | 3 | 2 | 1 | 1 | 0 | 0 | 1 |
9,455 | ray-project/ray | doc/source/ray-core/doc_code/pattern_pipelining.py | pattern_pipelining.WorkQueue | import ray
@ray.remote
class WorkQueue:
def __init__(self):
self.queue = list(range(10))
def get_work_item(self):
if self.queue:
return self.queue.pop(0)
else:
return None | @ray.remote
class WorkQueue:
def __init__(self):
pass
def get_work_item(self):
pass | 4 | 0 | 4 | 0 | 4 | 0 | 2 | 0 | 0 | 2 | 0 | 0 | 2 | 1 | 2 | 2 | 9 | 1 | 8 | 4 | 5 | 0 | 7 | 4 | 4 | 2 | 0 | 1 | 3 |
9,456 | ray-project/ray | doc/source/ray-core/doc_code/pattern_pipelining.py | pattern_pipelining.WorkerWithPipelining | import ray
@ray.remote
class WorkerWithPipelining:
def __init__(self, work_queue):
self.work_queue = work_queue
def process(self, work_item):
print(work_item)
def run(self):
self.work_item_ref = self.work_queue.get_work_item.remote()
while True:
work_item = ra... | @ray.remote
class WorkerWithPipelining:
def __init__(self, work_queue):
pass
def process(self, work_item):
pass
def run(self):
pass | 5 | 0 | 6 | 1 | 4 | 1 | 2 | 0.15 | 0 | 0 | 0 | 0 | 3 | 2 | 3 | 3 | 21 | 6 | 13 | 7 | 9 | 2 | 13 | 7 | 9 | 3 | 0 | 2 | 5 |
9,457 | ray-project/ray | doc/source/ray-core/doc_code/pattern_pipelining.py | pattern_pipelining.WorkerWithoutPipelining | import ray
@ray.remote
class WorkerWithoutPipelining:
def __init__(self, work_queue):
self.work_queue = work_queue
def process(self, work_item):
print(work_item)
def run(self):
while True:
work_item = ray.get(self.work_queue.get_work_item.remote())
if work... | @ray.remote
class WorkerWithoutPipelining:
def __init__(self, work_queue):
pass
def process(self, work_item):
pass
def run(self):
pass | 5 | 0 | 5 | 1 | 3 | 1 | 2 | 0.18 | 0 | 0 | 0 | 0 | 3 | 1 | 3 | 3 | 17 | 4 | 11 | 6 | 7 | 2 | 11 | 6 | 7 | 3 | 0 | 2 | 5 |
9,458 | ray-project/ray | doc/source/ray-core/doc_code/pattern_tree_of_actors.py | pattern_tree_of_actors.Supervisor | import ray
@ray.remote(num_cpus=1)
class Supervisor:
def __init__(self, hyperparameter, data):
self.trainers = [Trainer.remote(hyperparameter, d) for d in data]
def fit(self):
return ray.get([trainer.fit.remote() for trainer in self.trainers]) | @ray.remote(num_cpus=1)
class Supervisor:
def __init__(self, hyperparameter, data):
pass
def fit(self):
pass | 4 | 0 | 3 | 0 | 2 | 1 | 1 | 0.2 | 0 | 1 | 1 | 0 | 2 | 1 | 2 | 2 | 7 | 1 | 5 | 4 | 2 | 1 | 5 | 4 | 2 | 1 | 0 | 0 | 2 |
9,459 | ray-project/ray | doc/source/ray-core/doc_code/pattern_tree_of_actors.py | pattern_tree_of_actors.Trainer | import ray
@ray.remote(num_cpus=1)
class Trainer:
def __init__(self, hyperparameter, data):
self.hyperparameter = hyperparameter
self.data = data
def fit(self):
return self.data * self.hyperparameter | @ray.remote(num_cpus=1)
class Trainer:
def __init__(self, hyperparameter, data):
pass
def fit(self):
pass | 4 | 0 | 3 | 0 | 3 | 0 | 1 | 0.17 | 0 | 0 | 0 | 0 | 2 | 2 | 2 | 2 | 8 | 1 | 6 | 5 | 3 | 1 | 6 | 5 | 3 | 1 | 0 | 0 | 2 |
9,460 | ray-project/ray | release/nightly_tests/placement_group_tests/pg_run.py | pg_run.Trainer | import time
import ray
@ray.remote(num_cpus=1, num_gpus=1)
class Trainer(object):
def __init__(self, i):
self.i = i
def train(self):
time.sleep(0.2)
print('train ', self.i) | @ray.remote(num_cpus=1, num_gpus=1)
class Trainer(object):
def __init__(self, i):
pass
def train(self):
pass | 4 | 0 | 3 | 0 | 3 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 2 | 1 | 2 | 2 | 7 | 1 | 6 | 4 | 3 | 0 | 6 | 4 | 3 | 1 | 1 | 0 | 2 |
9,461 | ray-project/ray | release/nightly_tests/placement_group_tests/pg_run.py | pg_run.Worker | import time
import ray
@ray.remote(num_cpus=1)
class Worker(object):
def __init__(self, i):
self.i = i
def work(self):
time.sleep(0.1)
print('work ', self.i) | @ray.remote(num_cpus=1)
class Worker(object):
def __init__(self, i):
pass
def work(self):
pass | 4 | 0 | 3 | 0 | 3 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 2 | 1 | 2 | 2 | 7 | 1 | 6 | 4 | 3 | 0 | 6 | 4 | 3 | 1 | 1 | 0 | 2 |
9,462 | ray-project/ray | python/ray/runtime_env/types/pip.py | pip.Pip | from typing import List
from dataclasses import dataclass
@dataclass
class Pip:
packages: List[str]
pip_check: bool = False | @dataclass
class Pip:
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 | 0 | 3 | 2 | 2 | 0 | 3 | 2 | 2 | 0 | 0 | 0 | 0 |
9,463 | ray-project/ray | doc/source/ray-core/doc_code/placement_group_example.py | placement_group_example.Actor | import ray
@ray.remote(num_cpus=1)
class Actor:
def __init__(self):
pass
def ready(self):
pass | @ray.remote(num_cpus=1)
class Actor:
def __init__(self):
pass
def ready(self):
pass | 4 | 0 | 2 | 0 | 2 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 2 | 2 | 6 | 1 | 5 | 3 | 2 | 0 | 5 | 3 | 2 | 1 | 0 | 0 | 2 |
9,464 | ray-project/ray | doc/source/data/doc_code/preprocessors.py | preprocessors.CustomPreprocessor | from ray.data import Dataset
from ray.data.preprocessor import Preprocessor
from ray.data.aggregate import Max
from pandas import DataFrame
class CustomPreprocessor(Preprocessor):
def _fit(self, dataset: Dataset) -> Preprocessor:
self.stats_ = dataset.aggregate(Max('id'))
def _transform_pandas(self, ... |
class CustomPreprocessor(Preprocessor):
def _fit(self, dataset: Dataset) -> Preprocessor:
pass
def _transform_pandas(self, df: DataFrame) -> DataFrame:
pass | 3 | 0 | 2 | 0 | 2 | 0 | 1 | 0 | 1 | 1 | 1 | 0 | 2 | 1 | 2 | 38 | 6 | 1 | 5 | 4 | 2 | 0 | 5 | 4 | 2 | 1 | 5 | 0 | 2 |
9,465 | ray-project/ray | doc/external/pytorch_tutorials_hyperparameter_tuning_tutorial.py | pytorch_tutorials_hyperparameter_tuning_tutorial.Net | import torch.optim as optim
import torch.nn.functional as F
import torch.nn as nn
import torch
class Net(nn.Module):
def __init__(self, l1=120, l2=84):
super(Net, self).__init__()
self.conv1 = nn.Conv2d(3, 6, 5)
self.pool = nn.MaxPool2d(2, 2)
self.conv2 = nn.Conv2d(6, 16, 5)
... |
class Net(nn.Module):
def __init__(self, l1=120, l2=84):
pass
def forward(self, x):
pass | 3 | 0 | 8 | 0 | 8 | 1 | 1 | 0.06 | 1 | 1 | 0 | 0 | 2 | 6 | 2 | 12 | 18 | 1 | 17 | 9 | 14 | 1 | 17 | 9 | 14 | 1 | 1 | 0 | 2 |
9,466 | ray-project/ray | doc/source/_ext/queryparamrefs.py | queryparamrefs.URLQueryParamRefDirective | from sphinx.util.docutils import SphinxDirective
from docutils.parsers.rst import directives, Parser
class URLQueryParamRefDirective(SphinxDirective):
"""Sphinx directive to insert a reference with query parameters."""
required_arguments = 1
optional_arguments = 0
final_argument_whitespace = True
h... |
class URLQueryParamRefDirective(SphinxDirective):
'''Sphinx directive to insert a reference with query parameters.'''
def run(self):
pass | 2 | 1 | 19 | 0 | 19 | 0 | 3 | 0.03 | 1 | 1 | 1 | 0 | 1 | 0 | 1 | 1 | 34 | 2 | 31 | 10 | 29 | 1 | 11 | 10 | 9 | 3 | 1 | 0 | 3 |
9,467 | ray-project/ray | doc/source/_ext/queryparamrefs.py | queryparamrefs.URLQueryParamRefNode | from docutils import nodes, utils, frontend
class URLQueryParamRefNode(nodes.General, nodes.Element):
"""Node type for references that need URL query parameters.""" |
class URLQueryParamRefNode(nodes.General, nodes.Element):
'''Node type for references that need URL query parameters.'''
pass | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 1 | 1 | 0 | 1 | 1 | 1 | 0 | 0 | 1 | 0 | 0 |
9,468 | ray-project/ray | doc/source/_ext/queryparamrefs.py | queryparamrefs.WrapperNode | from docutils import nodes, utils, frontend
class WrapperNode(nodes.paragraph):
"""A wrapper node for URL query param references.
Sphinx will not build if you don't wrap a reference in a paragraph. And a <div>
is needed anyway for styling purposes.
"""
def visit(self, node):
if 'class' no... |
class WrapperNode(nodes.paragraph):
'''A wrapper node for URL query param references.
Sphinx will not build if you don't wrap a reference in a paragraph. And a <div>
is needed anyway for styling purposes.
'''
def visit(self, node):
pass
def depart(self, node):
pass | 3 | 1 | 5 | 0 | 5 | 0 | 2 | 0.4 | 1 | 1 | 0 | 0 | 2 | 0 | 2 | 2 | 17 | 3 | 10 | 3 | 7 | 4 | 7 | 3 | 4 | 2 | 1 | 1 | 3 |
9,469 | ray-project/ray | doc/source/serve/doc_code/quickstart.py | quickstart.MyModelDeployment | from ray import serve
from typing import Dict
from starlette.requests import Request
@serve.deployment
class MyModelDeployment:
def __init__(self, msg: str):
self._msg = msg
def __call__(self, request: Request) -> Dict:
return {'result': self._msg} | @serve.deployment
class MyModelDeployment:
def __init__(self, msg: str):
pass
def __call__(self, request: Request) -> Dict:
pass | 4 | 0 | 3 | 0 | 2 | 1 | 1 | 0.2 | 0 | 1 | 0 | 0 | 2 | 1 | 2 | 2 | 7 | 1 | 5 | 4 | 2 | 1 | 5 | 4 | 2 | 1 | 0 | 0 | 2 |
9,470 | ray-project/ray | doc/source/serve/doc_code/quickstart_composed.py | quickstart_composed.Adder | from ray import serve
@serve.deployment
class Adder:
def __init__(self, increment: int):
self.increment = increment
def add(self, inp: int):
return self.increment + inp | @serve.deployment
class Adder:
def __init__(self, increment: int):
pass
def add(self, inp: int):
pass | 4 | 0 | 2 | 0 | 2 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 2 | 1 | 2 | 2 | 6 | 1 | 5 | 4 | 2 | 0 | 5 | 4 | 2 | 1 | 0 | 0 | 2 |
9,471 | ray-project/ray | doc/source/serve/doc_code/quickstart_composed.py | quickstart_composed.Combiner | from ray import serve
@serve.deployment
class Combiner:
def average(self, *inputs) -> float:
return sum(inputs) / len(inputs) | @serve.deployment
class Combiner:
def average(self, *inputs) -> float:
pass | 3 | 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 |
9,472 | ray-project/ray | doc/source/serve/doc_code/quickstart_composed.py | quickstart_composed.Ingress | import starlette
from ray.serve.handle import DeploymentHandle
from typing import Dict
from ray import serve
@serve.deployment
class Ingress:
def __init__(self, adder1: DeploymentHandle, adder2: DeploymentHandle, combiner: DeploymentHandle):
self._adder1 = adder1
self._adder2 = adder2
self... | @serve.deployment
class Ingress:
def __init__(self, adder1: DeploymentHandle, adder2: DeploymentHandle, combiner: DeploymentHandle):
pass
async def __call__(self, request: starlette.requests.Request) -> Dict[str, float]:
pass | 4 | 0 | 8 | 0 | 8 | 0 | 1 | 0 | 0 | 3 | 1 | 0 | 2 | 3 | 2 | 2 | 18 | 1 | 17 | 13 | 9 | 0 | 9 | 8 | 6 | 1 | 0 | 0 | 2 |
9,473 | ray-project/ray | doc/source/ray-core/doc_code/ray-dag.py | ray-dag.Actor | import ray
import ray
import ray
import ray
import ray
import ray
import ray
@ray.remote
class Actor:
def __init__(self, init_value):
self.i = init_value
def inc(self, x):
self.i += x
def get(self):
return self.i | @ray.remote
class Actor:
def __init__(self, init_value):
pass
def inc(self, x):
pass
def get(self):
pass | 5 | 0 | 2 | 0 | 2 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 | 1 | 3 | 3 | 9 | 2 | 7 | 5 | 3 | 0 | 7 | 5 | 3 | 1 | 0 | 0 | 3 |
9,474 | ray-project/ray | doc/source/ray-core/doc_code/ray-dag.py | ray-dag.Worker | import ray
import ray
import ray
import ray
import ray
import ray
import ray
@ray.remote
class Worker:
def __init__(self):
self.forwarded = 0
def forward(self, input_data: int):
self.forwarded += 1
return input_data + 1
def num_forwarded(self):
return self.forwarded | @ray.remote
class Worker:
def __init__(self):
pass
def forward(self, input_data: int):
pass
def num_forwarded(self):
pass | 5 | 0 | 2 | 0 | 2 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 | 1 | 3 | 3 | 10 | 2 | 8 | 5 | 4 | 0 | 8 | 5 | 4 | 1 | 0 | 0 | 3 |
9,475 | ray-project/ray | python/ray/__init__.py | ray._DeprecationWrapper | class _DeprecationWrapper:
def __init__(self, name, real_worker):
self._name = name
self._real_worker = real_worker
self._warned = set()
def __getattr__(self, attr):
value = getattr(self._real_worker, attr)
if attr not in self._warned:
self._warned.add(attr)... | class _DeprecationWrapper:
def __init__(self, name, real_worker):
pass
def __getattr__(self, attr):
pass | 3 | 0 | 7 | 0 | 7 | 0 | 2 | 0 | 0 | 1 | 0 | 0 | 2 | 3 | 2 | 2 | 15 | 1 | 14 | 7 | 11 | 0 | 11 | 7 | 8 | 2 | 0 | 1 | 3 |
9,476 | ray-project/ray | python/ray/_private/accelerators/accelerator.py | ray._private.accelerators.accelerator.AcceleratorManager | from typing import Dict, List, Optional, Tuple
from abc import ABC, abstractmethod
class AcceleratorManager(ABC):
"""This class contains all the functions needed for supporting
an accelerator family in Ray."""
@staticmethod
@abstractmethod
def get_resource_name() -> str:
"""Get the name of... |
class AcceleratorManager(ABC):
'''This class contains all the functions needed for supporting
an accelerator family in Ray.'''
@staticmethod
@abstractmethod
def get_resource_name() -> str:
'''Get the name of the resource representing this accelerator family.
Returns:
... | 31 | 12 | 10 | 2 | 2 | 7 | 1 | 1.92 | 1 | 5 | 0 | 7 | 0 | 0 | 10 | 30 | 134 | 26 | 37 | 27 | 2 | 71 | 13 | 11 | 2 | 1 | 4 | 0 | 10 |
9,477 | ray-project/ray | python/ray/_private/accelerators/amd_gpu.py | ray._private.accelerators.amd_gpu.AMDGPUAcceleratorManager | from typing import List, Optional, Tuple
from ray._private.accelerators.nvidia_gpu import CUDA_VISIBLE_DEVICES_ENV_VAR
import os
from ray._private.accelerators.accelerator import AcceleratorManager
class AMDGPUAcceleratorManager(AcceleratorManager):
"""AMD GPU accelerators."""
@staticmethod
def get_resour... |
class AMDGPUAcceleratorManager(AcceleratorManager):
'''AMD GPU accelerators.'''
@staticmethod
def get_resource_name() -> str:
pass
@staticmethod
def get_visible_accelerator_ids_env_var() -> str:
pass
@staticmethod
def get_current_process_visible_accelerator_ids() -> Optional... | 19 | 2 | 10 | 1 | 8 | 1 | 3 | 0.11 | 1 | 7 | 0 | 0 | 0 | 0 | 9 | 39 | 113 | 19 | 85 | 33 | 60 | 9 | 66 | 20 | 54 | 5 | 5 | 3 | 23 |
9,478 | ray-project/ray | python/ray/_private/accelerators/hpu.py | ray._private.accelerators.hpu.HPUAcceleratorManager | from ray._private.accelerators.accelerator import AcceleratorManager
from typing import List, Optional, Tuple
import logging
import os
class HPUAcceleratorManager(AcceleratorManager):
"""Intel Habana(HPU) accelerators."""
@staticmethod
def get_resource_name() -> str:
return 'HPU'
@staticmetho... |
class HPUAcceleratorManager(AcceleratorManager):
'''Intel Habana(HPU) accelerators.'''
@staticmethod
def get_resource_name() -> str:
pass
@staticmethod
def get_visible_accelerator_ids_env_var() -> str:
pass
@staticmethod
def get_current_process_visible_accelerator_ids() -> O... | 17 | 4 | 10 | 1 | 7 | 2 | 2 | 0.19 | 1 | 5 | 0 | 0 | 0 | 0 | 8 | 38 | 96 | 15 | 68 | 25 | 44 | 13 | 41 | 13 | 29 | 3 | 5 | 2 | 17 |
9,479 | ray-project/ray | python/ray/_private/accelerators/intel_gpu.py | ray._private.accelerators.intel_gpu.IntelGPUAcceleratorManager | from typing import List, Optional, Tuple
import os
from ray._private.accelerators.accelerator import AcceleratorManager
class IntelGPUAcceleratorManager(AcceleratorManager):
"""Intel GPU accelerators."""
@staticmethod
def get_resource_name() -> str:
return 'GPU'
@staticmethod
def get_visi... |
class IntelGPUAcceleratorManager(AcceleratorManager):
'''Intel GPU accelerators.'''
@staticmethod
def get_resource_name() -> str:
pass
@staticmethod
def get_visible_accelerator_ids_env_var() -> str:
pass
@staticmethod
def get_current_process_visible_accelerator_ids() -> Opti... | 15 | 2 | 10 | 1 | 8 | 1 | 2 | 0.12 | 1 | 7 | 0 | 0 | 0 | 0 | 7 | 37 | 89 | 14 | 67 | 30 | 46 | 8 | 52 | 19 | 42 | 4 | 5 | 1 | 17 |
9,480 | ray-project/ray | python/ray/_private/accelerators/neuron.py | ray._private.accelerators.neuron.NeuronAcceleratorManager | import sys
import os
from ray._private.accelerators.accelerator import AcceleratorManager
import subprocess
from typing import List, Optional, Tuple
import json
class NeuronAcceleratorManager(AcceleratorManager):
"""AWS Inferentia and Trainium accelerators."""
@staticmethod
def get_resource_name() -> str:... |
class NeuronAcceleratorManager(AcceleratorManager):
'''AWS Inferentia and Trainium accelerators.'''
@staticmethod
def get_resource_name() -> str:
pass
@staticmethod
def get_visible_accelerator_ids_env_var() -> str:
pass
@staticmethod
def get_current_process_visible_accelerat... | 19 | 3 | 9 | 1 | 7 | 2 | 2 | 0.23 | 1 | 6 | 0 | 0 | 0 | 0 | 9 | 39 | 102 | 17 | 69 | 35 | 40 | 16 | 38 | 18 | 26 | 4 | 5 | 3 | 16 |
9,481 | ray-project/ray | python/ray/_private/accelerators/npu.py | ray._private.accelerators.npu.NPUAcceleratorManager | from ray._private.accelerators.accelerator import AcceleratorManager
from typing import List, Optional, Tuple
import glob
import os
class NPUAcceleratorManager(AcceleratorManager):
"""Ascend NPU accelerators."""
@staticmethod
def get_resource_name() -> str:
return 'NPU'
@staticmethod
def ... |
class NPUAcceleratorManager(AcceleratorManager):
'''Ascend NPU accelerators.'''
@staticmethod
def get_resource_name() -> str:
pass
@staticmethod
def get_visible_accelerator_ids_env_var() -> str:
pass
@staticmethod
def get_current_process_visible_accelerator_ids() -> Optional... | 15 | 3 | 10 | 2 | 7 | 1 | 2 | 0.18 | 1 | 6 | 0 | 0 | 0 | 0 | 7 | 37 | 84 | 18 | 56 | 25 | 35 | 10 | 41 | 13 | 31 | 4 | 5 | 2 | 15 |
9,482 | ray-project/ray | python/ray/_private/accelerators/nvidia_gpu.py | ray._private.accelerators.nvidia_gpu.NvidiaGPUAcceleratorManager | from typing import List, Optional, Tuple
import os
from ray._private.accelerators.accelerator import AcceleratorManager
class NvidiaGPUAcceleratorManager(AcceleratorManager):
"""NVIDIA GPU accelerators."""
@staticmethod
def get_resource_name() -> str:
return 'GPU'
@staticmethod
def get_vi... |
class NvidiaGPUAcceleratorManager(AcceleratorManager):
'''NVIDIA GPU accelerators.'''
@staticmethod
def get_resource_name() -> str:
pass
@staticmethod
def get_visible_accelerator_ids_env_var() -> str:
pass
@staticmethod
def get_current_process_visible_accelerator_ids() -> Op... | 21 | 1 | 9 | 1 | 8 | 0 | 2 | 0.06 | 1 | 8 | 1 | 0 | 0 | 0 | 10 | 40 | 111 | 18 | 90 | 40 | 59 | 5 | 66 | 22 | 53 | 4 | 5 | 2 | 24 |
9,483 | ray-project/ray | python/ray/_private/accelerators/tpu.py | ray._private.accelerators.tpu.TPUAcceleratorManager | from ray._private.accelerators.accelerator import AcceleratorManager
import ray
import re
import glob
import os
import logging
from typing import Dict, List, Optional, Tuple
from functools import lru_cache
class TPUAcceleratorManager(AcceleratorManager):
"""Google TPU accelerators."""
@staticmethod
def ge... |
class TPUAcceleratorManager(AcceleratorManager):
'''Google TPU accelerators.'''
@staticmethod
def get_resource_name() -> str:
pass
@staticmethod
def get_visible_accelerator_ids_env_var() -> str:
pass
@staticmethod
def get_current_process_visible_accelerator_ids() -> Optional... | 33 | 11 | 21 | 3 | 11 | 8 | 3 | 0.66 | 1 | 7 | 0 | 0 | 1 | 0 | 13 | 43 | 324 | 57 | 161 | 56 | 127 | 106 | 109 | 35 | 94 | 5 | 5 | 2 | 38 |
9,484 | ray-project/ray | python/ray/_private/arrow_serialization.py | ray._private.arrow_serialization.PicklableArrayPayload | from typing import TYPE_CHECKING, List, Optional, Tuple
from dataclasses import dataclass
@dataclass
class PicklableArrayPayload:
"""Picklable array payload, holding data buffers and array metadata.
This is a helper container for pickling and reconstructing nested Arrow Arrays while
ensuring that the buff... | @dataclass
class PicklableArrayPayload:
'''Picklable array payload, holding data buffers and array metadata.
This is a helper container for pickling and reconstructing nested Arrow Arrays while
ensuring that the buffers that underly zero-copy slice views are properly truncated.
'''
@classmethod
... | 5 | 3 | 6 | 1 | 2 | 3 | 1 | 1.33 | 0 | 0 | 0 | 0 | 1 | 0 | 2 | 2 | 33 | 5 | 12 | 4 | 8 | 16 | 11 | 3 | 8 | 1 | 0 | 0 | 2 |
9,485 | ray-project/ray | python/ray/_private/event/event_logger.py | ray._private.event.event_logger.EventLoggerAdapter | import threading
import socket
from ray._private.protobuf_compat import message_to_dict
import logging
from typing import Dict, Optional
import json
import os
from ray.core.generated.event_pb2 import Event
from datetime import datetime
class EventLoggerAdapter:
def __init__(self, source: Event.SourceType, logger:... |
class EventLoggerAdapter:
def __init__(self, source: Event.SourceType, logger: logging.Logger):
'''Adapter for the Python logger that's used to emit events.
When events are emitted, they are aggregated and available via
state API and dashboard.
This class is thread-safe.
''... | 10 | 2 | 8 | 1 | 6 | 2 | 2 | 0.29 | 0 | 4 | 0 | 0 | 9 | 6 | 9 | 9 | 81 | 14 | 52 | 19 | 42 | 15 | 43 | 19 | 33 | 5 | 0 | 3 | 14 |
9,486 | ray-project/ray | python/ray/_private/event/export_event_logger.py | ray._private.event.export_event_logger.ExportEventLoggerAdapter | from ray.core.generated.export_event_pb2 import ExportEvent
from datetime import datetime
import json
from ray.core.generated.export_dataset_metadata_pb2 import ExportDatasetMetadata
from ray.core.generated.export_train_state_pb2 import ExportTrainRunAttemptEventData, ExportTrainRunEventData
from ray.core.generated.exp... |
class ExportEventLoggerAdapter:
def __init__(self, log_type: EventLogType, logger: logging.Logger):
'''Adapter for the Python logger that's used to emit export events.'''
pass
def send_event(self, event_data: ExportEventDataType):
pass
def _create_export_event(self, event_data: E... | 5 | 1 | 17 | 1 | 15 | 1 | 2 | 0.07 | 0 | 6 | 0 | 0 | 4 | 2 | 4 | 4 | 70 | 5 | 61 | 14 | 56 | 4 | 35 | 14 | 30 | 3 | 0 | 1 | 8 |
9,487 | ray-project/ray | python/ray/_private/external_storage.py | ray._private.external_storage.ExternalStorage | import abc
from typing import IO, List, Optional, Tuple, Union
import time
import ray
from ray._raylet import ObjectRef
class ExternalStorage(metaclass=abc.ABCMeta):
"""The base class for external storage.
This class provides some useful functions for zero-copy object
put/get from plasma store. Also it sp... |
class ExternalStorage(metaclass=abc.ABCMeta):
'''The base class for external storage.
This class provides some useful functions for zero-copy object
put/get from plasma store. Also it specifies the interface for
object spilling.
When inheriting this class, please make sure to implement validation
... | 16 | 8 | 16 | 1 | 8 | 7 | 2 | 0.94 | 1 | 6 | 0 | 4 | 8 | 0 | 8 | 28 | 156 | 22 | 69 | 36 | 50 | 65 | 38 | 26 | 29 | 5 | 3 | 2 | 13 |
9,488 | ray-project/ray | python/ray/_private/external_storage.py | ray._private.external_storage.ExternalStorageSmartOpenImpl | from ray._private.ray_constants import DEFAULT_OBJECT_PREFIX
import random
from typing import IO, List, Optional, Tuple, Union
from ray._raylet import ObjectRef
class ExternalStorageSmartOpenImpl(ExternalStorage):
"""The external storage class implemented by smart_open.
(https://github.com/RaRe-Technologies/sm... |
class ExternalStorageSmartOpenImpl(ExternalStorage):
'''The external storage class implemented by smart_open.
(https://github.com/RaRe-Technologies/smart_open)
Smart open supports multiple backend with the same APIs.
To use this implementation, you should pre-create the given uri.
For example, if y... | 6 | 1 | 22 | 3 | 17 | 3 | 2 | 0.36 | 1 | 5 | 0 | 0 | 5 | 7 | 5 | 33 | 137 | 22 | 87 | 44 | 69 | 31 | 61 | 33 | 51 | 5 | 4 | 2 | 11 |
9,489 | ray-project/ray | python/ray/_private/external_storage.py | ray._private.external_storage.FileSystemStorage | import os
import random
from typing import IO, List, Optional, Tuple, Union
from ray._raylet import ObjectRef
import shutil
from ray._private.ray_constants import DEFAULT_OBJECT_PREFIX
class FileSystemStorage(ExternalStorage):
"""The class for filesystem-like external storage.
Raises:
ValueError: Rais... |
class FileSystemStorage(ExternalStorage):
'''The class for filesystem-like external storage.
Raises:
ValueError: Raises directory path to
spill objects doesn't exist.
'''
def __init__(self, node_id: str, directory_path: Union[str, List[str]], buffer_size: Optional[int]=None):
... | 7 | 1 | 18 | 1 | 15 | 3 | 3 | 0.27 | 1 | 7 | 0 | 2 | 6 | 3 | 6 | 34 | 123 | 10 | 89 | 39 | 75 | 24 | 67 | 30 | 60 | 5 | 4 | 2 | 18 |
9,490 | ray-project/ray | python/ray/_private/external_storage.py | ray._private.external_storage.NullStorage | from typing import IO, List, Optional, Tuple, Union
class NullStorage(ExternalStorage):
"""The class that represents an uninitialized external storage."""
def spill_objects(self, object_refs, owner_addresses) -> List[str]:
raise NotImplementedError('External storage is not initialized')
def resto... |
class NullStorage(ExternalStorage):
'''The class that represents an uninitialized external storage.'''
def spill_objects(self, object_refs, owner_addresses) -> List[str]:
pass
def restore_spilled_objects(self, object_refs, url_with_offset_list):
pass
def delete_spilled_objects(self, ... | 5 | 1 | 2 | 0 | 2 | 0 | 1 | 0.11 | 1 | 2 | 0 | 0 | 4 | 0 | 4 | 32 | 14 | 4 | 9 | 5 | 4 | 1 | 9 | 5 | 4 | 1 | 4 | 0 | 4 |
9,491 | ray-project/ray | python/ray/_private/external_storage.py | ray._private.external_storage.SlowFileStorage | import time
import random
from typing import IO, List, Optional, Tuple, Union
class SlowFileStorage(FileSystemStorage):
"""This class is for testing slow object spilling."""
def __init__(self, node_id: str, **kwargs):
super().__init__(node_id, **kwargs)
self._min_delay = 1
self._max_de... |
class SlowFileStorage(FileSystemStorage):
'''This class is for testing slow object spilling.'''
def __init__(self, node_id: str, **kwargs):
pass
def spill_objects(self, object_refs, owner_addresses) -> List[str]:
pass | 3 | 1 | 4 | 0 | 4 | 0 | 1 | 0.11 | 1 | 2 | 0 | 0 | 2 | 2 | 2 | 36 | 12 | 2 | 9 | 6 | 6 | 1 | 9 | 6 | 6 | 1 | 5 | 0 | 2 |
9,492 | ray-project/ray | python/ray/_private/external_storage.py | ray._private.external_storage.UnstableFileStorage | import random
from typing import IO, List, Optional, Tuple, Union
class UnstableFileStorage(FileSystemStorage):
"""This class is for testing with writing failure."""
def __init__(self, node_id: str, **kwargs):
super().__init__(node_id, **kwargs)
self._failure_rate = 0.1
self._partial_f... |
class UnstableFileStorage(FileSystemStorage):
'''This class is for testing with writing failure.'''
def __init__(self, node_id: str, **kwargs):
pass
def spill_objects(self, object_refs, owner_addresses) -> List[str]:
pass | 3 | 1 | 8 | 0 | 8 | 0 | 2 | 0.06 | 1 | 3 | 0 | 0 | 2 | 2 | 2 | 36 | 19 | 2 | 16 | 9 | 13 | 1 | 14 | 9 | 11 | 3 | 5 | 1 | 4 |
9,493 | ray-project/ray | python/ray/_private/function_manager.py | ray._private.function_manager.FunctionActorManager | import threading
from ray._raylet import WORKER_PROCESS_SETUP_HOOK_KEY_NAME_GCS, JobID, PythonFunctionDescriptor
from ray._private.utils import check_oversized_function, ensure_str, format_error_message
from ray._private.inspect_util import is_class_method, is_function_or_method, is_static_method
from ray._private impo... |
class FunctionActorManager:
'''A class used to export/load remote functions and actors.
Attributes:
_worker: The associated worker that this manager related.
_functions_to_export: The remote functions to export when
the worker gets connected.
_actors_to_export: The actors to... | 24 | 13 | 30 | 2 | 21 | 8 | 3 | 0.42 | 0 | 13 | 3 | 0 | 18 | 11 | 18 | 18 | 649 | 52 | 421 | 112 | 387 | 177 | 222 | 95 | 198 | 7 | 0 | 5 | 56 |
9,494 | ray-project/ray | python/ray/_private/gcs_pubsub.py | ray._private.gcs_pubsub.GcsAioActorSubscriber | import grpc
from ray.core.generated import gcs_pb2, gcs_service_pb2, gcs_service_pb2_grpc, pubsub_pb2
from typing import List, Tuple
class GcsAioActorSubscriber(_AioSubscriber):
def __init__(self, worker_id: bytes=None, address: str=None, channel: grpc.Channel=None):
super().__init__(pubsub_pb2.GCS_ACTOR_... |
class GcsAioActorSubscriber(_AioSubscriber):
def __init__(self, worker_id: bytes=None, address: str=None, channel: grpc.Channel=None):
pass
@property
def queue_size(self):
pass
async def poll(self, batch_size, timeout=None) -> List[Tuple[bytes, gcs_pb2.ActorTableData]]:
'''Pol... | 7 | 1 | 7 | 0 | 6 | 1 | 2 | 0.15 | 1 | 3 | 0 | 0 | 3 | 1 | 4 | 15 | 35 | 4 | 27 | 18 | 13 | 4 | 18 | 8 | 13 | 3 | 2 | 1 | 6 |
9,495 | ray-project/ray | python/ray/_private/gcs_pubsub.py | ray._private.gcs_pubsub.GcsAioNodeInfoSubscriber | from ray.core.generated import gcs_pb2, gcs_service_pb2, gcs_service_pb2_grpc, pubsub_pb2
from typing import List, Tuple
import grpc
class GcsAioNodeInfoSubscriber(_AioSubscriber):
def __init__(self, worker_id: bytes=None, address: str=None, channel: grpc.Channel=None):
super().__init__(pubsub_pb2.GCS_NOD... |
class GcsAioNodeInfoSubscriber(_AioSubscriber):
def __init__(self, worker_id: bytes=None, address: str=None, channel: grpc.Channel=None):
pass
async def poll(self, batch_size, timeout=None) -> List[Tuple[bytes, gcs_pb2.GcsNodeInfo]]:
'''Polls for new node info message.
Returns:
... | 5 | 1 | 9 | 0 | 7 | 1 | 2 | 0.17 | 1 | 3 | 0 | 0 | 2 | 1 | 3 | 14 | 31 | 3 | 24 | 16 | 12 | 4 | 16 | 7 | 12 | 3 | 2 | 1 | 5 |
9,496 | ray-project/ray | python/ray/_private/gcs_pubsub.py | ray._private.gcs_pubsub.GcsAioResourceUsageSubscriber | from ray.core.generated import gcs_pb2, gcs_service_pb2, gcs_service_pb2_grpc, pubsub_pb2
import grpc
from typing import List, Tuple
class GcsAioResourceUsageSubscriber(_AioSubscriber):
def __init__(self, worker_id: bytes=None, address: str=None, channel: grpc.Channel=None):
super().__init__(pubsub_pb2.RA... |
class GcsAioResourceUsageSubscriber(_AioSubscriber):
def __init__(self, worker_id: bytes=None, address: str=None, channel: grpc.Channel=None):
pass
async def poll(self, timeout=None) -> Tuple[bytes, str]:
'''Polls for new resource usage message.
Returns:
A tuple of string ... | 5 | 1 | 7 | 0 | 6 | 1 | 1 | 0.21 | 1 | 3 | 0 | 0 | 2 | 0 | 3 | 14 | 26 | 3 | 19 | 11 | 9 | 4 | 11 | 5 | 7 | 2 | 2 | 1 | 4 |
9,497 | ray-project/ray | python/ray/_private/gcs_pubsub.py | ray._private.gcs_pubsub._AioSubscriber | import grpc
import asyncio
from collections import deque
from ray._common.utils import get_or_create_event_loop
from grpc import aio as aiogrpc
import ray._private.gcs_utils as gcs_utils
from ray.core.generated import gcs_pb2, gcs_service_pb2, gcs_service_pb2_grpc, pubsub_pb2
class _AioSubscriber(_SubscriberBase):
... |
class _AioSubscriber(_SubscriberBase):
'''Async io subscriber to GCS.
Usage example common to Aio subscribers:
subscriber = GcsAioXxxSubscriber(address="...")
await subscriber.subscribe()
while running:
...... = await subscriber.poll()
......
await subscr... | 6 | 3 | 17 | 1 | 14 | 3 | 4 | 0.31 | 1 | 4 | 0 | 3 | 5 | 7 | 5 | 11 | 103 | 10 | 71 | 28 | 59 | 22 | 56 | 21 | 50 | 10 | 1 | 4 | 18 |
9,498 | ray-project/ray | python/ray/_private/gcs_pubsub.py | ray._private.gcs_pubsub._SubscriberBase | import random
import grpc
from ray.core.generated import gcs_pb2, gcs_service_pb2, gcs_service_pb2_grpc, pubsub_pb2
class _SubscriberBase:
def __init__(self, worker_id: bytes=None):
self._worker_id = worker_id
self._subscriber_id = bytes(bytearray((random.getrandbits(8) for _ in range(28))))
... |
class _SubscriberBase:
def __init__(self, worker_id: bytes=None):
pass
@property
def last_batch_size(self):
pass
def _subscribe_request(self, channel):
pass
def _poll_request(self):
pass
def _unsubscribe_request(self, channels):
pass
@staticmethod... | 9 | 0 | 7 | 0 | 6 | 1 | 2 | 0.18 | 0 | 3 | 0 | 1 | 5 | 5 | 6 | 6 | 50 | 5 | 38 | 18 | 29 | 7 | 26 | 16 | 19 | 3 | 0 | 1 | 9 |
9,499 | ray-project/ray | python/ray/_private/gcs_utils.py | ray._private.gcs_utils.GcsChannel | from typing import Optional
class GcsChannel:
def __init__(self, gcs_address: Optional[str]=None, aio: bool=False):
self._gcs_address = gcs_address
self._aio = aio
@property
def address(self):
return self._gcs_address
def connect(self):
self._channel = create_gcs_chan... |
class GcsChannel:
def __init__(self, gcs_address: Optional[str]=None, aio: bool=False):
pass
@property
def address(self):
pass
def connect(self):
pass
def channel(self):
pass | 6 | 0 | 3 | 0 | 2 | 1 | 1 | 0.27 | 0 | 2 | 0 | 0 | 4 | 3 | 4 | 4 | 17 | 3 | 11 | 9 | 5 | 3 | 10 | 8 | 5 | 1 | 0 | 0 | 4 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.