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,800 | ray-project/ray | python/ray/autoscaler/_private/node_provider_availability_tracker.py | ray.autoscaler._private.node_provider_availability_tracker.UnavailableNodeInformation | from dataclasses import dataclass
@dataclass
class UnavailableNodeInformation:
category: str
description: str | @dataclass
class UnavailableNodeInformation:
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 | 0 | 3 | 1 | 2 | 0 | 3 | 1 | 2 | 0 | 0 | 0 | 0 |
9,801 | ray-project/ray | python/ray/autoscaler/_private/node_tracker.py | ray.autoscaler._private.node_tracker.NodeTracker | from ray.autoscaler._private import constants
from typing import List, Set, Tuple
class NodeTracker:
"""Map nodes to their corresponding logs.
We need to be a little careful here. At an given point in time, node_id <->
ip can be interchangeably used, but the node_id -> ip relation is not
bijective _ac... |
class NodeTracker:
'''Map nodes to their corresponding logs.
We need to be a little careful here. At an given point in time, node_id <->
ip can be interchangeably used, but the node_id -> ip relation is not
bijective _across time_ since IP addresses can be reused. Therefore, we
should treat node_id... | 6 | 4 | 12 | 1 | 5 | 5 | 2 | 1.11 | 0 | 2 | 0 | 0 | 5 | 2 | 5 | 5 | 72 | 13 | 28 | 13 | 20 | 31 | 26 | 11 | 20 | 3 | 0 | 1 | 10 |
9,802 | ray-project/ray | python/ray/autoscaler/_private/prom_metrics.py | ray.autoscaler._private.prom_metrics.NullMetric | class NullMetric:
"""Mock metric class to be used in case of prometheus_client import error."""
def set(self, *args, **kwargs):
pass
def observe(self, *args, **kwargs):
pass
def inc(self, *args, **kwargs):
pass
def labels(self, *args, **kwargs):
return self
d... | class NullMetric:
'''Mock metric class to be used in case of prometheus_client import error.'''
def set(self, *args, **kwargs):
pass
def observe(self, *args, **kwargs):
pass
def inc(self, *args, **kwargs):
pass
def labels(self, *args, **kwargs):
pass
def clea... | 6 | 1 | 2 | 0 | 2 | 0 | 1 | 0.09 | 0 | 0 | 0 | 0 | 5 | 0 | 5 | 5 | 17 | 5 | 11 | 6 | 5 | 1 | 11 | 6 | 5 | 1 | 0 | 0 | 5 |
9,803 | ray-project/ray | python/ray/autoscaler/_private/readonly/node_provider.py | ray.autoscaler._private.readonly.node_provider.ReadOnlyNodeProvider | from ray.autoscaler._private.util import format_readonly_node_type
from typing import List, Tuple
from ray.autoscaler.node_provider import NodeProvider
from ray.autoscaler.tags import NODE_KIND_HEAD, STATUS_UP_TO_DATE, TAG_RAY_NODE_KIND, TAG_RAY_NODE_NAME, TAG_RAY_NODE_STATUS, TAG_RAY_USER_NODE_TYPE
class ReadOnlyNode... |
class ReadOnlyNodeProvider(NodeProvider):
'''A node provider that merely reports the current cluster state.
This is used for laptop mode / manual cluster setup modes, in order to
provide status reporting in the same way for users.'''
def __init__(self, provider_config, cluster_name):
pass
... | 15 | 2 | 4 | 0 | 3 | 1 | 1 | 0.24 | 1 | 3 | 0 | 0 | 12 | 1 | 13 | 34 | 66 | 15 | 41 | 19 | 26 | 10 | 32 | 18 | 18 | 2 | 1 | 1 | 14 |
9,804 | ray-project/ray | python/ray/autoscaler/_private/resource_demand_scheduler.py | ray.autoscaler._private.resource_demand_scheduler.ResourceDemandScheduler | import copy
from ray.autoscaler.tags import NODE_KIND_HEAD, NODE_KIND_UNMANAGED, NODE_KIND_WORKER, TAG_RAY_NODE_KIND, TAG_RAY_USER_NODE_TYPE
from ray.autoscaler._private.constants import AUTOSCALER_CONSERVE_GPU_NODES, AUTOSCALER_UPSCALING_INITIAL_NUM_NODES, AUTOSCALER_UTILIZATION_SCORER_KEY
from ray.autoscaler._private... |
class ResourceDemandScheduler:
def __init__(self, provider: NodeProvider, node_types: Dict[NodeType, NodeTypeConfigDict], max_workers: int, head_node_type: NodeType, upscaling_speed: float) -> None:
pass
def _get_head_and_workers(self, nodes: List[NodeID]) -> Tuple[NodeID, List[NodeID]]:
'''R... | 13 | 8 | 44 | 3 | 28 | 13 | 3 | 0.47 | 0 | 11 | 4 | 0 | 11 | 7 | 11 | 11 | 514 | 48 | 318 | 137 | 249 | 148 | 151 | 80 | 138 | 9 | 0 | 4 | 41 |
9,805 | ray-project/ray | python/ray/autoscaler/_private/resource_demand_scheduler.py | ray.autoscaler._private.resource_demand_scheduler.UtilizationScore | from abc import abstractmethod
class UtilizationScore:
"""This fancy class just defines the `UtilizationScore` protocol to be
some type that is a "totally ordered set" (i.e. things that can be sorted).
What we're really trying to express is
```
UtilizationScore = TypeVar("UtilizationScore", bound... |
class UtilizationScore:
'''This fancy class just defines the `UtilizationScore` protocol to be
some type that is a "totally ordered set" (i.e. things that can be sorted).
What we're really trying to express is
```
UtilizationScore = TypeVar("UtilizationScore", bound=Comparable["UtilizationScore"])
... | 8 | 1 | 2 | 0 | 2 | 0 | 1 | 0.92 | 0 | 1 | 0 | 0 | 5 | 0 | 5 | 5 | 35 | 10 | 13 | 8 | 5 | 12 | 11 | 6 | 5 | 1 | 0 | 0 | 5 |
9,806 | ray-project/ray | python/ray/autoscaler/_private/resource_demand_scheduler.py | ray.autoscaler._private.resource_demand_scheduler.UtilizationScorer | from typing import Callable, Dict, List, Optional, Tuple
from ray.autoscaler._private.node_provider_availability_tracker import NodeAvailabilitySummary
class UtilizationScorer:
def __call__(node_resources: NodeResources, resource_demands: ResourceDemands, *, node_availability_summary: NodeAvailabilitySummary) -> ... |
class UtilizationScorer:
def __call__(node_resources: NodeResources, resource_demands: ResourceDemands, *, node_availability_summary: NodeAvailabilitySummary) -> Optional[UtilizationScore]:
pass | 2 | 0 | 7 | 0 | 7 | 0 | 1 | 0 | 0 | 2 | 2 | 0 | 1 | 0 | 1 | 1 | 8 | 0 | 8 | 7 | 1 | 0 | 3 | 2 | 1 | 1 | 0 | 0 | 1 |
9,807 | ray-project/ray | python/ray/autoscaler/_private/spark/node_provider.py | ray.autoscaler._private.spark.node_provider.SparkNodeProvider | from ray.autoscaler.node_launch_exception import NodeLaunchException
from ray.autoscaler.tags import NODE_KIND_HEAD, NODE_KIND_WORKER, STATUS_SETTING_UP, STATUS_UP_TO_DATE, TAG_RAY_NODE_KIND, TAG_RAY_NODE_NAME, TAG_RAY_NODE_STATUS, TAG_RAY_USER_NODE_TYPE
import requests
from ray.autoscaler.node_provider import NodeProv... |
class SparkNodeProvider(NodeProvider):
'''A node provider that implements provider for nodes of Ray on spark.'''
def __init__(self, provider_config, cluster_name):
pass
def get_next_node_id(self):
pass
def non_terminated_nodes(self, tag_filters):
pass
def _query_node_sta... | 19 | 1 | 12 | 1 | 10 | 1 | 2 | 0.06 | 1 | 7 | 1 | 0 | 16 | 7 | 17 | 38 | 220 | 34 | 175 | 56 | 149 | 11 | 101 | 49 | 82 | 10 | 1 | 5 | 30 |
9,808 | ray-project/ray | python/ray/autoscaler/_private/spark/spark_job_server.py | ray.autoscaler._private.spark.spark_job_server.SparkJobServer | from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
import time
class SparkJobServer(ThreadingHTTPServer):
"""
High level design:
1. In Ray on spark autoscaling mode, How to start and terminate Ray worker node ?
It uses spark job to launch Ray worker node,
and each spark job conta... |
class SparkJobServer(ThreadingHTTPServer):
'''
High level design:
1. In Ray on spark autoscaling mode, How to start and terminate Ray worker node ?
It uses spark job to launch Ray worker node,
and each spark job contains only one spark task, the corresponding spark task
creates Ray worker node ... | 3 | 1 | 14 | 1 | 6 | 8 | 2 | 4 | 1 | 2 | 1 | 0 | 2 | 4 | 2 | 31 | 68 | 8 | 12 | 8 | 9 | 48 | 12 | 8 | 9 | 2 | 4 | 1 | 3 |
9,809 | ray-project/ray | python/ray/autoscaler/_private/spark/spark_job_server.py | ray.autoscaler._private.spark.spark_job_server.SparkJobServerRequestHandler | from pyspark.util import inheritable_thread_target
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
import threading
import os
from pathlib import Path
from ray.util.spark.cluster_init import _start_ray_worker_nodes
import json
import logging
class SparkJobServerRequestHandler(BaseHTTPRequestHandler... |
class SparkJobServerRequestHandler(BaseHTTPRequestHandler):
def setup(self) -> None:
pass
def _set_headers(self):
pass
def handle_POST(self, path, data):
pass
def start_ray_worker_thread_fn():
pass
def do_POST(self):
'''Reads post... | 7 | 1 | 31 | 2 | 26 | 3 | 4 | 0.12 | 1 | 7 | 0 | 0 | 5 | 3 | 5 | 28 | 149 | 16 | 119 | 33 | 112 | 14 | 80 | 33 | 73 | 11 | 3 | 3 | 21 |
9,810 | ray-project/ray | python/ray/autoscaler/_private/subprocess_output_util.py | ray.autoscaler._private.subprocess_output_util.ProcessRunnerError | class ProcessRunnerError(Exception):
def __init__(self, msg, msg_type, code=None, command=None, special_case=None):
super(ProcessRunnerError, self).__init__('{} (discovered={}): type={}, code={}, command={}'.format(msg, special_case, msg_type, code, command))
self.msg_type = msg_type
self.c... | class ProcessRunnerError(Exception):
def __init__(self, msg, msg_type, code=None, command=None, special_case=None):
pass | 2 | 0 | 12 | 2 | 10 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 1 | 4 | 1 | 11 | 13 | 2 | 11 | 6 | 9 | 0 | 7 | 6 | 5 | 1 | 3 | 0 | 1 |
9,811 | ray-project/ray | python/ray/autoscaler/_private/updater.py | ray.autoscaler._private.updater.NodeUpdater | from ray.autoscaler._private import subprocess_output_util as cmd_output_util
import click
from ray._common.usage import usage_constants, usage_lib
from ray.autoscaler._private.event_system import CreateClusterEvent, global_event_system
from ray.autoscaler._private.log_timer import LogTimer
import os
from ray.autoscale... |
class NodeUpdater:
'''A process for syncing files and running init commands on a node.
Arguments:
node_id: the Node ID
provider_config: Provider section of autoscaler yaml
provider: NodeProvider Class
auth_config: Auth section of autoscaler yaml
cluster_name: the name of... | 9 | 1 | 66 | 5 | 53 | 7 | 7 | 0.19 | 0 | 10 | 4 | 1 | 7 | 23 | 7 | 7 | 524 | 47 | 401 | 85 | 366 | 77 | 220 | 57 | 210 | 24 | 0 | 8 | 54 |
9,812 | ray-project/ray | python/ray/autoscaler/_private/updater.py | ray.autoscaler._private.updater.NodeUpdaterThread | from threading import Thread
class NodeUpdaterThread(NodeUpdater, Thread):
def __init__(self, *args, **kwargs):
Thread.__init__(self)
NodeUpdater.__init__(self, *args, **kwargs)
self.exitcode = -1 |
class NodeUpdaterThread(NodeUpdater, Thread):
def __init__(self, *args, **kwargs):
pass | 2 | 0 | 4 | 0 | 4 | 0 | 1 | 0 | 2 | 0 | 0 | 0 | 1 | 1 | 1 | 33 | 5 | 0 | 5 | 3 | 3 | 0 | 5 | 3 | 3 | 1 | 1 | 0 | 1 |
9,813 | ray-project/ray | python/ray/autoscaler/_private/util.py | ray.autoscaler._private.util.ConcurrentCounter | import collections
import threading
class ConcurrentCounter:
def __init__(self):
self._lock = threading.RLock()
self._counter = collections.defaultdict(int)
def inc(self, key, count):
with self._lock:
self._counter[key] += count
return self.value
def dec(s... |
class ConcurrentCounter:
def __init__(self):
pass
def inc(self, key, count):
pass
def dec(self, key, count):
pass
def breakdown(self):
pass
@property
def value(self):
pass | 7 | 0 | 4 | 0 | 4 | 0 | 1 | 0 | 0 | 2 | 0 | 0 | 5 | 2 | 5 | 5 | 24 | 4 | 20 | 9 | 13 | 0 | 19 | 8 | 13 | 1 | 0 | 1 | 5 |
9,814 | ray-project/ray | python/ray/autoscaler/_private/util.py | ray.autoscaler._private.util.LoadMetricsSummary | from typing import Any, Dict, List, Optional, Tuple, Union
from dataclasses import dataclass
@dataclass
class LoadMetricsSummary:
usage: Usage
resource_demand: List[DictCount]
pg_demand: List[DictCount]
request_demand: List[DictCount]
node_types: List[DictCount]
head_ip: Optional[NodeIP] = None... | @dataclass
class LoadMetricsSummary:
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 1.2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 22 | 0 | 10 | 5 | 9 | 12 | 10 | 5 | 9 | 0 | 0 | 0 | 0 |
9,815 | ray-project/ray | python/ray/autoscaler/batching_node_provider.py | ray.autoscaler.batching_node_provider.BatchingNodeProvider | from ray.autoscaler._private.util import NodeID, NodeIP, NodeKind, NodeStatus, NodeType
from typing import Any, Dict, List, Optional, Set
from ray.autoscaler._private.constants import DISABLE_LAUNCH_CONFIG_CHECK_KEY, DISABLE_NODE_UPDATERS_KEY, FOREGROUND_NODE_LAUNCH_KEY
from ray.autoscaler.tags import NODE_KIND_HEAD, T... |
class BatchingNodeProvider(NodeProvider):
'''Abstract subclass of NodeProvider meant for use with external cluster managers.
Batches reads of cluster state into a single method, get_node_data, called at the
start of an autoscaling update.
Batches modifications to cluster state into a single method, sub... | 12 | 5 | 15 | 1 | 10 | 4 | 2 | 0.53 | 1 | 9 | 2 | 3 | 11 | 4 | 11 | 32 | 191 | 29 | 107 | 35 | 89 | 57 | 71 | 29 | 59 | 7 | 1 | 3 | 23 |
9,816 | ray-project/ray | python/ray/autoscaler/batching_node_provider.py | ray.autoscaler.batching_node_provider.NodeData | from dataclasses import dataclass, field
from typing import Any, Dict, List, Optional, Set
from ray.autoscaler._private.util import NodeID, NodeIP, NodeKind, NodeStatus, NodeType
@dataclass
class NodeData:
"""Stores all data about a Ray node needed by the autoscaler.
Attributes:
kind: Whether the node... | @dataclass
class NodeData:
'''Stores all data about a Ray node needed by the autoscaler.
Attributes:
kind: Whether the node is the head or a worker.
type: The user-defined type of the node.
replica_index: An identifier for nodes in a replica of a TPU worker group.
This value ... | 2 | 1 | 0 | 0 | 0 | 0 | 0 | 2.67 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 24 | 2 | 6 | 2 | 5 | 16 | 6 | 2 | 5 | 0 | 0 | 0 | 0 |
9,817 | ray-project/ray | python/ray/autoscaler/batching_node_provider.py | ray.autoscaler.batching_node_provider.ScaleRequest | from dataclasses import dataclass, field
from ray.autoscaler._private.util import NodeID, NodeIP, NodeKind, NodeStatus, NodeType
from typing import Any, Dict, List, Optional, Set
@dataclass
class ScaleRequest:
"""Stores desired scale computed by the autoscaler.
Attributes:
desired_num_workers: Map of ... | @dataclass
class ScaleRequest:
'''Stores desired scale computed by the autoscaler.
Attributes:
desired_num_workers: Map of worker NodeType to desired number of workers of
that type.
workers_to_delete: List of ids of nodes that should be removed.
'''
pass | 2 | 1 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 11 | 2 | 3 | 3 | 2 | 6 | 3 | 3 | 2 | 0 | 0 | 0 | 0 |
9,818 | ray-project/ray | python/ray/autoscaler/command_runner.py | ray.autoscaler.command_runner.CommandRunnerInterface | from typing import Any, Dict, List, Optional, Tuple
from ray.util.annotations import DeveloperAPI
@DeveloperAPI
class CommandRunnerInterface:
"""Interface to run commands on a remote cluster node.
**Important**: This is an INTERNAL API that is only exposed for the purpose
of implementing custom node provi... | @DeveloperAPI
class CommandRunnerInterface:
'''Interface to run commands on a remote cluster node.
**Important**: This is an INTERNAL API that is only exposed for the purpose
of implementing custom node providers. It is not allowed to call into
CommandRunner methods from any Ray package outside the auto... | 7 | 6 | 14 | 1 | 5 | 8 | 1 | 1.61 | 0 | 6 | 0 | 4 | 5 | 0 | 5 | 5 | 86 | 13 | 28 | 23 | 5 | 45 | 11 | 6 | 5 | 1 | 0 | 0 | 5 |
9,819 | ray-project/ray | python/ray/autoscaler/local/coordinator_server.py | ray.autoscaler.local.coordinator_server.OnPremCoordinatorServer | from ray._common.network_utils import build_address
from http.server import HTTPServer, SimpleHTTPRequestHandler
from ray.autoscaler._private.local.node_provider import LocalNodeProvider
import threading
class OnPremCoordinatorServer(threading.Thread):
"""Initializes HTTPServer and serves CoordinatorSenderNodeProv... |
class OnPremCoordinatorServer(threading.Thread):
'''Initializes HTTPServer and serves CoordinatorSenderNodeProvider forever.
It handles requests from the remote CoordinatorSenderNodeProvider. The
requests are forwarded to LocalNodeProvider function calls.
'''
def __init__(self, list_of_node_ips, h... | 4 | 3 | 7 | 0 | 6 | 1 | 1 | 0.3 | 1 | 3 | 1 | 0 | 3 | 3 | 3 | 28 | 31 | 5 | 20 | 9 | 16 | 6 | 15 | 9 | 11 | 1 | 1 | 0 | 3 |
9,820 | ray-project/ray | python/ray/autoscaler/node_launch_exception.py | ray.autoscaler.node_launch_exception.NodeLaunchException | from typing import Any, Optional, Tuple
from ray.util.annotations import DeveloperAPI
@DeveloperAPI
class NodeLaunchException(Exception):
"""A structured exception that can be thrown by a node provider during a
`create_node` call to pass additional information for observability.
"""
def __init__(self,... | @DeveloperAPI
class NodeLaunchException(Exception):
'''A structured exception that can be thrown by a node provider during a
`create_node` call to pass additional information for observability.
'''
def __init__(self, category: str, description: str, src_exc_info: Optional[Tuple[Any, Any, Any]]):
... | 4 | 2 | 13 | 1 | 8 | 5 | 1 | 0.81 | 1 | 3 | 0 | 0 | 2 | 3 | 2 | 12 | 31 | 3 | 16 | 11 | 8 | 13 | 8 | 6 | 5 | 1 | 3 | 0 | 2 |
9,821 | ray-project/ray | python/ray/autoscaler/node_provider.py | ray.autoscaler.node_provider.NodeProvider | from ray.autoscaler.command_runner import CommandRunnerInterface
from ray.util.annotations import DeveloperAPI
from types import ModuleType
from typing import Any, Dict, List, Optional
from ray.autoscaler._private.command_runner import DockerCommandRunner, SSHCommandRunner
@DeveloperAPI
class NodeProvider:
"""Inte... | @DeveloperAPI
class NodeProvider:
'''Interface for getting and returning nodes from a Cloud.
**Important**: This is an INTERNAL API that is only exposed for the purpose
of implementing custom node providers. It is not allowed to call into
NodeProvider methods from any Ray package outside the autoscaler,... | 27 | 21 | 10 | 1 | 5 | 4 | 1 | 0.99 | 0 | 11 | 3 | 12 | 19 | 4 | 21 | 21 | 251 | 46 | 103 | 57 | 57 | 102 | 67 | 34 | 44 | 7 | 0 | 2 | 31 |
9,822 | ray-project/ray | python/ray/autoscaler/v2/autoscaler.py | ray.autoscaler.v2.autoscaler.Autoscaler | from ray.autoscaler.v2.instance_manager.subscribers.threaded_ray_installer import ThreadedRayInstaller
from ray.autoscaler.v2.instance_manager.storage import InMemoryStorage
from ray.autoscaler.v2.instance_manager.instance_manager import InstanceManager, InstanceUpdatedSubscriber
from ray.autoscaler._private.providers ... |
class Autoscaler:
def __init__(self, session_name: str, config_reader: IConfigReader, gcs_client: GcsClient, event_logger: Optional[AutoscalerEventLogger]=None, metrics_reporter: Optional[AutoscalerMetricsReporter]=None) -> None:
'''
Args:
session_name: The current Ray session name.
... | 5 | 4 | 39 | 4 | 27 | 8 | 3 | 0.29 | 0 | 21 | 17 | 0 | 4 | 9 | 4 | 4 | 160 | 19 | 109 | 41 | 87 | 32 | 47 | 23 | 42 | 4 | 0 | 2 | 10 |
9,823 | ray-project/ray | python/ray/autoscaler/v2/event_logger.py | ray.autoscaler.v2.event_logger.AutoscalerEventLogger | from ray._private.event.event_logger import EventLoggerAdapter
from typing import Dict, List, Optional
from collections import defaultdict
from ray.core.generated.common_pb2 import LabelSelectorOperator
from ray.autoscaler.v2.utils import ResourceRequestUtil
from ray.core.generated.autoscaler_pb2 import ClusterResource... |
class AutoscalerEventLogger:
'''
Logs events related to the autoscaler.
# TODO:
- Add more logging for other events.
- Rate limit the events if too spammy.
'''
def __init__(self, logger: EventLoggerAdapter):
pass
def log_cluster_scheduling_update(self, cluster_resources: Dict[... | 3 | 2 | 65 | 8 | 51 | 7 | 12 | 0.19 | 0 | 7 | 3 | 0 | 2 | 1 | 2 | 2 | 139 | 19 | 103 | 33 | 89 | 20 | 66 | 22 | 63 | 23 | 0 | 4 | 24 |
9,824 | ray-project/ray | python/ray/autoscaler/v2/instance_manager/cloud_providers/kuberay/cloud_provider.py | ray.autoscaler.v2.instance_manager.cloud_providers.kuberay.cloud_provider.KubeRayProvider | from collections import defaultdict
import time
from ray.autoscaler.v2.instance_manager.node_provider import CloudInstance, CloudInstanceId, CloudInstanceProviderError, ICloudInstanceProvider, LaunchNodeError, NodeKind, TerminateNodeError
import copy
from ray.autoscaler.v2.schema import NodeType
from ray.autoscaler._pr... |
class KubeRayProvider(ICloudInstanceProvider):
'''
This class is a thin wrapper around the Kubernetes API client. It modifies
the RayCluster resource spec on the Kubernetes API server to scale the cluster:
It launches new instances/nodes by submitting patches to the Kubernetes API
to update the Ray... | 27 | 15 | 24 | 3 | 15 | 6 | 3 | 0.48 | 1 | 15 | 7 | 0 | 16 | 8 | 19 | 43 | 530 | 74 | 309 | 117 | 259 | 147 | 188 | 84 | 167 | 8 | 5 | 3 | 54 |
9,825 | ray-project/ray | python/ray/autoscaler/v2/instance_manager/cloud_providers/read_only/cloud_provider.py | ray.autoscaler.v2.instance_manager.cloud_providers.read_only.cloud_provider.ReadOnlyProvider | from typing import Dict, List
from ray.autoscaler.v2.utils import is_head_node
from ray._common.utils import binary_to_hex
from ray.core.generated.autoscaler_pb2 import NodeStatus
from ray.autoscaler.v2.instance_manager.node_provider import CloudInstance, CloudInstanceId, CloudInstanceProviderError, ICloudInstanceProvi... |
class ReadOnlyProvider(ICloudInstanceProvider):
'''
A read only provider that use the ray node states from the GCS as the
cloud instances.
This is used for laptop mode / manual cluster setup modes, in order to
provide status reporting in the same way for users.
'''
def __init__(self, provi... | 6 | 1 | 9 | 1 | 7 | 1 | 2 | 0.31 | 1 | 6 | 2 | 0 | 5 | 3 | 5 | 29 | 56 | 11 | 35 | 16 | 27 | 11 | 21 | 14 | 15 | 5 | 5 | 2 | 9 |
9,826 | ray-project/ray | python/ray/autoscaler/v2/instance_manager/common.py | ray.autoscaler.v2.instance_manager.common.InstanceUtil | import time
from ray.core.generated.instance_manager_pb2 import Instance, InstanceUpdateEvent
from typing import Dict, List, Optional, Set
import uuid
class InstanceUtil:
"""
A helper class to group updates and operations on an Instance object defined
in instance_manager.proto
"""
_reachable_from: ... |
class InstanceUtil:
'''
A helper class to group updates and operations on an Instance object defined
in instance_manager.proto
'''
@staticmethod
def new_instance(instance_id: str, instance_type: str, status: Instance.InstanceStatus, details: str='') -> Instance:
'''
Returns a ne... | 33 | 17 | 25 | 1 | 13 | 11 | 2 | 0.81 | 0 | 4 | 0 | 0 | 1 | 0 | 16 | 16 | 465 | 37 | 238 | 71 | 180 | 193 | 85 | 31 | 67 | 3 | 0 | 2 | 31 |
9,827 | ray-project/ray | python/ray/autoscaler/v2/instance_manager/config.py | ray.autoscaler.v2.instance_manager.config.AutoscalingConfig | from ray.autoscaler._private.util import format_readonly_node_type, hash_launch_conf, hash_runtime_conf, prepare_config, validate_config
import yaml
from typing import Any, Dict, List, Optional
from ray.autoscaler.v2.schema import NodeType
from ray.autoscaler._private.constants import AUTOSCALER_MAX_CONCURRENT_LAUNCHES... |
class AutoscalingConfig:
'''
AutoscalingConfig is the helper class to provide autoscaling
related configs.
# TODO(rickyx):
1. Move the config validation logic here.
2. Deprecate the ray-schema.json for validation because it's
static thus not possible to validate the config with ... | 35 | 8 | 8 | 0 | 6 | 2 | 2 | 0.32 | 0 | 10 | 3 | 0 | 31 | 4 | 31 | 31 | 297 | 39 | 198 | 64 | 157 | 63 | 129 | 55 | 97 | 8 | 0 | 2 | 54 |
9,828 | ray-project/ray | python/ray/autoscaler/v2/instance_manager/config.py | ray.autoscaler.v2.instance_manager.config.FileConfigReader | import yaml
from pathlib import Path
class FileConfigReader(IConfigReader):
"""A class that reads cluster config from a yaml file."""
def __init__(self, config_file: str, skip_content_hash: bool=True) -> None:
"""
Args:
config_file: The path to the config file.
skip_con... |
class FileConfigReader(IConfigReader):
'''A class that reads cluster config from a yaml file.'''
def __init__(self, config_file: str, skip_content_hash: bool=True) -> None:
'''
Args:
config_file: The path to the config file.
skip_content_hash: Whether to skip file moun... | 5 | 3 | 6 | 0 | 3 | 3 | 1 | 0.85 | 1 | 4 | 1 | 0 | 4 | 3 | 4 | 26 | 29 | 5 | 13 | 10 | 8 | 11 | 13 | 9 | 8 | 1 | 5 | 1 | 4 |
9,829 | ray-project/ray | python/ray/autoscaler/v2/instance_manager/config.py | ray.autoscaler.v2.instance_manager.config.IConfigReader | from abc import ABC, abstractmethod
class IConfigReader(ABC):
"""An interface for reading Autoscaling config.
A utility class that reads autoscaling configs from various sources:
- File
- In-memory dict
- Remote config service (e.g. KubeRay's config)
Example:
reader = File... |
class IConfigReader(ABC):
'''An interface for reading Autoscaling config.
A utility class that reads autoscaling configs from various sources:
- File
- In-memory dict
- Remote config service (e.g. KubeRay's config)
Example:
reader = FileConfigReader("path/to/config.yaml")
... | 5 | 3 | 5 | 1 | 2 | 3 | 1 | 2.71 | 1 | 0 | 0 | 3 | 2 | 0 | 2 | 22 | 33 | 7 | 7 | 5 | 2 | 19 | 5 | 3 | 2 | 1 | 4 | 0 | 2 |
9,830 | ray-project/ray | python/ray/autoscaler/v2/instance_manager/config.py | ray.autoscaler.v2.instance_manager.config.InstanceReconcileConfig | from dataclasses import dataclass, field
from ray._private.ray_constants import env_integer
@dataclass(frozen=True)
class InstanceReconcileConfig:
request_status_timeout_s: int = env_integer('RAY_AUTOSCALER_RECONCILE_REQUEST_STATUS_TIMEOUT_S', 10 * 60)
allocate_status_timeout_s: int = env_integer('RAY_AUTOSCAL... | @dataclass(frozen=True)
class InstanceReconcileConfig:
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0.41 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 31 | 0 | 22 | 8 | 21 | 9 | 8 | 8 | 7 | 0 | 0 | 0 | 0 |
9,831 | ray-project/ray | python/ray/autoscaler/v2/instance_manager/config.py | ray.autoscaler.v2.instance_manager.config.KubeRayConfigReader | from ray.autoscaler._private.kuberay.autoscaling_config import AutoscalingConfigProducer
class KubeRayConfigReader(IConfigReader):
"""A class that reads cluster config from a K8s RayCluster CR."""
def __init__(self, config_producer: AutoscalingConfigProducer):
self._config_producer = config_producer
... |
class KubeRayConfigReader(IConfigReader):
'''A class that reads cluster config from a K8s RayCluster CR.'''
def __init__(self, config_producer: AutoscalingConfigProducer):
pass
def _generate_configs_from_k8s(self) -> AutoscalingConfig:
pass
def get_cached_autoscaling_config(self) -> ... | 5 | 3 | 5 | 0 | 2 | 2 | 1 | 0.9 | 1 | 2 | 2 | 0 | 4 | 2 | 4 | 26 | 24 | 5 | 10 | 7 | 5 | 9 | 10 | 7 | 5 | 1 | 5 | 0 | 4 |
9,832 | ray-project/ray | python/ray/autoscaler/v2/instance_manager/config.py | ray.autoscaler.v2.instance_manager.config.NodeTypeConfig | from ray.autoscaler.v2.schema import NodeType
from dataclasses import dataclass, field
from typing import Any, Dict, List, Optional
@dataclass
class NodeTypeConfig:
"""
NodeTypeConfig is the helper class to provide node type specific configs.
This maps to subset of the `available_node_types` field in the
... | @dataclass
class NodeTypeConfig:
'''
NodeTypeConfig is the helper class to provide node type specific configs.
This maps to subset of the `available_node_types` field in the
autoscaling config.
'''
def __post_init__(self):
pass | 3 | 1 | 3 | 0 | 3 | 0 | 1 | 1.27 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 27 | 2 | 11 | 6 | 9 | 14 | 11 | 6 | 9 | 1 | 0 | 0 | 1 |
9,833 | ray-project/ray | python/ray/autoscaler/v2/instance_manager/config.py | ray.autoscaler.v2.instance_manager.config.Provider | from enum import Enum
class Provider(Enum):
UNKNOWN = 0
ALIYUN = 1
AWS = 2
AZURE = 3
GCP = 4
KUBERAY = 5
LOCAL = 6
READ_ONLY = 7 |
class Provider(Enum):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 49 | 9 | 0 | 9 | 9 | 8 | 0 | 9 | 9 | 8 | 0 | 4 | 0 | 0 |
9,834 | ray-project/ray | python/ray/autoscaler/v2/instance_manager/config.py | ray.autoscaler.v2.instance_manager.config.ReadOnlyProviderConfigReader | from ray.autoscaler._private.util import format_readonly_node_type, hash_launch_conf, hash_runtime_conf, prepare_config, validate_config
from ray.autoscaler.v2.utils import is_head_node
from ray._common.utils import binary_to_hex
from ray.autoscaler._private.monitor import BASE_READONLY_CONFIG
from ray.autoscaler.v2.sd... |
class ReadOnlyProviderConfigReader(IConfigReader):
'''A class that reads cluster config for a read-only provider.
This is used for laptop mode / manual cluster setup modes, in order to
provide status reporting in the same way for users.'''
def __init__(self, gcs_address: str):
pass
def re... | 4 | 1 | 11 | 1 | 8 | 1 | 2 | 0.23 | 1 | 3 | 1 | 0 | 3 | 2 | 3 | 25 | 40 | 8 | 26 | 11 | 22 | 6 | 21 | 11 | 17 | 5 | 5 | 2 | 7 |
9,835 | ray-project/ray | python/ray/autoscaler/v2/instance_manager/instance_manager.py | ray.autoscaler.v2.instance_manager.instance_manager.InstanceManager | from typing import List, Optional
from ray.core.generated.instance_manager_pb2 import GetInstanceManagerStateReply, GetInstanceManagerStateRequest, Instance, InstanceUpdateEvent, NodeKind, StatusCode, UpdateInstanceManagerStateReply, UpdateInstanceManagerStateRequest
from ray.autoscaler.v2.instance_manager.instance_sto... |
class InstanceManager:
'''
See `InstanceManagerService` in instance_manager.proto
This handles updates to an instance, or inserts a new instance if
it's an insert update. We should only be inserting new instances
of the below statuses:
1. ALLOCATED: For unmanaged instance not initialized by... | 12 | 7 | 30 | 3 | 19 | 8 | 3 | 0.51 | 0 | 5 | 3 | 0 | 3 | 2 | 7 | 7 | 242 | 35 | 137 | 36 | 115 | 70 | 71 | 22 | 63 | 7 | 0 | 2 | 18 |
9,836 | ray-project/ray | python/ray/autoscaler/v2/instance_manager/instance_manager.py | ray.autoscaler.v2.instance_manager.instance_manager.InstanceUpdatedSubscriber | from abc import ABC, abstractmethod
from typing import List, Optional
from ray.core.generated.instance_manager_pb2 import GetInstanceManagerStateReply, GetInstanceManagerStateRequest, Instance, InstanceUpdateEvent, NodeKind, StatusCode, UpdateInstanceManagerStateReply, UpdateInstanceManagerStateRequest
class InstanceU... |
class InstanceUpdatedSubscriber(ABC):
'''Subscribers to instance status changes.'''
@abstractmethod
def notify(self, events: List[InstanceUpdateEvent]) -> None:
pass | 3 | 1 | 2 | 0 | 2 | 0 | 1 | 0.25 | 1 | 0 | 0 | 3 | 1 | 0 | 1 | 21 | 6 | 1 | 4 | 3 | 1 | 1 | 3 | 2 | 1 | 1 | 4 | 0 | 1 |
9,837 | ray-project/ray | python/ray/autoscaler/v2/instance_manager/instance_storage.py | ray.autoscaler.v2.instance_manager.instance_storage.InstanceStorage | import copy
from typing import Dict, List, Optional, Set, Tuple
from ray.autoscaler.v2.instance_manager.storage import Storage, StoreStatus
from ray.core.generated.instance_manager_pb2 import Instance
class InstanceStorage:
"""Instance storage stores the states of instances in the storage."""
def __init__(sel... |
class InstanceStorage:
'''Instance storage stores the states of instances in the storage.'''
def __init__(self, cluster_id: str, storage: Storage) -> None:
pass
def batch_upsert_instances(self, updates: List[Instance], expected_storage_version: Optional[int]=None) -> StoreStatus:
'''Upser... | 6 | 5 | 27 | 3 | 14 | 10 | 2 | 0.73 | 0 | 4 | 1 | 0 | 5 | 3 | 5 | 5 | 141 | 20 | 70 | 39 | 45 | 51 | 40 | 20 | 34 | 3 | 0 | 2 | 10 |
9,838 | ray-project/ray | python/ray/autoscaler/v2/instance_manager/node_provider.py | ray.autoscaler.v2.instance_manager.node_provider.CloudInstanceLaunchRequest | from dataclasses import dataclass
from ray.autoscaler.v2.schema import NodeType
@dataclass(frozen=True)
class CloudInstanceLaunchRequest:
"""
The arguments to launch a node.
"""
node_type: NodeType
count: int
request_id: str | @dataclass(frozen=True)
class CloudInstanceLaunchRequest:
'''
The arguments to launch a node.
'''
pass | 2 | 1 | 0 | 0 | 0 | 0 | 0 | 1.5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 11 | 1 | 4 | 1 | 3 | 6 | 4 | 1 | 3 | 0 | 0 | 0 | 0 |
9,839 | ray-project/ray | python/ray/autoscaler/v2/instance_manager/node_provider.py | ray.autoscaler.v2.instance_manager.node_provider.CloudInstanceProviderError | class CloudInstanceProviderError(Exception):
"""
An base error class that represents an error that happened in the cloud instance
provider.
"""
timestamp_ns: int
def __init__(self, msg, timestamp_ns) -> None:
super().__init__(msg)
self.timestamp_ns = timestamp_ns | class CloudInstanceProviderError(Exception):
'''
An base error class that represents an error that happened in the cloud instance
provider.
'''
def __init__(self, msg, timestamp_ns) -> None:
pass | 2 | 1 | 3 | 0 | 3 | 0 | 1 | 1 | 1 | 1 | 0 | 2 | 1 | 0 | 1 | 11 | 12 | 2 | 5 | 2 | 3 | 5 | 5 | 2 | 3 | 1 | 3 | 0 | 1 |
9,840 | ray-project/ray | python/ray/autoscaler/v2/instance_manager/node_provider.py | ray.autoscaler.v2.instance_manager.node_provider.CloudInstanceTerminateRequest | from dataclasses import dataclass
@dataclass(frozen=True)
class CloudInstanceTerminateRequest:
"""
The arguments to terminate a node.
"""
cloud_instance_id: CloudInstanceId
request_id: str | @dataclass(frozen=True)
class CloudInstanceTerminateRequest:
'''
The arguments to terminate a node.
'''
pass | 2 | 1 | 0 | 0 | 0 | 0 | 0 | 1.67 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 9 | 1 | 3 | 1 | 2 | 5 | 3 | 1 | 2 | 0 | 0 | 0 | 0 |
9,841 | ray-project/ray | python/ray/autoscaler/v2/instance_manager/node_provider.py | ray.autoscaler.v2.instance_manager.node_provider.ICloudInstanceProvider | from ray.autoscaler.v2.schema import NodeType
from abc import ABC, abstractmethod
from typing import Any, Dict, List, Optional
class ICloudInstanceProvider(ABC):
"""
The interface for a cloud instance provider.
This interface is a minimal interface that should be implemented by the
various cloud insta... |
class ICloudInstanceProvider(ABC):
'''
The interface for a cloud instance provider.
This interface is a minimal interface that should be implemented by the
various cloud instance providers (e.g. AWS, and etc).
The cloud instance provider is responsible for managing the cloud instances in the
cl... | 9 | 5 | 11 | 2 | 3 | 6 | 1 | 4.29 | 1 | 4 | 2 | 4 | 4 | 0 | 4 | 24 | 113 | 23 | 17 | 13 | 4 | 73 | 9 | 5 | 4 | 1 | 4 | 0 | 4 |
9,842 | ray-project/ray | python/ray/autoscaler/v2/instance_manager/node_provider.py | ray.autoscaler.v2.instance_manager.node_provider.LaunchNodeError | from typing import Any, Dict, List, Optional
from ray.autoscaler.v2.schema import NodeType
class LaunchNodeError(CloudInstanceProviderError):
node_type: NodeType
count: int
request_id: str
def __init__(self, node_type: NodeType, count: int, request_id: str, timestamp_ns: int, details: str='', cause: O... |
class LaunchNodeError(CloudInstanceProviderError):
def __init__(self, node_type: NodeType, count: int, request_id: str, timestamp_ns: int, details: str='', cause: Optional[Exception]=None) -> None:
pass
def __repr__(self) -> str:
pass | 3 | 0 | 12 | 0 | 12 | 0 | 2 | 0.11 | 1 | 3 | 0 | 0 | 2 | 1 | 2 | 13 | 33 | 2 | 28 | 13 | 17 | 3 | 14 | 5 | 11 | 2 | 4 | 1 | 3 |
9,843 | ray-project/ray | python/ray/autoscaler/v2/instance_manager/node_provider.py | ray.autoscaler.v2.instance_manager.node_provider.NodeProviderAdapter | from concurrent.futures import ThreadPoolExecutor
from ray.autoscaler.v2.instance_manager.config import IConfigReader
from typing import Any, Dict, List, Optional
from ray.autoscaler.v2.schema import NodeType
from queue import Queue
import math
from ray.autoscaler.tags import NODE_KIND_HEAD, NODE_KIND_UNMANAGED, NODE_K... |
class NodeProviderAdapter(ICloudInstanceProvider):
'''
Warps a NodeProviderV1 to a ICloudInstanceProvider.
TODO(rickyx):
The current adapter right now consists of two sets of APIs:
- v1: the old APIs that are used by the autoscaler, where
we forward the calls to the NodeProviderV1.
- v2: th... | 17 | 5 | 13 | 1 | 9 | 3 | 2 | 0.57 | 1 | 14 | 5 | 0 | 14 | 6 | 14 | 38 | 233 | 32 | 128 | 65 | 90 | 73 | 73 | 40 | 58 | 5 | 5 | 2 | 24 |
9,844 | ray-project/ray | python/ray/autoscaler/v2/instance_manager/node_provider.py | ray.autoscaler.v2.instance_manager.node_provider.TerminateNodeError | from typing import Any, Dict, List, Optional
class TerminateNodeError(CloudInstanceProviderError):
cloud_instance_id: CloudInstanceId
request_id: str
def __init__(self, cloud_instance_id: CloudInstanceId, request_id: str, timestamp_ns: int, details: str='', cause: Optional[Exception]=None) -> None:
... |
class TerminateNodeError(CloudInstanceProviderError):
def __init__(self, cloud_instance_id: CloudInstanceId, request_id: str, timestamp_ns: int, details: str='', cause: Optional[Exception]=None) -> None:
pass
def __repr__(self) -> str:
pass | 3 | 0 | 11 | 0 | 11 | 0 | 2 | 0.08 | 1 | 3 | 0 | 0 | 2 | 1 | 2 | 13 | 29 | 2 | 25 | 12 | 15 | 2 | 12 | 5 | 9 | 2 | 4 | 1 | 3 |
9,845 | ray-project/ray | python/ray/autoscaler/v2/instance_manager/ray_installer.py | ray.autoscaler.v2.instance_manager.ray_installer.RayInstaller | from ray.autoscaler.node_provider import NodeProvider as NodeProviderV1
from ray.autoscaler._private.updater import STATUS_UP_TO_DATE, TAG_RAY_NODE_STATUS, NodeUpdater
from ray.autoscaler._private.util import with_envs, with_head_node_ip
import subprocess
from ray.autoscaler.v2.instance_manager.config import Autoscalin... |
class RayInstaller(object):
'''
RayInstaller is responsible for installing ray on the target instance.
'''
def __init__(self, provider: NodeProviderV1, config: AutoscalingConfig, process_runner=subprocess) -> None:
pass
def install_ray(self, instance: Instance, head_node_ip: str) -> None:... | 3 | 2 | 36 | 1 | 30 | 6 | 2 | 0.23 | 1 | 5 | 2 | 0 | 2 | 3 | 2 | 2 | 78 | 3 | 61 | 16 | 53 | 14 | 17 | 11 | 14 | 2 | 1 | 1 | 3 |
9,846 | ray-project/ray | python/ray/autoscaler/v2/instance_manager/reconciler.py | ray.autoscaler.v2.instance_manager.reconciler.Reconciler | from ray.autoscaler.v2.schema import AutoscalerInstance, NodeType
from ray.core.generated.autoscaler_pb2 import AutoscalingState, ClusterResourceState, FailedInstanceRequest, NodeState, NodeStatus, PendingInstance, PendingInstanceRequest
import uuid
from ray.autoscaler.v2.instance_manager.node_provider import CloudInst... |
class Reconciler:
'''
A singleton class that reconciles the instance states of the instance manager
for autoscaler.
'''
@staticmethod
def reconcile(instance_manager: InstanceManager, scheduler: IResourceScheduler, cloud_provider: ICloudInstanceProvider, ray_cluster_resource_state: ClusterResour... | 59 | 21 | 49 | 6 | 30 | 13 | 4 | 0.43 | 0 | 24 | 16 | 0 | 0 | 0 | 28 | 28 | 1,513 | 209 | 915 | 301 | 746 | 392 | 353 | 162 | 322 | 13 | 0 | 3 | 119 |
9,847 | ray-project/ray | python/ray/autoscaler/v2/instance_manager/storage.py | ray.autoscaler.v2.instance_manager.storage.InMemoryStorage | from collections import defaultdict, namedtuple
import copy
from typing import Dict, List, Optional, Tuple
from threading import Lock
class InMemoryStorage(Storage):
"""An in-memory implementation of the Storage interface. This implementation
is not durable"""
def __init__(self):
self._version = 0... |
class InMemoryStorage(Storage):
'''An in-memory implementation of the Storage interface. This implementation
is not durable'''
def __init__(self):
pass
def batch_update(self, table: str, mutation: Dict[str, str]=None, deletion: List[str]=None, expected_version: Optional[int]=None) -> StoreSta... | 7 | 1 | 10 | 0 | 10 | 0 | 3 | 0.03 | 1 | 4 | 0 | 0 | 6 | 3 | 6 | 31 | 71 | 6 | 63 | 29 | 42 | 2 | 43 | 15 | 36 | 5 | 4 | 3 | 16 |
9,848 | ray-project/ray | python/ray/autoscaler/v2/instance_manager/storage.py | ray.autoscaler.v2.instance_manager.storage.Storage | from abc import ABCMeta, abstractmethod
from typing import Dict, List, Optional, Tuple
class Storage(metaclass=ABCMeta):
"""Interface for a storage backend that stores the state of nodes in the cluster.
The storage is thread-safe.
The storage is versioned, which means that each successful stage change to... |
class Storage(metaclass=ABCMeta):
'''Interface for a storage backend that stores the state of nodes in the cluster.
The storage is thread-safe.
The storage is versioned, which means that each successful stage change to the
storage will bump the version number. The version number can be used to
impl... | 11 | 5 | 15 | 1 | 5 | 9 | 1 | 1.68 | 1 | 4 | 0 | 1 | 5 | 0 | 5 | 25 | 97 | 14 | 31 | 26 | 5 | 52 | 11 | 6 | 5 | 1 | 3 | 0 | 5 |
9,849 | ray-project/ray | python/ray/autoscaler/v2/instance_manager/subscribers/cloud_instance_updater.py | ray.autoscaler.v2.instance_manager.subscribers.cloud_instance_updater.CloudInstanceUpdater | from collections import defaultdict
from ray.autoscaler.v2.instance_manager.node_provider import ICloudInstanceProvider
from typing import List
from ray.autoscaler.v2.instance_manager.instance_manager import InstanceUpdatedSubscriber
import uuid
from ray.core.generated.instance_manager_pb2 import Instance, InstanceUpda... |
class CloudInstanceUpdater(InstanceUpdatedSubscriber):
'''CloudInstanceUpdater is responsible for launching
new instances and terminating cloud instances
It requests the cloud instance provider to launch new instances when
there are new instance requests (with REQUESTED status change).
It requests ... | 5 | 3 | 16 | 2 | 10 | 4 | 2 | 0.52 | 1 | 4 | 1 | 0 | 4 | 1 | 4 | 25 | 79 | 15 | 42 | 16 | 34 | 22 | 27 | 13 | 22 | 5 | 5 | 2 | 9 |
9,850 | ray-project/ray | python/ray/autoscaler/v2/instance_manager/subscribers/ray_stopper.py | ray.autoscaler.v2.instance_manager.subscribers.ray_stopper.RayStopError | from dataclasses import dataclass
@dataclass(frozen=True)
class RayStopError:
im_instance_id: str | @dataclass(frozen=True)
class RayStopError:
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 | 0 | 2 | 1 | 1 | 1 | 2 | 1 | 1 | 0 | 0 | 0 | 0 |
9,851 | ray-project/ray | python/ray/autoscaler/v2/instance_manager/subscribers/ray_stopper.py | ray.autoscaler.v2.instance_manager.subscribers.ray_stopper.RayStopper | from ray.autoscaler.v2.instance_manager.instance_manager import InstanceUpdatedSubscriber
from ray.core.generated.instance_manager_pb2 import Instance, InstanceUpdateEvent, TerminationRequest
from queue import Queue
from concurrent.futures import ThreadPoolExecutor
from ray._common.utils import hex_to_binary
from ray.c... |
class RayStopper(InstanceUpdatedSubscriber):
'''RayStopper is responsible for stopping ray on instances.
It will drain the ray node if it's for idle termination.
For other terminations, it will stop the ray node. (e.g. scale down, etc.)
If any failures happen when stopping/draining the node, we will no... | 9 | 4 | 19 | 1 | 14 | 3 | 2 | 0.34 | 1 | 4 | 1 | 0 | 3 | 3 | 5 | 26 | 127 | 16 | 83 | 34 | 62 | 28 | 45 | 20 | 38 | 3 | 5 | 2 | 14 |
9,852 | ray-project/ray | python/ray/autoscaler/v2/instance_manager/subscribers/threaded_ray_installer.py | ray.autoscaler.v2.instance_manager.subscribers.threaded_ray_installer.ThreadedRayInstaller | from ray.autoscaler.v2.instance_manager.instance_manager import InstanceUpdatedSubscriber
from typing import List
from ray.autoscaler.v2.instance_manager.instance_storage import InstanceStorage
import time
from queue import Queue
from ray.core.generated.instance_manager_pb2 import Instance, InstanceUpdateEvent, NodeKin... |
class ThreadedRayInstaller(InstanceUpdatedSubscriber):
'''ThreadedRayInstaller is responsible for install ray on new nodes.'''
def __init__(self, head_node_ip: str, instance_storage: InstanceStorage, ray_installer: RayInstaller, error_queue: Queue, max_install_attempts: int=3, install_retry_interval: int=10, ... | 5 | 1 | 19 | 1 | 17 | 1 | 3 | 0.09 | 1 | 5 | 2 | 0 | 4 | 7 | 4 | 25 | 80 | 6 | 68 | 27 | 55 | 6 | 40 | 19 | 35 | 6 | 5 | 2 | 12 |
9,853 | ray-project/ray | python/ray/autoscaler/v2/metrics_reporter.py | ray.autoscaler.v2.metrics_reporter.AutoscalerMetricsReporter | from ray.autoscaler.v2.instance_manager.config import NodeTypeConfig
from typing import Dict, List
from ray.core.generated.instance_manager_pb2 import Instance as IMInstance
from ray.autoscaler.v2.instance_manager.common import InstanceUtil
from collections import defaultdict
from ray.autoscaler._private.prom_metrics i... |
class AutoscalerMetricsReporter:
def __init__(self, prom_metrics: AutoscalerPrometheusMetrics) -> None:
pass
def report_instances(self, instances: List[IMInstance], node_type_configs: Dict[NodeType, NodeTypeConfig]):
'''
Record autoscaler metrics for:
- pending_nodes: Node... | 5 | 2 | 23 | 2 | 17 | 4 | 4 | 0.23 | 0 | 6 | 3 | 0 | 3 | 1 | 3 | 3 | 90 | 11 | 64 | 24 | 51 | 15 | 33 | 16 | 28 | 8 | 0 | 2 | 17 |
9,854 | ray-project/ray | python/ray/autoscaler/v2/monitor.py | ray.autoscaler.v2.monitor.AutoscalerMonitor | from ray.autoscaler.v2.autoscaler import Autoscaler
from ray.core.generated.event_pb2 import Event as RayEvent
import ray
from ray._raylet import GcsClient
from ray.autoscaler._private.constants import AUTOSCALER_METRIC_PORT, AUTOSCALER_UPDATE_INTERVAL_S
from ray.autoscaler.v2.metrics_reporter import AutoscalerMetricsR... |
class AutoscalerMonitor:
'''Autoscaling monitor.
This process periodically collects stats from the GCS and triggers
autoscaler updates.
TODO:
We should also handle autoscaler failures properly in the future.
Right now, we don't restart autoscaler if it fails (internal reconciliation
however... | 8 | 4 | 23 | 2 | 18 | 3 | 3 | 0.27 | 0 | 7 | 5 | 0 | 3 | 6 | 5 | 5 | 137 | 18 | 94 | 30 | 78 | 25 | 55 | 20 | 49 | 8 | 0 | 2 | 17 |
9,855 | ray-project/ray | python/ray/autoscaler/v2/scheduler.py | ray.autoscaler.v2.scheduler.IResourceScheduler | from abc import ABC, abstractmethod
class IResourceScheduler(ABC):
"""
Interface for a resource scheduler.
Implements the `instance_manager.proto ResourceSchedulerService` interface.
"""
@abstractmethod
def schedule(self, request: SchedulingRequest) -> SchedulingReply:
"""
Giv... |
class IResourceScheduler(ABC):
'''
Interface for a resource scheduler.
Implements the `instance_manager.proto ResourceSchedulerService` interface.
'''
@abstractmethod
def schedule(self, request: SchedulingRequest) -> SchedulingReply:
'''
Given the resource requests and the curre... | 3 | 2 | 7 | 0 | 2 | 5 | 1 | 2.25 | 1 | 2 | 2 | 2 | 1 | 0 | 1 | 21 | 15 | 2 | 4 | 3 | 1 | 9 | 3 | 2 | 1 | 1 | 4 | 0 | 1 |
9,856 | ray-project/ray | python/ray/autoscaler/v2/scheduler.py | ray.autoscaler.v2.scheduler.ResourceDemandScheduler | from ray.autoscaler.v2.event_logger import AutoscalerEventLogger
from ray.autoscaler.v2.instance_manager.config import NodeTypeConfig
from dataclasses import dataclass, field
from ray.core.generated.instance_manager_pb2 import Instance, LaunchRequest, NodeKind, TerminationRequest
import time
from typing import Dict, Li... |
class ResourceDemandScheduler(IResourceScheduler):
'''
A resource demand scheduler that schedules resource requests based on the
following rules:
1. Enforce the minimal count of nodes for each worker node type.
2. Enforce the cluster resource constraints.
3. Schedule the gang resour... | 49 | 24 | 34 | 4 | 20 | 9 | 3 | 0.46 | 1 | 16 | 10 | 0 | 2 | 1 | 14 | 35 | 1,019 | 152 | 593 | 191 | 498 | 274 | 295 | 124 | 263 | 12 | 5 | 3 | 91 |
9,857 | ray-project/ray | python/ray/autoscaler/v2/scheduler.py | ray.autoscaler.v2.scheduler.ResourceRequestSource | from enum import Enum
class ResourceRequestSource(Enum):
"""
The source of the resource request.
"""
PENDING_DEMAND = 'PENDING_DEMAND'
CLUSTER_RESOURCE_CONSTRAINT = 'CLUSTER_RESOURCE_CONSTRAINT' |
class ResourceRequestSource(Enum):
'''
The source of the resource request.
'''
pass | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 2.33 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 49 | 11 | 1 | 3 | 3 | 2 | 7 | 3 | 3 | 2 | 0 | 4 | 0 | 0 |
9,858 | ray-project/ray | python/ray/autoscaler/v2/scheduler.py | ray.autoscaler.v2.scheduler.SchedulingNode | from ray.autoscaler._private.resource_demand_scheduler import UtilizationScore, _fits, _inplace_subtract
from typing import Dict, List, Optional, Tuple
from ray.autoscaler.v2.schema import AutoscalerInstance, NodeType
from dataclasses import dataclass, field
import uuid
from ray._private.protobuf_compat import message_... | @dataclass
class SchedulingNode:
'''
A abstraction of a node that can be scheduled on by the resource scheduler.
A scheduling node is expected to be used as:
node = SchedulingNode.new(instance, node_configs)
remaining, score = node.try_schedule(requests)
.... do something with the s... | 19 | 12 | 33 | 3 | 19 | 11 | 3 | 0.61 | 0 | 13 | 6 | 0 | 10 | 0 | 13 | 13 | 489 | 59 | 268 | 82 | 217 | 163 | 112 | 45 | 98 | 13 | 0 | 3 | 40 |
9,859 | ray-project/ray | python/ray/autoscaler/v2/scheduler.py | ray.autoscaler.v2.scheduler.SchedulingNodeStatus | from enum import Enum
class SchedulingNodeStatus(Enum):
"""
The status of a scheduling node (`SchedulingNode`)
"""
TO_LAUNCH = 'TO_LAUNCH'
SCHEDULABLE = 'SCHEDULABLE'
TO_TERMINATE = 'TO_TERMINATE' |
class SchedulingNodeStatus(Enum):
'''
The status of a scheduling node (`SchedulingNode`)
'''
pass | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 2 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 49 | 13 | 1 | 4 | 4 | 3 | 8 | 4 | 4 | 3 | 0 | 4 | 0 | 0 |
9,860 | ray-project/ray | python/ray/autoscaler/v2/scheduler.py | ray.autoscaler.v2.scheduler.SchedulingReply | from typing import Dict, List, Optional, Tuple
from ray.core.generated.autoscaler_pb2 import ClusterResourceConstraint, GangResourceRequest, ResourceRequest, ResourceRequestByCount
from ray.core.generated.instance_manager_pb2 import Instance, LaunchRequest, NodeKind, TerminationRequest
from dataclasses import dataclass... | @dataclass
class SchedulingReply:
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 15 | 0 | 10 | 6 | 9 | 5 | 6 | 6 | 5 | 0 | 0 | 0 | 0 |
9,861 | ray-project/ray | python/ray/autoscaler/v2/scheduler.py | ray.autoscaler.v2.scheduler.SchedulingRequest | from typing import Dict, List, Optional, Tuple
from ray.core.generated.autoscaler_pb2 import ClusterResourceConstraint, GangResourceRequest, ResourceRequest, ResourceRequestByCount
from ray.autoscaler.v2.schema import AutoscalerInstance, NodeType
from dataclasses import dataclass, field
from ray.autoscaler.v2.instance_... | @dataclass
class SchedulingRequest:
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0.82 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 20 | 0 | 11 | 8 | 10 | 9 | 9 | 8 | 8 | 0 | 0 | 0 | 0 |
9,862 | ray-project/ray | python/ray/autoscaler/v2/schema.py | ray.autoscaler.v2.schema.AutoscalerInstance | from ray.autoscaler.v2.instance_manager.common import InstanceUtil
from dataclasses import dataclass, field
from ray.core.generated.instance_manager_pb2 import Instance
from typing import Dict, List, Optional, Tuple
from ray.core.generated.autoscaler_pb2 import NodeState, NodeStatus
@dataclass
class AutoscalerInstance... | @dataclass
class AutoscalerInstance:
'''
AutoscalerInstance represents an instance that's managed by the autoscaler.
This includes two states:
1. the instance manager state: information of the underlying cloud instance.
2. the ray node state, e.g. resources, ray node status.
The two stat... | 5 | 4 | 27 | 2 | 21 | 3 | 4 | 0.69 | 0 | 3 | 1 | 0 | 3 | 0 | 3 | 3 | 129 | 14 | 68 | 9 | 64 | 47 | 26 | 9 | 22 | 10 | 0 | 3 | 12 |
9,863 | ray-project/ray | python/ray/autoscaler/v2/schema.py | ray.autoscaler.v2.schema.ClusterConstraintDemand | from dataclasses import dataclass, field
@dataclass
class ClusterConstraintDemand(ResourceDemand):
pass | @dataclass
class ClusterConstraintDemand(ResourceDemand):
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 1 | 0 | 0 |
9,864 | ray-project/ray | python/ray/autoscaler/v2/schema.py | ray.autoscaler.v2.schema.ClusterStatus | from dataclasses import dataclass, field
from typing import Dict, List, Optional, Tuple
@dataclass
class ClusterStatus:
active_nodes: List[NodeInfo] = field(default_factory=list)
idle_nodes: List[NodeInfo] = field(default_factory=list)
pending_launches: List[LaunchRequest] = field(default_factory=list)
... | @dataclass
class ClusterStatus:
def total_resources(self) -> Dict[str, float]:
pass
def available_resources(self) -> Dict[str, float]:
pass | 4 | 0 | 2 | 0 | 2 | 0 | 1 | 0.56 | 0 | 2 | 0 | 0 | 2 | 0 | 2 | 2 | 27 | 2 | 16 | 12 | 13 | 9 | 14 | 12 | 11 | 1 | 0 | 0 | 2 |
9,865 | ray-project/ray | python/ray/autoscaler/v2/schema.py | ray.autoscaler.v2.schema.NodeInfo | from typing import Dict, List, Optional, Tuple
from dataclasses import dataclass, field
@dataclass
class NodeInfo:
instance_type_name: str
ray_node_type_name: str
instance_id: str
ip_address: str
node_status: Optional[str] = None
node_id: Optional[str] = None
resource_usage: Optional[NodeUs... | @dataclass
class NodeInfo:
def total_resources(self) -> Dict[str, float]:
pass
def available_resources(self) -> Dict[str, float]:
pass
def used_resources(self) -> Dict[str, float]:
pass | 5 | 0 | 4 | 0 | 4 | 0 | 2 | 0.43 | 0 | 2 | 0 | 0 | 3 | 0 | 3 | 3 | 36 | 3 | 23 | 10 | 19 | 10 | 23 | 10 | 19 | 2 | 0 | 1 | 6 |
9,866 | ray-project/ray | python/ray/autoscaler/v2/schema.py | ray.autoscaler.v2.schema.NodeUsage | from typing import Dict, List, Optional, Tuple
from dataclasses import dataclass, field
@dataclass
class NodeUsage:
usage: List[ResourceUsage]
idle_time_ms: int | @dataclass
class NodeUsage:
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0.67 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 | 0 | 3 | 1 | 2 | 2 | 3 | 1 | 2 | 0 | 0 | 0 | 0 |
9,867 | ray-project/ray | python/ray/autoscaler/v2/schema.py | ray.autoscaler.v2.schema.PlacementGroupResourceDemand | from dataclasses import dataclass, field
from typing import Dict, List, Optional, Tuple
import re
@dataclass
class PlacementGroupResourceDemand(ResourceDemand):
details: str
pg_id: Optional[str] = None
strategy: Optional[str] = None
state: Optional[str] = None
def __post_init__(self):
if n... | @dataclass
class PlacementGroupResourceDemand(ResourceDemand):
def __post_init__(self):
pass | 3 | 0 | 16 | 2 | 12 | 2 | 3 | 0.35 | 1 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 26 | 3 | 17 | 9 | 15 | 6 | 17 | 9 | 15 | 3 | 1 | 1 | 3 |
9,868 | ray-project/ray | python/ray/autoscaler/v2/schema.py | ray.autoscaler.v2.schema.RayTaskActorDemand | from dataclasses import dataclass, field
@dataclass
class RayTaskActorDemand(ResourceDemand):
pass | @dataclass
class RayTaskActorDemand(ResourceDemand):
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 1 | 0 | 0 |
9,869 | ray-project/ray | python/ray/autoscaler/v2/schema.py | ray.autoscaler.v2.schema.ResourceDemand | from dataclasses import dataclass, field
from typing import Dict, List, Optional, Tuple
@dataclass
class ResourceDemand:
bundles_by_count: List[ResourceRequestByCount] | @dataclass
class ResourceDemand:
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | 0 | 0 | 0 | 3 | 0 | 0 | 0 | 0 | 3 | 0 | 2 | 1 | 1 | 1 | 2 | 1 | 1 | 0 | 0 | 0 | 0 |
9,870 | ray-project/ray | python/ray/autoscaler/v2/schema.py | ray.autoscaler.v2.schema.ResourceDemandSummary | from typing import Dict, List, Optional, Tuple
from dataclasses import dataclass, field
@dataclass
class ResourceDemandSummary:
placement_group_demand: List[PlacementGroupResourceDemand] = field(default_factory=list)
ray_task_actor_demand: List[RayTaskActorDemand] = field(default_factory=list)
cluster_cons... | @dataclass
class ResourceDemandSummary:
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0.38 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 11 | 0 | 8 | 4 | 7 | 3 | 4 | 4 | 3 | 0 | 0 | 0 | 0 |
9,871 | ray-project/ray | python/ray/autoscaler/v2/schema.py | ray.autoscaler.v2.schema.ResourceRequestByCount | from typing import Dict, List, Optional, Tuple
from dataclasses import dataclass, field
@dataclass
class ResourceRequestByCount:
bundle: Dict[str, float]
count: int
def __str__(self) -> str:
return f'[{self.count} {self.bundle}]' | @dataclass
class ResourceRequestByCount:
def __str__(self) -> str:
pass | 3 | 0 | 2 | 0 | 2 | 0 | 1 | 0.4 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 1 | 8 | 1 | 5 | 2 | 3 | 2 | 5 | 2 | 3 | 1 | 0 | 0 | 1 |
9,872 | ray-project/ray | python/ray/autoscaler/v2/schema.py | ray.autoscaler.v2.schema.ResourceUsage | from dataclasses import dataclass, field
@dataclass
class ResourceUsage:
resource_name: str = ''
total: float = 0.0
used: float = 0.0 | @dataclass
class ResourceUsage:
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 | 0 | 4 | 4 | 3 | 3 | 4 | 4 | 3 | 0 | 0 | 0 | 0 |
9,873 | ray-project/ray | python/ray/autoscaler/v2/schema.py | ray.autoscaler.v2.schema.Stats | from typing import Dict, List, Optional, Tuple
from dataclasses import dataclass, field
@dataclass
class Stats:
gcs_request_time_s: float
none_terminated_node_request_time_s: Optional[float] = None
autoscaler_iteration_time_s: Optional[float] = None
autoscaler_version: Optional[str] = None
cluster_... | @dataclass
class Stats:
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 1.14 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 15 | 0 | 7 | 6 | 6 | 8 | 7 | 6 | 6 | 0 | 0 | 0 | 0 |
9,874 | ray-project/ray | python/ray/autoscaler/v2/utils.py | ray.autoscaler.v2.utils.ClusterStatusFormatter | from collections import Counter, defaultdict
from itertools import chain
from ray.autoscaler._private import constants
from ray.autoscaler._private.util import format_pg, format_resource_demand_summary, parse_usage
from datetime import datetime
from ray.autoscaler.v2.schema import NODE_DEATH_CAUSE_RAYLET_DIED, ClusterC... |
class ClusterStatusFormatter:
'''
A formatter to format the ClusterStatus into a string.
'''
@classmethod
def format(cls, data: ClusterStatus, verbose: bool=False) -> str:
pass
@staticmethod
def _node_usage_report(active_nodes: List[NodeInfo], idle_nodes: List[NodeInfo]) -> str:
... | 21 | 3 | 45 | 4 | 38 | 4 | 4 | 0.16 | 0 | 11 | 6 | 0 | 0 | 0 | 3 | 3 | 150 | 16 | 117 | 34 | 110 | 19 | 48 | 30 | 44 | 5 | 0 | 2 | 11 |
9,875 | ray-project/ray | python/ray/autoscaler/v2/utils.py | ray.autoscaler.v2.utils.ClusterStatusParser | from ray.autoscaler.v2.schema import NODE_DEATH_CAUSE_RAYLET_DIED, ClusterConstraintDemand, ClusterStatus, LaunchRequest, NodeInfo, NodeUsage, PlacementGroupResourceDemand, RayTaskActorDemand, ResourceDemand, ResourceDemandSummary, ResourceRequestByCount, ResourceUsage, Stats
from copy import deepcopy
from typing impor... |
class ClusterStatusParser:
@classmethod
def from_get_cluster_status_reply(cls, proto: GetClusterStatusReply, stats: Stats) -> ClusterStatus:
pass
@classmethod
def _parse_stats(cls, reply: GetClusterStatusReply, stats: Stats) -> Stats:
'''
Parse the stats from the get cluster st... | 19 | 8 | 34 | 3 | 22 | 9 | 3 | 0.4 | 0 | 18 | 13 | 0 | 0 | 0 | 9 | 9 | 325 | 37 | 205 | 74 | 169 | 83 | 90 | 48 | 80 | 7 | 0 | 2 | 27 |
9,876 | ray-project/ray | python/ray/autoscaler/v2/utils.py | ray.autoscaler.v2.utils.ProtobufUtil | class ProtobufUtil:
"""
A utility class for protobuf objects.
"""
@staticmethod
def to_dict(proto):
"""
Convert a protobuf object to a dict.
This is a slow conversion, and should only be used for debugging or
latency insensitve code.
Args:
proto... | class ProtobufUtil:
'''
A utility class for protobuf objects.
'''
@staticmethod
def to_dict(proto):
'''
Convert a protobuf object to a dict.
This is a slow conversion, and should only be used for debugging or
latency insensitve code.
Args:
prot... | 5 | 3 | 15 | 2 | 5 | 8 | 1 | 1.58 | 0 | 0 | 0 | 1 | 0 | 0 | 2 | 2 | 37 | 6 | 12 | 6 | 6 | 19 | 6 | 4 | 2 | 1 | 0 | 0 | 2 |
9,877 | ray-project/ray | python/ray/autoscaler/v2/utils.py | ray.autoscaler.v2.utils.ResourceRequestUtil | from collections import Counter, defaultdict
from ray.core.generated.autoscaler_pb2 import AffinityConstraint, AntiAffinityConstraint, AutoscalingState, ClusterResourceState, GetClusterStatusReply, NodeState, NodeStatus, PlacementConstraint, ResourceRequest, ResourceRequestByCount as ResourceRequestByCountProto
from ra... |
class ResourceRequestUtil(ProtobufUtil):
'''
A utility class for resource requests, autoscaler.proto.ResourceRequest
'''
class PlacementConstraintType(Enum):
'''
The affinity type for the resource request.
'''
@staticmethod
def group_by_count(requests: List[Resource... | 15 | 9 | 29 | 3 | 17 | 9 | 4 | 0.54 | 1 | 7 | 1 | 0 | 0 | 0 | 6 | 8 | 199 | 27 | 112 | 52 | 85 | 60 | 61 | 31 | 53 | 8 | 1 | 3 | 22 |
9,878 | ray-project/ray | python/ray/client_builder.py | ray.client_builder.ClientBuilder | from ray._private.utils import get_ray_client_dependency_error, split_address
import os
import inspect
import json
from ray._private.worker import BaseContext, init as ray_driver_init
from ray.job_config import JobConfig
from typing import Any, Dict, Optional, Tuple
import warnings
from ray.util.annotations import Depr... | @Deprecated
class ClientBuilder:
'''
Builder for a Ray Client connection. This class can be subclassed by
custom builder classes to modify connection behavior to include additional
features or altered semantics. One example is the ``_LocalClientBuilder``.
'''
def __init__(self, address: Optiona... | 9 | 6 | 26 | 2 | 17 | 8 | 4 | 0.49 | 0 | 9 | 3 | 1 | 7 | 7 | 7 | 7 | 198 | 19 | 120 | 31 | 112 | 59 | 81 | 31 | 73 | 8 | 0 | 2 | 25 |
9,879 | ray-project/ray | python/ray/client_builder.py | ray.client_builder.ClientContext | from ray.util.annotations import Deprecated, PublicAPI
from ray._private.worker import BaseContext, init as ray_driver_init
from typing import Any, Dict, Optional, Tuple
import ray.util.client_connect
from dataclasses import dataclass
@dataclass
@PublicAPI
class ClientContext(BaseContext):
"""
Basic context ma... | @dataclass
@PublicAPI
class ClientContext(BaseContext):
'''
Basic context manager for a ClientBuilder connection.
'''
def __enter__(self) -> 'ClientContext':
pass
def __exit__(self, *exc) -> None:
pass
def disconnect(self) -> None:
pass
def _swap_context(self):
... | 8 | 2 | 7 | 0 | 6 | 2 | 2 | 0.35 | 1 | 1 | 0 | 0 | 5 | 0 | 5 | 32 | 56 | 7 | 37 | 7 | 31 | 13 | 28 | 7 | 22 | 5 | 4 | 2 | 10 |
9,880 | ray-project/ray | python/ray/client_builder.py | ray.client_builder._LocalClientBuilder | import sys
import ray.util.client_connect
class _LocalClientBuilder(ClientBuilder):
def connect(self) -> ClientContext:
"""
Begin a connection to the address passed in via ray.client(...)
"""
if self._deprecation_warn_enabled:
self._client_deprecation_warn()
sel... |
class _LocalClientBuilder(ClientBuilder):
def connect(self) -> ClientContext:
'''
Begin a connection to the address passed in via ray.client(...)
'''
pass | 2 | 1 | 22 | 1 | 15 | 6 | 2 | 0.38 | 1 | 1 | 1 | 0 | 1 | 1 | 1 | 8 | 23 | 1 | 16 | 3 | 14 | 6 | 7 | 3 | 5 | 2 | 1 | 1 | 2 |
9,881 | ray-project/ray | python/ray/cloudpickle/cloudpickle.py | ray.cloudpickle.cloudpickle.Pickler | import logging
import _collections_abc
import types
import io
import weakref
import struct
from types import CellType
import abc
import pickle
import copyreg
import dataclasses
from collections import ChainMap, OrderedDict
import typing
class Pickler(pickle.Pickler):
_dispatch_table = {}
_dispatch_table[classm... |
class Pickler(pickle.Pickler):
def _dynamic_function_reduce(self, func):
'''Reduce a function that is not pickleable via attribute lookup.'''
pass
def _function_reduce(self, obj):
'''Reducer for function objects.
If obj is a top-level attribute of a file-backed module, this re... | 11 | 6 | 21 | 2 | 11 | 9 | 3 | 0.82 | 0 | 8 | 0 | 0 | 10 | 2 | 10 | 10 | 287 | 32 | 142 | 39 | 122 | 116 | 105 | 28 | 94 | 7 | 0 | 3 | 29 |
9,882 | ray-project/ray | python/ray/cloudpickle/cloudpickle.py | ray.cloudpickle.cloudpickle._empty_cell_value | @instance
class _empty_cell_value:
"""Sentinel for empty closures."""
@classmethod
def __reduce__(cls):
return cls.__name__ | @instance
class _empty_cell_value:
'''Sentinel for empty closures.'''
@classmethod
def __reduce__(cls):
pass | 4 | 1 | 2 | 0 | 2 | 0 | 1 | 0.25 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 6 | 1 | 4 | 3 | 1 | 1 | 3 | 2 | 1 | 1 | 0 | 0 | 1 |
9,883 | ray-project/ray | python/ray/cloudpickle/py_pickle.py | ray.cloudpickle.py_pickle.Pickler | from pickle import _Pickler, _Unpickler as Unpickler, _loads as loads, _load as load, PickleError, PicklingError, UnpicklingError, HIGHEST_PROTOCOL
class Pickler(_Pickler):
def __init__(self, file, protocol=None, *, fix_imports=True, buffer_callback=None):
super().__init__(file, protocol, fix_imports=fix_... |
class Pickler(_Pickler):
def __init__(self, file, protocol=None, *, fix_imports=True, buffer_callback=None):
pass | 2 | 0 | 6 | 0 | 5 | 1 | 1 | 0.17 | 1 | 1 | 0 | 0 | 1 | 1 | 1 | 28 | 7 | 0 | 6 | 3 | 4 | 1 | 4 | 3 | 2 | 1 | 1 | 0 | 1 |
9,884 | ray-project/ray | python/ray/cluster_utils.py | ray.cluster_utils.AutoscalingCluster | import ray._private.services
import json
from ray.util.annotations import DeveloperAPI
from typing import Dict, Optional
import ray
import os
from ray.autoscaler._private.fake_multi_node.node_provider import FAKE_HEAD_NODE_ID
import subprocess
import copy
import yaml
import tempfile
@DeveloperAPI
class AutoscalingClus... | @DeveloperAPI
class AutoscalingCluster:
'''Create a local autoscaling cluster for testing.
See test_autoscaler_fake_multinode.py for an end-to-end example.
'''
def __init__(self, head_resources: dict, worker_node_types: dict, autoscaler_v2: bool=False, **config_kwargs):
'''Create the cluster.
... | 6 | 4 | 24 | 1 | 21 | 3 | 3 | 0.18 | 0 | 2 | 0 | 2 | 4 | 3 | 4 | 4 | 106 | 8 | 83 | 22 | 70 | 15 | 40 | 13 | 35 | 8 | 0 | 1 | 12 |
9,885 | ray-project/ray | python/ray/cluster_utils.py | ray.cluster_utils.Cluster | import ray
from ray._private.client_mode_hook import disable_client_hook
from ray._raylet import GcsClientOptions
from ray.util.annotations import DeveloperAPI
import time
import ray._private.services
from ray._private import ray_constants
@DeveloperAPI
class Cluster:
def __init__(self, initialize_head: bool=Fals... | null | 15 | 9 | 24 | 2 | 14 | 8 | 2 | 0.56 | 0 | 10 | 2 | 0 | 11 | 9 | 11 | 11 | 281 | 33 | 160 | 41 | 140 | 89 | 96 | 32 | 84 | 5 | 0 | 3 | 27 |
9,886 | ray-project/ray | python/ray/dag/class_node.py | ray.dag.class_node.ClassMethodNode | from ray.dag.format_utils import get_dag_node_str
from weakref import ReferenceType
from ray.dag.constants import BIND_INDEX_KEY, IS_CLASS_METHOD_OUTPUT_KEY, PARENT_CLASS_NODE_KEY, PREV_CLASS_METHOD_CALL_KEY
from ray.util.annotations import DeveloperAPI
from typing import Any, Dict, List, Optional, Tuple, Union
import ... | @DeveloperAPI
class ClassMethodNode(DAGNode):
'''Represents an actor method invocation in a Ray function DAG.'''
def __init__(self, method_name: str, method_args: Tuple[Any], method_kwargs: Dict[str, Any], method_options: Dict[str, Any], other_args_to_resolve: Dict[str, Any]):
pass
def _copy_impl(... | 21 | 7 | 10 | 0 | 7 | 3 | 2 | 0.43 | 1 | 8 | 3 | 1 | 14 | 9 | 14 | 42 | 165 | 19 | 102 | 46 | 69 | 44 | 58 | 28 | 43 | 3 | 2 | 2 | 21 |
9,887 | ray-project/ray | python/ray/dag/class_node.py | ray.dag.class_node.ClassNode | from ray.dag.format_utils import get_dag_node_str
from ray.dag.input_node import InputNode
from ray.dag.dag_node import DAGNode
import ray
from ray.util.annotations import DeveloperAPI
from typing import Any, Dict, List, Optional, Tuple, Union
@DeveloperAPI
class ClassNode(DAGNode):
"""Represents an actor creation... | @DeveloperAPI
class ClassNode(DAGNode):
'''Represents an actor creation in a Ray task DAG.'''
def __init__(self, cls, cls_args, cls_kwargs, cls_options, other_args_to_resolve=None):
pass
def _copy_impl(self, new_args: List[Any], new_kwargs: Dict[str, Any], new_options: Dict[str, Any], new_other_ar... | 8 | 3 | 12 | 0 | 10 | 2 | 2 | 0.21 | 1 | 9 | 2 | 0 | 6 | 2 | 6 | 34 | 78 | 8 | 58 | 25 | 38 | 12 | 25 | 12 | 18 | 3 | 2 | 2 | 10 |
9,888 | ray-project/ray | python/ray/dag/class_node.py | ray.dag.class_node._ClassMethodOutput | class _ClassMethodOutput:
"""Represents a class method output in a Ray function DAG."""
def __init__(self, class_method_call: 'ClassMethodNode', output_idx: int):
self._class_method_call = class_method_call
self._output_idx = output_idx
@property
def class_method_call(self) -> 'ClassMe... | class _ClassMethodOutput:
'''Represents a class method output in a Ray function DAG.'''
def __init__(self, class_method_call: 'ClassMethodNode', output_idx: int):
pass
@property
def class_method_call(self) -> 'ClassMethodNode':
pass
@property
def output_idx(self) -> int:
... | 6 | 1 | 3 | 0 | 2 | 1 | 1 | 0.3 | 0 | 1 | 0 | 0 | 3 | 2 | 3 | 3 | 16 | 3 | 10 | 8 | 4 | 3 | 8 | 6 | 4 | 1 | 0 | 0 | 3 |
9,889 | ray-project/ray | python/ray/dag/class_node.py | ray.dag.class_node._UnboundClassMethodNode | from ray.dag.constants import BIND_INDEX_KEY, IS_CLASS_METHOD_OUTPUT_KEY, PARENT_CLASS_NODE_KEY, PREV_CLASS_METHOD_CALL_KEY
class _UnboundClassMethodNode(object):
def __init__(self, actor: ClassNode, method_name: str, options: dict):
self._actor = actor
self._method_name = method_name
self... |
class _UnboundClassMethodNode(object):
def __init__(self, actor: ClassNode, method_name: str, options: dict):
pass
def bind(self, *args, **kwargs):
pass
def __getattr__(self, attr: str):
pass
def options(self, **options):
pass | 5 | 0 | 8 | 0 | 7 | 1 | 1 | 0.1 | 1 | 5 | 2 | 0 | 4 | 3 | 4 | 4 | 37 | 4 | 30 | 10 | 25 | 3 | 17 | 10 | 12 | 2 | 1 | 1 | 5 |
9,890 | ray-project/ray | python/ray/dag/collective_node.py | ray.dag.collective_node.CollectiveOutputNode | from ray.dag import ClassMethodNode, DAGNode
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Union
from ray.dag.constants import COLLECTIVE_OPERATION_KEY, IS_CLASS_METHOD_OUTPUT_KEY
from ray.util.annotations import DeveloperAPI
@DeveloperAPI
class CollectiveOutputNode(ClassMethodNode):
"""Repre... | @DeveloperAPI
class CollectiveOutputNode(ClassMethodNode):
'''Represent an output node from a communicator collective operation in a Ray DAG.'''
def __init__(self, method_name: str, method_args: Tuple[DAGNode,], method_kwargs: Dict[str, Any], method_options: Dict[str, Any], other_args_to_resolve: Dict[str, Any... | 7 | 1 | 13 | 0 | 12 | 1 | 2 | 0.06 | 1 | 7 | 1 | 0 | 4 | 3 | 4 | 46 | 59 | 5 | 51 | 24 | 30 | 3 | 15 | 7 | 10 | 3 | 3 | 1 | 6 |
9,891 | ray-project/ray | python/ray/dag/collective_node.py | ray.dag.collective_node._CollectiveOperation | from ray.experimental.channel.torch_tensor_type import Communicator, TorchTensorType
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Union
from ray.experimental.channel import ChannelContext
from ray.dag import ClassMethodNode, DAGNode
from ray.experimental.util.types import AllGatherOp, AllReduceOp... |
class _CollectiveOperation:
'''
Represent metadata for a collective communicator collective operation.
Args:
inputs: A list of lists of DAGNode. Each nested list inside
of inputs should contain exactly one object per actor.
If multiple nested lists are provided, then the ord... | 10 | 2 | 12 | 1 | 11 | 1 | 3 | 0.22 | 0 | 11 | 6 | 0 | 6 | 3 | 6 | 6 | 95 | 11 | 69 | 25 | 54 | 15 | 45 | 18 | 37 | 10 | 0 | 2 | 18 |
9,892 | ray-project/ray | python/ray/dag/compiled_dag_node.py | ray.dag.compiled_dag_node.CompiledDAG | from ray.experimental.channel.shared_memory_channel import SharedMemoryType
from ray.dag.constants import RAY_CGRAPH_ENABLE_NVTX_PROFILING, RAY_CGRAPH_ENABLE_TORCH_PROFILING, RAY_CGRAPH_VISUALIZE_SCHEDULE
from ray.experimental.channel.communicator import Communicator
import ray.exceptions
from ray.experimental.channel.... | @DeveloperAPI
class CompiledDAG:
'''Experimental class for accelerated execution.
This class should not be called directly. Instead, create
a ray.dag and call experimental_compile().
See REP https://github.com/ray-project/enhancements/pull/48 for more
information.
'''
@ray.remote(num_cpus=0)... | 50 | 33 | 62 | 6 | 40 | 16 | 7 | 0.43 | 0 | 55 | 38 | 0 | 32 | 45 | 33 | 33 | 2,293 | 251 | 1,429 | 387 | 1,291 | 618 | 872 | 299 | 818 | 48 | 0 | 6 | 284 |
9,893 | ray-project/ray | python/ray/dag/compiled_dag_node.py | ray.dag.compiled_dag_node.CompiledTask | from ray.util.annotations import DeveloperAPI
from typing import Any, Dict, List, Optional, Set, Tuple, Union
from ray.experimental.channel import AwaitableBackgroundReader, AwaitableBackgroundWriter, ChannelContext, ChannelInterface, ChannelOutputType, CompiledDAGArgs, CompositeChannel, IntraProcessChannel, ReaderInte... | @DeveloperAPI
class CompiledTask:
'''Wraps the normal Ray DAGNode with some metadata.'''
def __init__(self, idx: int, dag_node: 'ray.dag.DAGNode'):
'''
Args:
idx: A unique index into the original DAG.
dag_node: The original DAG node created by the user.
'''
... | 12 | 2 | 8 | 0 | 4 | 4 | 1 | 0.85 | 0 | 4 | 1 | 0 | 6 | 7 | 6 | 6 | 57 | 7 | 27 | 18 | 16 | 23 | 19 | 14 | 12 | 1 | 0 | 0 | 6 |
9,894 | ray-project/ray | python/ray/dag/compiled_dag_node.py | ray.dag.compiled_dag_node.ExecutableTask | from ray.util.annotations import DeveloperAPI
from ray.experimental.channel import AwaitableBackgroundReader, AwaitableBackgroundWriter, ChannelContext, ChannelInterface, ChannelOutputType, CompiledDAGArgs, CompositeChannel, IntraProcessChannel, ReaderInterface, SynchronousReader, SynchronousWriter, WriterInterface
fro... | @DeveloperAPI
class ExecutableTask:
'''A task that can be executed in a compiled DAG, and it
corresponds to an actor method.
'''
def __init__(self, task: 'CompiledTask', resolved_args: List[Any], resolved_kwargs: Dict[str, Any]):
'''
Args:
task: The CompiledTask that this Ex... | 12 | 11 | 32 | 3 | 17 | 13 | 4 | 0.75 | 0 | 21 | 14 | 0 | 9 | 16 | 9 | 9 | 303 | 33 | 154 | 66 | 127 | 116 | 118 | 49 | 107 | 8 | 0 | 4 | 32 |
9,895 | ray-project/ray | python/ray/dag/compiled_dag_node.py | ray.dag.compiled_dag_node._ExecutableTaskInput | from typing import Any, Dict, List, Optional, Set, Tuple, Union
from ray.experimental.channel import AwaitableBackgroundReader, AwaitableBackgroundWriter, ChannelContext, ChannelInterface, ChannelOutputType, CompiledDAGArgs, CompositeChannel, IntraProcessChannel, ReaderInterface, SynchronousReader, SynchronousWriter, W... |
class _ExecutableTaskInput:
'''Represents an input to an ExecutableTask.
Args:
input_variant: either an unresolved input (when type is ChannelInterface)
, or a resolved input value (when type is Any)
channel_idx: if input_variant is an unresolved input, this is the index
... | 3 | 2 | 10 | 1 | 7 | 3 | 2 | 0.86 | 0 | 3 | 1 | 0 | 2 | 2 | 2 | 2 | 31 | 5 | 14 | 10 | 7 | 12 | 9 | 6 | 6 | 2 | 0 | 1 | 3 |
9,896 | ray-project/ray | python/ray/dag/compiled_dag_node.py | ray.dag.compiled_dag_node._ExecutableTaskRecord | from dataclasses import asdict, dataclass
@dataclass
class _ExecutableTaskRecord:
actor_classname: str
actor_name: str
actor_id: str
method_name: str
bind_index: int
operation: str
start_t: float
end_t: float
def to_dict(self):
return asdict(self) | @dataclass
class _ExecutableTaskRecord:
def to_dict(self):
pass | 3 | 0 | 2 | 0 | 2 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 12 | 1 | 11 | 2 | 9 | 0 | 11 | 2 | 9 | 1 | 0 | 0 | 1 |
9,897 | ray-project/ray | python/ray/dag/context.py | ray.dag.context.DAGContext | from dataclasses import dataclass
from ray.util.annotations import DeveloperAPI
@DeveloperAPI
@dataclass
class DAGContext:
"""Global settings for Ray DAG.
You can configure parameters in the DAGContext by setting the environment
variables, `RAY_CGRAPH_<param>` (e.g., `RAY_CGRAPH_buffer_size_bytes`) or Pyt... | @DeveloperAPI
@dataclass
class DAGContext:
'''Global settings for Ray DAG.
You can configure parameters in the DAGContext by setting the environment
variables, `RAY_CGRAPH_<param>` (e.g., `RAY_CGRAPH_buffer_size_bytes`) or Python.
Examples:
>>> from ray.dag import DAGContext
>>> DAGConte... | 6 | 2 | 10 | 2 | 7 | 2 | 2 | 1.77 | 0 | 1 | 0 | 0 | 1 | 0 | 2 | 2 | 70 | 9 | 22 | 12 | 17 | 39 | 17 | 11 | 13 | 2 | 0 | 2 | 4 |
9,898 | ray-project/ray | python/ray/dag/dag_node.py | ray.dag.dag_node.DAGNode | from ray.experimental.channel.auto_transport_type import AutoTransportType
from ray.experimental.channel import ChannelOutputType
from ray.experimental.util.types import Device
from itertools import chain
from ray.experimental.channel.torch_tensor_type import TorchTensorType
import ray
import asyncio
from ray.dag.base ... | @DeveloperAPI
class DAGNode(DAGNodeBase):
'''Abstract class for a node in a Ray task graph.
A node has a type (e.g., FunctionNode), data (e.g., function options and
body), arguments (Python values, DAGNodes, and DAGNodes nested within Python
argument values) and options (Ray API .options() used for func... | 36 | 25 | 19 | 2 | 11 | 6 | 3 | 0.61 | 1 | 20 | 8 | 7 | 28 | 12 | 28 | 28 | 608 | 81 | 328 | 128 | 248 | 199 | 198 | 84 | 162 | 10 | 1 | 4 | 78 |
9,899 | ray-project/ray | python/ray/dag/dag_node_operation.py | ray.dag.dag_node_operation._DAGNodeOperation | from typing import Dict, List, Optional, Set, Tuple
class _DAGNodeOperation:
def __init__(self, exec_task_idx: int, operation_type: _DAGNodeOperationType, method_name: Optional[str]=None):
"""
Args:
exec_task_idx: The index of the task that this operation belongs to
in ... |
class _DAGNodeOperation:
def __init__(self, exec_task_idx: int, operation_type: _DAGNodeOperationType, method_name: Optional[str]=None):
'''
Args:
exec_task_idx: The index of the task that this operation belongs to
in the actor's ExecutableTask list. The index is not th... | 6 | 2 | 7 | 0 | 4 | 3 | 1 | 0.68 | 0 | 3 | 1 | 0 | 5 | 3 | 5 | 5 | 41 | 4 | 22 | 14 | 11 | 15 | 13 | 9 | 7 | 1 | 0 | 0 | 5 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.