file_path
stringlengths
3
280
file_language
stringclasses
66 values
content
stringlengths
1
1.04M
repo_name
stringlengths
5
92
repo_stars
int64
0
154k
repo_description
stringlengths
0
402
repo_primary_language
stringclasses
108 values
developer_username
stringlengths
1
25
developer_name
stringlengths
0
30
developer_company
stringlengths
0
82
python/ray/experimental/serve/tests/test_persistence.py
Python
import os import subprocess import tempfile import ray from ray.experimental import serve def test_new_driver(serve_instance): script = """ import ray ray.init(address="auto") from ray.experimental import serve serve.init() def function(flask_request): return "OK!" serve.create_endpoint("driver", "/drive...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/experimental/serve/tests/test_queue.py
Python
import pytest import ray from ray.experimental.serve.queues import RandomPolicyQueue from ray.experimental.serve.queues import (RoundRobinPolicyQueue, FixedPackingPolicyQueue) @pytest.fixture(scope="session") def task_runner_mock_actor(): @ray.remote class TaskRunner...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/experimental/serve/tests/test_routing.py
Python
import os import tempfile from ray.experimental.serve.kv_store_service import ( InMemoryKVStore, RayInternalKVStore, SQLiteKVStore) def test_default_in_memory_kv(): kv = InMemoryKVStore("") kv.put("1", 2) assert kv.get("1") == 2 kv.put("1", 3) assert kv.get("1") == 3 assert kv.as_dict() =...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/experimental/serve/tests/test_task_runner.py
Python
import pytest import ray import ray.experimental.serve.context as context from ray.experimental.serve.queues import RoundRobinPolicyQueueActor from ray.experimental.serve.task_runner import ( RayServeMixin, TaskRunner, TaskRunnerActor, wrap_to_ray_error) def test_runner_basic(): def echo(i): return i...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/experimental/serve/tests/test_util.py
Python
import json from ray.experimental.serve.utils import BytesEncoder def test_bytes_encoder(): data_before = {"inp": {"nest": b"bytes"}} data_after = {"inp": {"nest": "bytes"}} assert json.loads(json.dumps(data_before, cls=BytesEncoder)) == data_after
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/experimental/serve/utils.py
Python
import json import logging import random import string import time import io import requests from pygments import formatters, highlight, lexers from ray.experimental.serve.context import FakeFlaskRequest, TaskContext from ray.experimental.serve.http_util import build_flask_request def parse_request_item(request_item...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/experimental/sgd/examples/cifar_pytorch_example.py
Python
import os import torch import torch.nn as nn import argparse from ray import tune import torch.utils.data from torch import distributed from torch.utils.data.distributed import DistributedSampler import torchvision import torchvision.transforms as transforms import ray from ray.experimental.sgd.pytorch import (PyTorch...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/experimental/sgd/examples/cifar_tf_example.py
Python
""" #Train a simple deep CNN on the CIFAR10 small images dataset. It gets to 75% validation accuracy in 25 epochs, and 79% after 50 epochs. (it"s still underfitting at that point, though). """ import argparse from tensorflow.keras.datasets import cifar10 from tensorflow.keras.preprocessing.image import ImageDataGener...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/experimental/sgd/examples/tensorflow_train_example.py
Python
import argparse import tensorflow as tf from tensorflow.keras.models import Sequential from tensorflow.keras.layers import Dense import numpy as np import ray from ray import tune from ray.experimental.sgd.tf.tf_trainer import TFTrainer, TFTrainable NUM_TRAIN_SAMPLES = 1000 NUM_TEST_SAMPLES = 400 def create_config(...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/experimental/sgd/examples/train_example.py
Python
""" This file holds code for a Training guide for PytorchSGD in the documentation. It ignores yapf because yapf doesn't allow comments right after code blocks, but we put comments right after code blocks to prevent large white spaces in the documentation. """ # yapf: disable # __torch_train_example__ import argparse ...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/experimental/sgd/examples/tune_example.py
Python
# yapf: disable """ This file holds code for a Distributed Pytorch + Tune page in the docs. It ignores yapf because yapf doesn't allow comments right after code blocks, but we put comments right after code blocks to prevent large white spaces in the documentation. """ # __torch_tune_example__ import numpy as np impor...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/experimental/sgd/pytorch/__init__.py
Python
from ray.experimental.sgd.pytorch.pytorch_trainer import (PyTorchTrainer, PyTorchTrainable) __all__ = ["PyTorchTrainer", "PyTorchTrainable"]
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/experimental/sgd/pytorch/distributed_pytorch_runner.py
Python
import collections from filelock import FileLock import logging import os import torch.nn as nn import torch.distributed as dist import torch.utils.data from torch.nn.parallel import DistributedDataParallel from ray.experimental.sgd.pytorch.pytorch_runner import PyTorchRunner logger = logging.getLogger(__name__) cl...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/experimental/sgd/pytorch/examples/dcgan.py
Python
#!/usr/bin/env python import argparse import os import torch import torch.nn as nn from torch import distributed import torch.optim as optim import torch.utils.data import torchvision.datasets as dset import torchvision.transforms as transforms import numpy as np from torch.autograd import Variable from torch.nn impo...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/experimental/sgd/pytorch/pytorch_runner.py
Python
import collections from filelock import FileLock import logging import os import torch import torch.utils.data from torch.utils.data import DataLoader import ray from ray.experimental.sgd.pytorch import utils as pytorch_utils from ray.experimental.sgd import utils logger = logging.getLogger(__name__) class PyTorchR...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/experimental/sgd/pytorch/pytorch_trainer.py
Python
import numpy as np import os import torch import torch.distributed as dist import logging import numbers import tempfile import time import ray from ray.tune import Trainable from ray.tune.trial import Resources from ray.experimental.sgd.pytorch.distributed_pytorch_runner import ( DistributedPyTorchRunner) from r...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/experimental/sgd/pytorch/resnet.py
Python
"""ResNet in PyTorch. Copied from https://github.com/kuangliu/pytorch-cifar/ blob/ab908327d44bf9b1d22cd333a4466e85083d3f21/models/resnet.py """ import torch.nn as nn import torch.nn.functional as F class BasicBlock(nn.Module): expansion = 1 def __init__(self, in_planes, planes, stride=1): ...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/experimental/sgd/pytorch/utils.py
Python
import collections import time import torch from ray.experimental.sgd.utils import TimerStat def train(model, train_iterator, criterion, optimizer, config): """Runs 1 training epoch""" if isinstance(model, collections.Iterable) or isinstance( optimizer, collections.Iterable): raise ValueE...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/experimental/sgd/tests/test_pytorch.py
Python
import os import tempfile from unittest.mock import patch import pytest import time import torch import torch.nn as nn import torch.distributed as dist import ray from ray import tune from ray.tests.conftest import ray_start_2_cpus # noqa: F401 from ray.experimental.sgd.pytorch import PyTorchTrainer, PyTorchTrainabl...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/experimental/sgd/tests/test_pytorch_runner.py
Python
import numpy as np import torch import torch.nn as nn import unittest from unittest.mock import MagicMock from ray.experimental.sgd.pytorch.pytorch_runner import PyTorchRunner class LinearDataset(torch.utils.data.Dataset): """y = a * x + b""" def __init__(self, a, b, size=1000): x = np.random.random...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/experimental/sgd/tests/test_tensorflow.py
Python
import os import pytest import tempfile import numpy as np import shutil from ray import tune from ray.tests.conftest import ray_start_2_cpus # noqa: F401 from ray.experimental.sgd.tf import TFTrainer, TFTrainable from ray.experimental.sgd.examples.tensorflow_train_example import ( simple_model, simple_dataset) ...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/experimental/sgd/tf/__init__.py
Python
from ray.experimental.sgd.tf.tf_trainer import (TFTrainer, TFTrainable) __all__ = ["TFTrainer", "TFTrainable"]
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/experimental/sgd/tf/tf_runner.py
Python
import logging import json import os import numpy as np import ray import ray.services from ray.experimental.sgd import utils logger = logging.getLogger(__name__) def _try_import_strategy(): """Late import for Tesnorflow""" import tensorflow as tf return tf.distribute.experimental.MultiWorkerMirroredStr...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/experimental/sgd/tf/tf_trainer.py
Python
import numpy as np import os import logging import pickle import ray from ray.tune import Trainable from ray.tune.resources import Resources from ray.experimental.sgd.tf.tf_runner import TFRunner logger = logging.getLogger(__name__) class TFTrainer: def __init__(self, model_creator, ...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/experimental/sgd/utils.py
Python
from contextlib import closing import logging import numpy as np import socket import time import ray from ray.exceptions import RayActorError logger = logging.getLogger(__name__) class TimerStat: """A running stat for conveniently logging the duration of a code block. Note that this class is *not* thread-...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/experimental/signal.py
Python
import logging from collections import defaultdict import ray import ray.cloudpickle as cloudpickle # This string should be identical to the name of the signal sent upon # detecting that an actor died. # This constant is also used in NodeManager::PublishActorStateTransition() # in node_manager.cc ACTOR_DIED_STR = "A...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/experimental/test/async_test.py
Python
import asyncio import time import pytest import ray from ray.experimental import async_api @pytest.fixture def init(): ray.init(num_cpus=4) async_api.init() asyncio.get_event_loop().set_debug(False) yield async_api.shutdown() ray.shutdown() def gen_tasks(time_scale=0.1): @ray.remote ...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/experimental/tf_utils.py
Python
from collections import deque, OrderedDict import numpy as np from ray.rllib.utils import try_import_tf tf = try_import_tf() def unflatten(vector, shapes): i = 0 arrays = [] for shape in shapes: size = np.prod(shape, dtype=np.int) array = vector[i:(i + size)].reshape(shape) array...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/function_manager.py
Python
import dis import hashlib import importlib import inspect import json import logging import sys import time import threading import traceback from collections import ( namedtuple, defaultdict, ) import ray from ray import profiling from ray import ray_constants from ray import cloudpickle as pickle from ray.ut...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/gcs_utils.py
Python
from ray.core.generated.gcs_pb2 import ( ActorCheckpointIdData, ActorTableData, GcsNodeInfo, JobTableData, ErrorTableData, ErrorType, GcsEntry, HeartbeatBatchTableData, HeartbeatTableData, ObjectTableData, ProfileTableData, TablePrefix, TablePubsub, TaskTableData,...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/import_thread.py
Python
from collections import defaultdict import threading import traceback import redis import ray from ray import ray_constants from ray import cloudpickle as pickle from ray import profiling from ray import utils import logging logger = logging.getLogger(__name__) class ImportThread: """A thread used to import e...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/includes/common.pxd
Cython
from libcpp cimport bool as c_bool from libcpp.memory cimport shared_ptr, unique_ptr from libcpp.string cimport string as c_string from libc.stdint cimport uint8_t, int32_t, uint64_t, int64_t from libcpp.unordered_map cimport unordered_map from libcpp.vector cimport vector as c_vector from ray.includes.unique_ids cim...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/includes/libcoreworker.pxd
Cython
# cython: profile = False # distutils: language = c++ # cython: embedsignature = True from libc.stdint cimport int64_t from libcpp cimport bool as c_bool from libcpp.memory cimport shared_ptr, unique_ptr from libcpp.string cimport string as c_string from libcpp.unordered_map cimport unordered_map from libcpp.utility c...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/includes/libraylet.pxd
Cython
from libc.stdint cimport int64_t from libcpp cimport bool as c_bool from libcpp.memory cimport unique_ptr from libcpp.string cimport string as c_string from libcpp.utility cimport pair from libcpp.vector cimport vector as c_vector from ray.includes.common cimport ( CLanguage, CRayStatus, ) from ray.includes.un...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/includes/ray_config.pxd
Cython
from libc.stdint cimport int64_t, uint64_t, uint32_t from libcpp.string cimport string as c_string from libcpp.unordered_map cimport unordered_map cdef extern from "ray/common/ray_config.h" nogil: cdef cppclass RayConfig "RayConfig": @staticmethod RayConfig &instance() int64_t ray_cookie(...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/includes/task.pxd
Cython
from libc.stdint cimport uint8_t, uint64_t from libcpp cimport bool as c_bool from libcpp.memory cimport unique_ptr, shared_ptr from libcpp.string cimport string as c_string from libcpp.unordered_map cimport unordered_map from libcpp.vector cimport vector as c_vector from ray.includes.common cimport ( CLanguage, ...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/includes/unique_ids.pxd
Cython
from libcpp cimport bool as c_bool from libcpp.string cimport string as c_string from libc.stdint cimport uint8_t, uint32_t, int64_t cdef extern from "ray/common/id.h" namespace "ray" nogil: cdef cppclass CBaseID[T]: @staticmethod T FromBinary(const c_string &binary) @staticmethod ...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/internal/__init__.py
Python
from ray.internal.internal_api import free __all__ = ["free"]
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/internal/internal_api.py
Python
import ray.worker from ray import profiling __all__ = ["free"] def free(object_ids, local_only=False, delete_creating_tasks=False): """Free a list of IDs from object stores. This function is a low-level API which should be used in restricted scenarios. If local_only is false, the request will be se...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/local_mode_manager.py
Python
import copy import traceback import ray from ray import ObjectID from ray.utils import format_error_message from ray.exceptions import RayTaskError class LocalModeObjectID(ObjectID): """Wrapper class around ray.ObjectID used for local mode. Object values are stored directly as a field of the LocalModeObject...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/log_monitor.py
Python
import argparse import errno import glob import json import logging import os import shutil import time import traceback import ray.ray_constants as ray_constants import ray.services as services import ray.utils # Logger for this module. It should be configured at the entry point # into the program using Ray. Ray pro...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/memory_monitor.py
Python
import logging import os import sys import time try: import psutil except ImportError: psutil = None logger = logging.getLogger(__name__) def get_rss(memory_info): """Get the estimated non-shared memory usage from psutil memory_info.""" mem = memory_info.rss # OSX doesn't have the shared attribu...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/monitor.py
Python
import argparse import logging import os import time import traceback import json import redis import ray from ray.autoscaler.autoscaler import LoadMetrics, StandardAutoscaler import ray.cloudpickle as pickle import ray.gcs_utils import ray.utils import ray.ray_constants as ray_constants from ray.utils import (binary...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/node.py
Python
import atexit import collections import datetime import errno import json import os import logging import signal import socket import sys import tempfile import threading import time import ray import ray.ray_constants as ray_constants import ray.services from ray.resource_spec import ResourceSpec from ray.utils impor...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/parameter.py
Python
import logging import numpy as np from packaging import version import ray.ray_constants as ray_constants class RayParams: """A class used to store the parameters used by Ray. Attributes: redis_address (str): The address of the Redis server to connect to. If this address is not provided...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/profiling.py
Python
import ray class _NullLogSpan: """A log span context manager that does nothing""" def __enter__(self): pass def __exit__(self, type, value, tb): pass NULL_LOG_SPAN = _NullLogSpan() def profile(event_type, extra_data=None): """Profile a span of time so that it appears in the timel...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/projects/__init__.py
Python
from ray.projects.projects import ProjectDefinition __all__ = [ "ProjectDefinition", ]
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/projects/projects.py
Python
import argparse import copy import json import jsonschema import os import yaml def make_argument_parser(name, params, wildcards): """Build argument parser dynamically to parse parameter arguments. Args: name (str): Name of the command to parse. params (dict): Parameter specification used to ...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/projects/scripts.py
Python
import argparse import click import copy import jsonschema import logging import os from shutil import copyfile import subprocess import sys import time import ray from ray.autoscaler.commands import ( attach_cluster, exec_cluster, create_or_update_cluster, rsync, teardown_cluster, ) logging.basic...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/ray_cluster_perf.py
Python
"""This is the script for `ray clusterbenchmark`.""" import time import numpy as np import ray from ray.cluster_utils import Cluster def main(): cluster = Cluster( initialize_head=True, connect=True, head_node_args={ "object_store_memory": 20 * 1024 * 1024 * 1024, ...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/ray_constants.py
Python
"""Ray constants used in the Python code.""" import logging import math import os logger = logging.getLogger(__name__) def env_integer(key, default): if key in os.environ: return int(os.environ[key]) return default def direct_call_enabled(): return bool(int(os.environ.get("RAY_FORCE_DIRECT", "...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/ray_perf.py
Python
"""This is the script for `ray microbenchmark`.""" import os import time import numpy as np import multiprocessing import ray # Only run tests matching this filter pattern. filter_pattern = os.environ.get("TESTS_TO_RUN", "") @ray.remote(num_cpus=0) class Actor: def small_value(self): return b"ok" d...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/ray_process_reaper.py
Python
import os import signal import sys import time """ This is a lightweight "reaper" process used to ensure that ray processes are cleaned up properly when the main ray process dies unexpectedly (e.g., segfaults or gets SIGKILLed). Note that processes may not be cleaned up properly if this process is SIGTERMed or SIGKILLe...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/remote_function.py
Python
import logging from functools import wraps from ray import cloudpickle as pickle from ray import ray_constants from ray.function_manager import FunctionDescriptor import ray.signature # Default parameters for remote functions. DEFAULT_REMOTE_FUNCTION_CPUS = 1 DEFAULT_REMOTE_FUNCTION_NUM_RETURN_VALS = 1 DEFAULT_REMOTE...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/reporter.py
Python
import argparse import logging import json import os import traceback import time import datetime try: import psutil except ImportError: print("The reporter requires psutil to run.") import sys sys.exit(1) import ray.ray_constants as ray_constants import ray.services import ray.utils # Logger for thi...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/resource_spec.py
Python
import math from collections import namedtuple import logging import multiprocessing import os import ray import ray.ray_constants as ray_constants logger = logging.getLogger(__name__) # Prefix for the node id resource that is automatically added to each node. # For example, a node may have id `node:172.23.42.1`. NO...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/runtime_context.py
Python
import ray.worker class RuntimeContext: """A class used for getting runtime context.""" def __init__(self, worker=None): self.worker = worker @property def current_driver_id(self): """Get current driver ID for this worker or driver. Returns: If called by a driver...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/scripts/scripts.py
Python
import click from datetime import datetime import json import logging import os import subprocess import sys import time import ray.services as services from ray.autoscaler.commands import ( attach_cluster, exec_cluster, create_or_update_cluster, monitor_cluster, rsync, teardown_cluster, get_head_node_ip, kill...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/serialization.py
Python
import hashlib import io import logging import time import pyarrow import pyarrow.plasma as plasma import ray.cloudpickle as pickle from ray import ray_constants, JobID import ray.utils from ray.utils import _random_string from ray.gcs_utils import ErrorType from ray.exceptions import ( RayActorError, RayWork...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/services.py
Python
import collections import json import logging import multiprocessing import os import random import re import resource import socket import subprocess import sys import time import redis import colorama import pyarrow # Ray modules import ray import ray.ray_constants as ray_constants # True if processes are run in th...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/setup-dev.py
Python
#!/usr/bin/env python """This script allows you to develop RLlib without needing to compile Ray.""" import argparse import click import os import subprocess import ray def do_link(package, force=False, local_path=""): package_home = os.path.abspath( os.path.join(ray.__file__, "../{}".format(package))) ...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/signature.py
Python
from collections import namedtuple import funcsigs from funcsigs import Parameter import logging from ray.utils import is_cython # Logger for this module. It should be configured at the entry point # into the program using Ray. Ray provides a default configuration at # entry/init points. logger = logging.getLogger(__...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/state.py
Python
from collections import defaultdict import json import logging import sys import time import ray from ray.function_manager import FunctionDescriptor from ray import ( gcs_utils, services, ) from ray.utils import (decode, binary_to_object_id, binary_to_hex, hex_to_binary) logger = loggi...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/test_utils.py
Python
import json import fnmatch import os import subprocess import sys import tempfile import time import psutil import ray class RayTestTimeoutException(Exception): """Exception used to identify timeouts from test utilities.""" pass def _pid_alive(pid): """Check if the process with this PID is alive or no...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tests/conftest.py
Python
""" This file defines the common pytest fixtures used in current directory. """ from contextlib import contextmanager import json import pytest import subprocess import ray from ray.cluster_utils import Cluster @pytest.fixture def shutdown_only(): yield None # The code after the yield will run as teardown c...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tests/perf_integration_tests/test_perf_integration.py
Python
import numpy as np import pytest import ray from ray.tests.conftest import _ray_start_cluster num_tasks_submitted = [10**n for n in range(0, 6)] num_tasks_ids = ["{}_tasks".format(i) for i in num_tasks_submitted] @ray.remote def dummy_task(val): return val def benchmark_task_submission(num_tasks): total_t...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tests/py3_test.py
Python
# coding: utf-8 import asyncio import threading import pytest import sys import ray import ray.cluster_utils import ray.test_utils @pytest.mark.parametrize( "ray_start_regular", [{ "local_mode": True }, { "local_mode": False }], indirect=True) def test_args_force_positional(ray_start_...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tests/test_actor.py
Python
import random import numpy as np import os import pytest try: import pytest_timeout except ImportError: pytest_timeout = None import sys import time import ray import ray.test_utils import ray.cluster_utils from ray.test_utils import run_string_as_driver from ray.experimental.internal_kv import _internal_kv_ge...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tests/test_actor_failures.py
Python
import collections import json import numpy as np import os import pytest try: import pytest_timeout except ImportError: pytest_timeout = None import signal import sys import time import ray import ray.ray_constants as ray_constants import ray.test_utils import ray.cluster_utils from ray.test_utils import (rel...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tests/test_actor_pool.py
Python
import time import pytest import ray from ray.experimental import ActorPool @pytest.fixture def init(): ray.init(num_cpus=4) yield ray.shutdown() def test_get_next(init): @ray.remote class MyActor: def __init__(self): pass def f(self, x): return x + 1 ...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tests/test_actor_resources.py
Python
import collections import json import os import pytest try: import pytest_timeout except ImportError: pytest_timeout = None import sys import time import ray import ray.test_utils import ray.cluster_utils from ray import ray_constants RAY_FORCE_DIRECT = ray_constants.direct_call_enabled() def test_actor_del...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tests/test_advanced.py
Python
# coding: utf-8 from concurrent.futures import ThreadPoolExecutor import json import logging import random import six import sys import threading import time import numpy as np import pytest import ray import ray.ray_constants as ray_constants import ray.cluster_utils import ray.test_utils from ray.test_utils import...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tests/test_advanced_2.py
Python
# coding: utf-8 import logging import os import sys import time import numpy as np import pytest import ray import ray.cluster_utils import ray.test_utils from ray.test_utils import RayTestTimeoutException logger = logging.getLogger(__name__) def test_resource_constraints(shutdown_only): num_workers = 20 ...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tests/test_advanced_3.py
Python
# coding: utf-8 import glob import logging import os import setproctitle import shutil import json import sys import socket import subprocess import tempfile import time import numpy as np import pickle import pytest import ray from ray import signature import ray.ray_constants as ray_constants import ray.cluster_uti...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tests/test_array.py
Python
from importlib import reload import numpy as np from numpy.testing import assert_equal, assert_almost_equal import pytest import sys import ray import ray.experimental.array.remote as ra import ray.experimental.array.distributed as da import ray.cluster_utils @pytest.fixture def reload_modules(): modules = [ra.c...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tests/test_autoscaler.py
Python
import shutil import tempfile import threading import time import unittest import yaml import copy import ray import ray.services as services from ray.autoscaler.autoscaler import StandardAutoscaler, LoadMetrics, \ fillout_defaults, validate_config from ray.autoscaler.tags import TAG_RAY_NODE_TYPE, TAG_RAY_NODE_ST...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tests/test_autoscaler_yaml.py
Python
import os import unittest import yaml from ray.autoscaler.autoscaler import fillout_defaults, validate_config from ray.test_utils import recursive_fnmatch RAY_PATH = os.path.abspath(os.path.join(__file__, "../../")) CONFIG_PATHS = recursive_fnmatch( os.path.join(RAY_PATH, "autoscaler"), "*.yaml") CONFIG_PATHS +=...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tests/test_basic.py
Python
# coding: utf-8 import collections import io import json import logging import os import re import string import sys import threading import time import numpy as np import pytest import ray from ray.exceptions import RayTimeoutError import ray.cluster_utils import ray.test_utils logger = logging.getLogger(__name__) ...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tests/test_component_failures.py
Python
import os import signal import sys import time import pytest import ray from ray.test_utils import run_string_as_driver_nonblocking # This test checks that when a worker dies in the middle of a get, the plasma # store and raylet will not die. @pytest.mark.skipif( os.environ.get("RAY_USE_NEW_GCS") == "on", r...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tests/test_component_failures_2.py
Python
import json import os import signal import sys import time import pytest import ray import ray.ray_constants as ray_constants from ray.cluster_utils import Cluster from ray.test_utils import RayTestTimeoutException @pytest.fixture(params=[(1, 4), (4, 4)]) def ray_start_workers_separate_multinode(request): num_n...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tests/test_component_failures_3.py
Python
import os import sys import time import numpy as np import pytest import ray import ray.ray_constants as ray_constants @pytest.mark.parametrize( "ray_start_cluster", [{ "num_cpus": 4, "num_nodes": 3, "do_init": True }], indirect=True) def test_actor_creation_node_failure(ray_star...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tests/test_cython.py
Python
from __future__ import absolute_import from __future__ import print_function import math import numpy as np import unittest import ray import cython_examples as cyth def get_ray_result(cython_func, *args): func = ray.remote(cython_func) return ray.get(func.remote(*args)) class CythonTest(unittest.TestCase...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tests/test_debug_tools.py
Python
import os import subprocess import sys import pytest import ray @pytest.fixture def ray_gdb_start(): # Setup environment and start ray _environ = os.environ.copy() for process_name in ["RAYLET", "PLASMA_STORE"]: os.environ["RAY_{}_GDB".format(process_name)] = "1" os.environ["RAY_{}_TMUX"...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tests/test_dynres.py
Python
import logging import time import ray import ray.cluster_utils import ray.test_utils logger = logging.getLogger(__name__) def test_dynamic_res_creation(ray_start_regular): # This test creates a resource locally (without specifying the client_id) res_name = "test_res" res_capacity = 1.0 @ray.remote ...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tests/test_failure.py
Python
import json import logging import os import sys import tempfile import threading import time import numpy as np import pytest import redis import ray import ray.ray_constants as ray_constants from ray.cluster_utils import Cluster from ray.test_utils import ( relevant_errors, wait_for_errors, RayTestTimeou...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tests/test_global_state.py
Python
import pytest try: import pytest_timeout except ImportError: pytest_timeout = None import time import ray # TODO(rliaw): The proper way to do this is to have the pytest config setup. @pytest.mark.skipif( pytest_timeout is None, reason="Timeout package not installed; skipping test that may hang.") @py...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tests/test_iter.py
Python
import time import ray from ray.experimental.iter import from_items, from_iterators, from_range, \ from_actors, ParallelIteratorWorker def test_from_items(ray_start_regular_shared): it = from_items([1, 2, 3, 4]) assert repr(it) == "ParallelIterator[from_items[int, 4, shards=2]]" assert list(it.gather...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tests/test_memory_limits.py
Python
import numpy as np import unittest import ray MB = 1024 * 1024 OBJECT_EVICTED = ray.exceptions.UnreconstructableError OBJECT_TOO_LARGE = ray.exceptions.ObjectStoreFullError @ray.remote class LightActor: def __init__(self): pass def sample(self): return np.zeros(5 * MB, dtype=np.uint8) @r...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tests/test_memory_scheduling.py
Python
import numpy as np import unittest import ray from ray import tune from ray.rllib import _register_all MB = 1024 * 1024 @ray.remote(memory=100 * MB) class Actor: def __init__(self): pass def ping(self): return "ok" @ray.remote(object_store_memory=100 * MB) class Actor2: def __init__(s...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tests/test_metrics.py
Python
import os import grpc import psutil import requests import time import ray from ray.core.generated import node_manager_pb2 from ray.core.generated import node_manager_pb2_grpc from ray.test_utils import RayTestTimeoutException def test_worker_stats(shutdown_only): ray.init(num_cpus=1, include_webui=False) ra...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tests/test_microbenchmarks.py
Python
import pytest import time import numpy as np import ray def test_timing(ray_start_regular): @ray.remote def empty_function(): pass @ray.remote def trivial_function(): return 1 # Measure the time required to submit a remote task to the scheduler. elapsed_times = [] for _ ...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tests/test_mini.py
Python
import ray test_values = [1, 1.0, "test", b"test", (0, 1), [0, 1], {0: 1}] def test_basic_task_api(ray_start_regular): # Test a simple function. @ray.remote def f_simple(): return 1 assert ray.get(f_simple.remote()) == 1 # Test multiple return values. @ray.remote(num_return_vals=...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tests/test_monitors.py
Python
import multiprocessing import os import pytest import subprocess import time import ray def _test_cleanup_on_driver_exit(num_redis_shards): output = ray.utils.decode( subprocess.check_output( [ "ray", "start", "--head", "--num-re...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tests/test_multi_node.py
Python
import os import pytest import subprocess import time import ray from ray import ray_constants from ray.test_utils import ( RayTestTimeoutException, run_string_as_driver, run_string_as_driver_nonblocking, wait_for_children_of_pid, wait_for_children_of_pid_to_exit, kill_process_by_name, ) def ...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tests/test_multi_node_2.py
Python
import logging import pytest import time import ray import ray.ray_constants as ray_constants from ray.monitor import Monitor from ray.cluster_utils import Cluster from ray.test_utils import generate_internal_config_map logger = logging.getLogger(__name__) def test_cluster(): """Basic test for adding and removi...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tests/test_multinode_failures.py
Python
import json import os import signal import sys import time import pytest import ray import ray.ray_constants as ray_constants from ray.cluster_utils import Cluster from ray.test_utils import RayTestTimeoutException RAY_FORCE_DIRECT = ray_constants.direct_call_enabled() @pytest.fixture(params=[(1, 4), (4, 4)]) def ...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tests/test_multinode_failures_2.py
Python
import json import os import sys import time import numpy as np import pytest import ray import ray.ray_constants as ray_constants RAY_FORCE_DIRECT = ray_constants.direct_call_enabled() @pytest.mark.skipif( RAY_FORCE_DIRECT, reason="No reconstruction for objects placed in plasma yet") @pytest.mark.parametr...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tests/test_multiprocessing.py
Python
import os import pytest import tempfile import time import random import subprocess from collections import defaultdict import queue import ray from ray.experimental.multiprocessing import Pool, TimeoutError @pytest.fixture def cleanup_only(): yield None ray.shutdown() subprocess.check_output(["ray", "st...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tests/test_node_manager.py
Python
import ray from ray.test_utils import run_string_as_driver # This tests the queue transitions for infeasible tasks. This has been an issue # in the past, e.g., https://github.com/ray-project/ray/issues/3275. def test_infeasible_tasks(ray_start_cluster): cluster = ray_start_cluster @ray.remote def f(): ...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta
python/ray/tests/test_object_manager.py
Python
from collections import defaultdict import json import multiprocessing import numpy as np import pytest import time import warnings import ray from ray import ray_constants from ray.cluster_utils import Cluster # TODO(yuhguo): This test file requires a lot of CPU/memory, and # better be put in Jenkins. However, it fa...
zhuohan123/hoplite-rllib
3
Python
zhuohan123
Zhuohan Li
vLLM / Meta