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,700 | ray-project/ray | python/ray/air/examples/custom_trainer.py | ray.air.examples.custom_trainer.MyPytorchTrainer | from ray.train.trainer import BaseTrainer
import torch
from ray import train
class MyPytorchTrainer(BaseTrainer):
def setup(self):
self.model = torch.nn.Linear(1, 1)
self.optimizer = torch.optim.SGD(self.model.parameters(), lr=0.1)
def training_loop(self):
dataset = self.datasets['tra... |
class MyPytorchTrainer(BaseTrainer):
def setup(self):
pass
def training_loop(self):
pass | 3 | 0 | 16 | 3 | 10 | 4 | 2 | 0.33 | 1 | 2 | 0 | 0 | 2 | 2 | 2 | 38 | 34 | 6 | 21 | 14 | 18 | 7 | 21 | 14 | 18 | 3 | 5 | 2 | 4 |
9,701 | ray-project/ray | python/ray/air/execution/_internal/actor_manager.py | ray.air.execution._internal.actor_manager.RayActorManager | from ray.exceptions import RayActorError, RayTaskError
from collections import Counter, defaultdict
from ray.air.execution._internal.event_manager import RayEventManager
from ray.air.execution.resources import AcquiredResources, ResourceManager, ResourceRequest
import uuid
import ray
from typing import Any, Callable, D... | null | 45 | 23 | 22 | 4 | 12 | 6 | 2 | 0.65 | 0 | 26 | 10 | 1 | 31 | 12 | 31 | 31 | 873 | 179 | 421 | 157 | 330 | 273 | 246 | 99 | 208 | 7 | 0 | 3 | 83 |
9,702 | ray-project/ray | python/ray/air/execution/_internal/barrier.py | ray.air.execution._internal.barrier.Barrier | from typing import Any, Callable, List, Optional, Tuple
class Barrier:
"""Barrier to collect results and process them in bulk.
A barrier can be used to collect multiple results and process them in bulk once
a certain count or a timeout is reached.
For instance, if ``max_results=N``, the ``on_completi... |
class Barrier:
'''Barrier to collect results and process them in bulk.
A barrier can be used to collect multiple results and process them in bulk once
a certain count or a timeout is reached.
For instance, if ``max_results=N``, the ``on_completion`` callback will be
invoked once :meth:`arrive` has ... | 10 | 6 | 8 | 1 | 4 | 3 | 2 | 1 | 0 | 3 | 0 | 0 | 7 | 4 | 7 | 7 | 90 | 22 | 34 | 19 | 19 | 34 | 27 | 12 | 19 | 4 | 0 | 2 | 11 |
9,703 | ray-project/ray | python/ray/air/execution/_internal/event_manager.py | ray.air.execution._internal.event_manager.RayEventManager | import random
import ray
from typing import Any, Callable, Dict, Iterable, Optional, Set, Tuple, Union
class RayEventManager:
"""Event manager for Ray futures.
The event manager can be used to track futures and invoke callbacks when
they resolve.
Futures are tracked with :meth:`track_future`. Future ... |
class RayEventManager:
'''Event manager for Ray futures.
The event manager can be used to track futures and invoke callbacks when
they resolve.
Futures are tracked with :meth:`track_future`. Future can then be awaited with
:meth:`wait`. When futures successfully resolve, they trigger an optional
... | 10 | 7 | 14 | 3 | 7 | 5 | 2 | 0.89 | 0 | 8 | 0 | 0 | 8 | 2 | 8 | 8 | 139 | 31 | 57 | 33 | 33 | 51 | 37 | 17 | 28 | 5 | 0 | 2 | 15 |
9,704 | ray-project/ray | python/ray/air/execution/_internal/tracked_actor.py | ray.air.execution._internal.tracked_actor.TrackedActor | from typing import Callable, Optional
class TrackedActor:
"""Actor tracked by an actor manager.
This object is used to reference a Ray actor on an actor manager
Existence of this object does not mean that the Ray actor has already been started.
Actor state can be inquired from the actor manager track... |
class TrackedActor:
'''Actor tracked by an actor manager.
This object is used to reference a Ray actor on an actor manager
Existence of this object does not mean that the Ray actor has already been started.
Actor state can be inquired from the actor manager tracking the Ray actor.
Note:
Obj... | 8 | 1 | 4 | 0 | 4 | 0 | 1 | 0.39 | 0 | 2 | 0 | 0 | 7 | 4 | 7 | 7 | 51 | 12 | 28 | 20 | 12 | 11 | 20 | 12 | 12 | 2 | 0 | 1 | 8 |
9,705 | ray-project/ray | python/ray/air/execution/_internal/tracked_actor_task.py | ray.air.execution._internal.tracked_actor_task.TrackedActorTask | from ray.air.execution._internal.tracked_actor import TrackedActor
from typing import Any, Callable, Optional
class TrackedActorTask:
"""Actor task tracked by a Ray event manager.
This container class is used to define callbacks to be invoked when
the task resolves, errors, or times out.
Note:
... |
class TrackedActorTask:
'''Actor task tracked by a Ray event manager.
This container class is used to define callbacks to be invoked when
the task resolves, errors, or times out.
Note:
Objects of this class are returned by the :class:`RayActorManager`.
This class should not be instantia... | 2 | 1 | 10 | 1 | 9 | 0 | 1 | 1.8 | 0 | 3 | 1 | 0 | 1 | 3 | 1 | 1 | 37 | 9 | 10 | 10 | 3 | 18 | 5 | 5 | 3 | 1 | 0 | 0 | 1 |
9,706 | ray-project/ray | python/ray/air/execution/resources/fixed.py | ray.air.execution.resources.fixed.FixedAcquiredResources | from ray.util.annotations import DeveloperAPI
from dataclasses import dataclass
from ray.air.execution.resources.request import AcquiredResources, RemoteRayEntity, ResourceRequest
from typing import Dict, List, Optional
@DeveloperAPI
@dataclass
class FixedAcquiredResources(AcquiredResources):
bundles: List[Dict[st... | @DeveloperAPI
@dataclass
class FixedAcquiredResources(AcquiredResources):
def _annotate_remote_entity(self, entity: RemoteRayEntity, bundle: Dict[str, float], bundle_index: int) -> RemoteRayEntity:
pass | 4 | 0 | 14 | 1 | 13 | 0 | 1 | 0 | 1 | 3 | 0 | 0 | 1 | 0 | 1 | 23 | 17 | 2 | 15 | 7 | 11 | 0 | 8 | 5 | 6 | 1 | 5 | 0 | 1 |
9,707 | ray-project/ray | python/ray/air/execution/resources/fixed.py | ray.air.execution.resources.fixed.FixedResourceManager | from typing import Dict, List, Optional
from ray.util.annotations import DeveloperAPI
from ray.air.execution.resources.request import AcquiredResources, RemoteRayEntity, ResourceRequest
from ray.air.execution.resources.resource_manager import ResourceManager
import ray
from ray import LOCAL_MODE, SCRIPT_MODE
@Develope... | @DeveloperAPI
class FixedResourceManager(ResourceManager):
'''Fixed budget based resource manager.
This resource manager keeps track of a fixed set of resources. When resources
are acquired, they are subtracted from the budget. When resources are freed,
they are added back to the budget.
The resourc... | 11 | 1 | 9 | 1 | 8 | 1 | 2 | 0.35 | 1 | 6 | 2 | 1 | 8 | 4 | 8 | 37 | 107 | 22 | 63 | 26 | 51 | 22 | 45 | 23 | 36 | 4 | 5 | 2 | 17 |
9,708 | ray-project/ray | python/ray/air/execution/resources/placement_group.py | ray.air.execution.resources.placement_group.PlacementGroupAcquiredResources | from ray.air.execution.resources.request import AcquiredResources, RemoteRayEntity, ResourceRequest
from ray.util.annotations import DeveloperAPI
from dataclasses import dataclass
from ray.util.scheduling_strategies import PlacementGroupSchedulingStrategy
from ray.util.placement_group import PlacementGroup, remove_plac... | @DeveloperAPI
@dataclass
class PlacementGroupAcquiredResources(AcquiredResources):
def _annotate_remote_entity(self, entity: RemoteRayEntity, bundle: Dict[str, float], bundle_index: int) -> RemoteRayEntity:
pass | 4 | 0 | 19 | 1 | 18 | 0 | 1 | 0 | 1 | 4 | 1 | 0 | 1 | 0 | 1 | 23 | 22 | 2 | 20 | 7 | 16 | 0 | 8 | 5 | 6 | 1 | 5 | 0 | 1 |
9,709 | ray-project/ray | python/ray/air/execution/resources/placement_group.py | ray.air.execution.resources.placement_group.PlacementGroupResourceManager | from collections import defaultdict
from ray.util.placement_group import PlacementGroup, remove_placement_group
from typing import Dict, List, Optional, Set
from ray.air.execution.resources.resource_manager import ResourceManager
from ray.air.execution.resources.request import AcquiredResources, RemoteRayEntity, Resour... | @DeveloperAPI
class PlacementGroupResourceManager(ResourceManager):
'''Resource manager using placement groups as the resource backend.
This manager will use placement groups to fulfill resource requests. Requesting
a resource will schedule the placement group. Acquiring a resource will
return a ``Place... | 13 | 1 | 12 | 2 | 8 | 3 | 2 | 0.53 | 1 | 9 | 3 | 0 | 11 | 8 | 11 | 40 | 170 | 35 | 88 | 39 | 74 | 47 | 73 | 37 | 61 | 7 | 5 | 2 | 23 |
9,710 | ray-project/ray | python/ray/air/execution/resources/request.py | ray.air.execution.resources.request.AcquiredResources | from ray.util.annotations import DeveloperAPI
from dataclasses import dataclass
from typing import Dict, List, Union
import abc
@DeveloperAPI
@dataclass
class AcquiredResources(abc.ABC):
"""Base class for resources that have been acquired.
Acquired resources can be associated to Ray objects, which can then be... | @DeveloperAPI
@dataclass
class AcquiredResources(abc.ABC):
'''Base class for resources that have been acquired.
Acquired resources can be associated to Ray objects, which can then be
scheduled using these resources.
Internally this can point e.g. to a placement group, a placement
group bundle index,... | 5 | 2 | 22 | 5 | 13 | 5 | 3 | 0.7 | 1 | 7 | 0 | 2 | 2 | 0 | 2 | 22 | 61 | 15 | 27 | 11 | 20 | 19 | 16 | 7 | 13 | 4 | 4 | 1 | 5 |
9,711 | ray-project/ray | python/ray/air/execution/resources/request.py | ray.air.execution.resources.request.ResourceRequest | from ray.util import placement_group
from inspect import signature
from copy import deepcopy
from typing import Dict, List, Union
from ray.util.annotations import DeveloperAPI
import json
@DeveloperAPI
class ResourceRequest:
"""Request for resources.
This class is used to define a resource request. A resource... | @DeveloperAPI
class ResourceRequest:
'''Request for resources.
This class is used to define a resource request. A resource request comprises one
or more bundles of resources and instructions on the scheduling behavior.
The resource request can be submitted to a resource manager, which will
schedule ... | 23 | 7 | 9 | 1 | 6 | 2 | 1 | 0.43 | 0 | 6 | 0 | 1 | 13 | 7 | 13 | 13 | 160 | 27 | 93 | 35 | 65 | 40 | 53 | 23 | 39 | 4 | 0 | 2 | 19 |
9,712 | ray-project/ray | python/ray/air/execution/resources/resource_manager.py | ray.air.execution.resources.resource_manager.ResourceManager | from ray.util.annotations import DeveloperAPI
from ray.air.execution.resources.request import AcquiredResources, ResourceRequest
from typing import List, Optional
import abc
import ray
@DeveloperAPI
class ResourceManager(abc.ABC):
"""Resource manager interface.
A resource manager can be used to request resour... | @DeveloperAPI
class ResourceManager(abc.ABC):
'''Resource manager interface.
A resource manager can be used to request resources from a Ray cluster and
allocate them to remote Ray tasks or actors.
Resources have to be requested before they can be acquired.
Resources managed by the resource manager c... | 11 | 10 | 9 | 1 | 2 | 5 | 1 | 3.78 | 1 | 6 | 2 | 2 | 9 | 0 | 9 | 29 | 146 | 36 | 23 | 12 | 11 | 87 | 19 | 10 | 9 | 1 | 4 | 0 | 9 |
9,713 | ray-project/ray | python/ray/air/integrations/comet.py | ray.air.integrations.comet.CometLoggerCallback | import pyarrow.fs
import os
from ray.tune.logger import LoggerCallback
from typing import Dict, List
from ray.tune.utils import flatten_dict
from pathlib import Path
class CometLoggerCallback(LoggerCallback):
"""CometLoggerCallback for logging Tune results to Comet.
Comet (https://comet.ml/site/) is a tool to... |
class CometLoggerCallback(LoggerCallback):
'''CometLoggerCallback for logging Tune results to Comet.
Comet (https://comet.ml/site/) is a tool to manage and optimize the
entire ML lifecycle, from experiment tracking, model optimization
and dataset versioning to model production monitoring.
This Ray ... | 9 | 5 | 19 | 3 | 13 | 3 | 4 | 0.6 | 1 | 6 | 0 | 0 | 8 | 9 | 8 | 58 | 232 | 52 | 114 | 54 | 97 | 68 | 95 | 48 | 84 | 11 | 6 | 5 | 29 |
9,714 | ray-project/ray | python/ray/air/integrations/keras.py | ray.air.integrations.keras.ReportCheckpointCallback | import ray
from ray.train.tensorflow import TensorflowCheckpoint
import shutil
from typing import Dict, List, Optional, Union
from ray.util.annotations import PublicAPI
@PublicAPI(stability='alpha')
class ReportCheckpointCallback(_Callback):
"""Keras callback for Ray Train reporting and checkpointing.
.. note... | @PublicAPI(stability='alpha')
class ReportCheckpointCallback(_Callback):
'''Keras callback for Ray Train reporting and checkpointing.
.. note::
Metrics are always reported with checkpoints, even if the event isn't specified
in ``report_metrics_on``.
Example:
.. code-block:: python
... | 5 | 1 | 15 | 2 | 13 | 0 | 3 | 0.68 | 1 | 6 | 0 | 0 | 3 | 3 | 3 | 19 | 81 | 14 | 40 | 17 | 31 | 27 | 29 | 12 | 25 | 5 | 2 | 1 | 10 |
9,715 | ray-project/ray | python/ray/air/integrations/keras.py | ray.air.integrations.keras._Callback | from tensorflow.keras.callbacks import Callback as KerasCallback
from typing import Dict, List, Optional, Union
class _Callback(KerasCallback):
"""Base class for Air's Keras callbacks."""
_allowed = ['epoch_begin', 'epoch_end', 'train_batch_begin', 'train_batch_end', 'test_batch_begin', 'test_batch_end', 'pred... |
class _Callback(KerasCallback):
'''Base class for Air's Keras callbacks.'''
def __init__(self, on: Union[str, List[str]]='validation_end'):
pass
def _handle(self, logs: Dict, when: str):
pass
def on_epoch_begin(self, epoch, logs=None):
pass
def on_epoch_end(self, epoch, ... | 17 | 1 | 4 | 0 | 3 | 0 | 2 | 0.01 | 1 | 5 | 0 | 1 | 16 | 1 | 16 | 16 | 91 | 18 | 72 | 19 | 55 | 1 | 53 | 19 | 36 | 3 | 1 | 1 | 32 |
9,716 | ray-project/ray | python/ray/air/integrations/mlflow.py | ray.air.integrations.mlflow.MLflowLoggerCallback | from ray.tune.logger import LoggerCallback
from typing import Dict, Optional, Union
import ray
from ray.tune.result import TIMESTEPS_TOTAL
from ray.air.constants import TRAINING_ITERATION
from ray.air._internal.mlflow import _MLflowLoggerUtil
class MLflowLoggerCallback(LoggerCallback):
"""MLflow Logger to automati... |
class MLflowLoggerCallback(LoggerCallback):
'''MLflow Logger to automatically log Tune results and config to MLflow.
MLflow (https://mlflow.org) Tracking is an open source library for
recording and querying experiments. This Ray Tune ``LoggerCallback``
sends information (config parameters, training res... | 6 | 1 | 15 | 2 | 11 | 1 | 2 | 0.93 | 1 | 4 | 1 | 0 | 5 | 8 | 5 | 55 | 133 | 25 | 56 | 31 | 41 | 52 | 35 | 22 | 29 | 3 | 6 | 1 | 10 |
9,717 | ray-project/ray | python/ray/air/integrations/mlflow.py | ray.air.integrations.mlflow._NoopModule | class _NoopModule:
def __getattr__(self, item):
return _NoopModule()
def __call__(self, *args, **kwargs):
return None | class _NoopModule:
def __getattr__(self, item):
pass
def __call__(self, *args, **kwargs):
pass | 3 | 0 | 2 | 0 | 2 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 2 | 2 | 6 | 1 | 5 | 3 | 2 | 0 | 5 | 3 | 2 | 1 | 0 | 0 | 2 |
9,718 | ray-project/ray | python/ray/air/integrations/wandb.py | ray.air.integrations.wandb.WandbLoggerCallback | from ray.tune.logger import LoggerCallback
import pyarrow.fs
from ray.util import PublicAPI
from ray.train._internal.syncer import DEFAULT_SYNC_TIMEOUT
from ray.air.util.node import _force_on_current_node
from typing import Any, Dict, List, Optional, Sequence, Tuple, Union
import ray
import os
import warnings
from ray.... | @PublicAPI(stability='alpha')
class WandbLoggerCallback(LoggerCallback):
'''WandbLoggerCallback
Weights and biases (https://www.wandb.ai/) is a tool for experiment
tracking, model optimization, and dataset versioning. This Ray Tune
``LoggerCallback`` sends metrics to Wandb for automatic tracking and
... | 14 | 3 | 17 | 2 | 13 | 2 | 3 | 0.46 | 1 | 12 | 4 | 1 | 12 | 15 | 12 | 62 | 298 | 53 | 168 | 62 | 141 | 78 | 104 | 48 | 91 | 5 | 6 | 2 | 33 |
9,719 | ray-project/ray | python/ray/air/integrations/wandb.py | ray.air.integrations.wandb._QueueItem | import enum
class _QueueItem(enum.Enum):
END = enum.auto()
RESULT = enum.auto()
CHECKPOINT = enum.auto() |
class _QueueItem(enum.Enum):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 49 | 4 | 0 | 4 | 4 | 3 | 0 | 4 | 4 | 3 | 0 | 4 | 0 | 0 |
9,720 | ray-project/ray | python/ray/air/integrations/wandb.py | ray.air.integrations.wandb._WandbLoggingActor | from ray.tune.utils import flatten_dict
import os
from typing import Any, Dict, List, Optional, Sequence, Tuple, Union
import urllib
from ray.util.queue import Queue
from ray import logger
from ray.air.constants import TRAINING_ITERATION
class _WandbLoggingActor:
"""
Wandb assumes that each trial's information... |
class _WandbLoggingActor:
'''
Wandb assumes that each trial's information should be logged from a
separate process. We use Ray actors as forking multiprocessing
processes is not supported by Ray and spawn processes run into pickling
problems.
We use a queue for the driver to communicate with th... | 5 | 1 | 18 | 2 | 15 | 1 | 3 | 0.25 | 0 | 4 | 2 | 1 | 4 | 8 | 4 | 4 | 90 | 15 | 61 | 31 | 47 | 15 | 48 | 22 | 42 | 5 | 0 | 2 | 12 |
9,721 | ray-project/ray | python/ray/air/result.py | ray.air.result.Result | from dataclasses import dataclass
from ray.air.constants import EXPR_ERROR_PICKLE_FILE, EXPR_PROGRESS_FILE, EXPR_RESULT_FILE
import os
import ray
from ray.util.annotations import PublicAPI
import json
import pyarrow
from typing import Any, Dict, List, Optional, Tuple, Union
import io
from pathlib import Path
import pan... | @dataclass
@PublicAPI(stability='stable')
class Result:
'''The final result of a ML training run or a Tune trial.
This is the output produced by ``Trainer.fit``.
``Tuner.fit`` outputs a :class:`~ray.tune.ResultGrid` that is a collection
of ``Result`` objects.
This API is the recommended way to acces... | 15 | 7 | 29 | 4 | 19 | 6 | 3 | 0.46 | 0 | 12 | 1 | 1 | 5 | 0 | 7 | 7 | 256 | 37 | 150 | 58 | 121 | 69 | 82 | 40 | 69 | 11 | 0 | 3 | 24 |
9,722 | ray-project/ray | python/ray/air/util/check_ingest.py | ray.air.util.check_ingest.DummyTrainer | from ray.util.annotations import DeveloperAPI
from ray.air.config import ScalingConfig
import sys
from ray.train.data_parallel_trainer import DataParallelTrainer
from typing import Optional
import time
import numpy as np
from ray import train
@DeveloperAPI
class DummyTrainer(DataParallelTrainer):
"""A Trainer that... | @DeveloperAPI
class DummyTrainer(DataParallelTrainer):
'''A Trainer that does nothing except read the data for a given number of epochs.
It prints out as much debugging statistics as possible.
This is useful for debugging data ingest problem. This trainer supports normal
scaling options same as any othe... | 6 | 2 | 49 | 3 | 44 | 2 | 4 | 0.19 | 1 | 5 | 1 | 0 | 1 | 0 | 2 | 51 | 107 | 11 | 81 | 29 | 63 | 15 | 39 | 16 | 34 | 8 | 6 | 4 | 11 |
9,723 | ray-project/ray | python/ray/air/util/data_batch_conversion.py | ray.air.util.data_batch_conversion.BatchFormat | from enum import Enum
from ray.util.annotations import Deprecated, DeveloperAPI
@DeveloperAPI
class BatchFormat(str, Enum):
PANDAS = 'pandas'
ARROW = 'arrow'
NUMPY = 'numpy' | @DeveloperAPI
class BatchFormat(str, Enum):
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 115 | 5 | 0 | 4 | 4 | 3 | 2 | 4 | 4 | 3 | 0 | 4 | 0 | 0 |
9,724 | ray-project/ray | python/ray/air/util/data_batch_conversion.py | ray.air.util.data_batch_conversion.BlockFormat | from enum import Enum
from ray.util.annotations import Deprecated, DeveloperAPI
@DeveloperAPI
class BlockFormat(str, Enum):
"""Internal Dataset block format enum."""
PANDAS = 'pandas'
ARROW = 'arrow'
SIMPLE = 'simple' | @DeveloperAPI
class BlockFormat(str, Enum):
'''Internal Dataset block format enum.'''
pass | 2 | 1 | 0 | 0 | 0 | 0 | 0 | 0.25 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 115 | 6 | 1 | 4 | 4 | 3 | 1 | 4 | 4 | 3 | 0 | 4 | 0 | 0 |
9,725 | ray-project/ray | python/ray/air/util/object_extensions/arrow.py | ray.air.util.object_extensions.arrow.ArrowPythonObjectArray | import numpy as np
from ray.util.annotations import PublicAPI
import typing
import pyarrow as pa
from ray._common.serialization import pickle_dumps
@PublicAPI(stability='alpha')
class ArrowPythonObjectArray(pa.ExtensionArray):
"""Array class for ArrowPythonObjectType"""
def from_objects(objects: typing.Union[... | @PublicAPI(stability='alpha')
class ArrowPythonObjectArray(pa.ExtensionArray):
'''Array class for ArrowPythonObjectType'''
def from_objects(objects: typing.Union[np.ndarray, typing.Iterable[typing.Any]]) -> 'ArrowPythonObjectArray':
pass
def to_numpy(self, zero_copy_only: bool=False, writable: boo... | 4 | 1 | 10 | 0 | 10 | 0 | 2 | 0.05 | 0 | 4 | 1 | 0 | 2 | 0 | 2 | 2 | 24 | 2 | 21 | 13 | 14 | 1 | 15 | 9 | 12 | 3 | 0 | 1 | 4 |
9,726 | ray-project/ray | python/ray/air/util/object_extensions/arrow.py | ray.air.util.object_extensions.arrow.ArrowPythonObjectScalar | from ray.util.annotations import PublicAPI
import pyarrow as pa
import typing
import pickle
@PublicAPI(stability='alpha')
class ArrowPythonObjectScalar(pa.ExtensionScalar):
"""Scalar class for ArrowPythonObjectType"""
def as_py(self, **kwargs) -> typing.Any:
if self.value is None:
return N... | @PublicAPI(stability='alpha')
class ArrowPythonObjectScalar(pa.ExtensionScalar):
'''Scalar class for ArrowPythonObjectType'''
def as_py(self, **kwargs) -> typing.Any:
pass | 3 | 1 | 6 | 0 | 6 | 0 | 2 | 0.14 | 0 | 3 | 0 | 0 | 1 | 0 | 1 | 1 | 9 | 1 | 7 | 2 | 5 | 1 | 5 | 2 | 3 | 2 | 0 | 1 | 2 |
9,727 | ray-project/ray | python/ray/air/util/object_extensions/arrow.py | ray.air.util.object_extensions.arrow.ArrowPythonObjectType | import pyarrow as pa
import ray.air.util.object_extensions.pandas
from ray.util.annotations import PublicAPI
@PublicAPI(stability='alpha')
class ArrowPythonObjectType(pa.ExtensionType):
"""Defines a new Arrow extension type for Python objects.
We do not require a parametrized type, so the constructor does not
... | @PublicAPI(stability='alpha')
class ArrowPythonObjectType(pa.ExtensionType):
'''Defines a new Arrow extension type for Python objects.
We do not require a parametrized type, so the constructor does not
take any arguments
'''
def __init__(self) -> None:
pass
def __arrow_ext_serialize__(... | 11 | 4 | 5 | 0 | 3 | 2 | 1 | 0.86 | 0 | 6 | 3 | 0 | 6 | 0 | 7 | 7 | 46 | 7 | 21 | 11 | 10 | 18 | 15 | 8 | 7 | 1 | 0 | 0 | 7 |
9,728 | ray-project/ray | python/ray/air/util/object_extensions/pandas.py | ray.air.util.object_extensions.pandas.PythonObjectArray | from pandas._typing import ArrayLike, Dtype, PositionalIndexer, TakeIndexer, npt
import ray.air.util.object_extensions.arrow
from pandas._libs import lib
import collections.abc
import numpy as np
import pandas as pd
from ray.util.annotations import PublicAPI
import typing
@PublicAPI(stability='alpha')
class PythonObje... | @PublicAPI(stability='alpha')
class PythonObjectArray(pd.api.extensions.ExtensionArray):
'''Implements the Pandas extension array interface for the Arrow object array'''
def __init__(self, values: collections.abc.Iterable[typing.Any]):
pass
@classmethod
def _from_sequence(cls, scalars: collecti... | 22 | 1 | 5 | 0 | 5 | 0 | 1 | 0.01 | 1 | 9 | 2 | 0 | 12 | 1 | 15 | 15 | 94 | 16 | 77 | 47 | 35 | 1 | 45 | 21 | 29 | 3 | 1 | 1 | 20 |
9,729 | ray-project/ray | python/ray/air/util/object_extensions/pandas.py | ray.air.util.object_extensions.pandas.PythonObjectDtype | from ray.util.annotations import PublicAPI
import pyarrow as pa
import typing
import pandas as pd
@PublicAPI(stability='alpha')
@pd.api.extensions.register_extension_dtype
class PythonObjectDtype(pd.api.extensions.ExtensionDtype):
@classmethod
def construct_from_string(cls, string: str):
if string != ... | @PublicAPI(stability='alpha')
@pd.api.extensions.register_extension_dtype
class PythonObjectDtype(pd.api.extensions.ExtensionDtype):
@classmethod
def construct_from_string(cls, string: str):
pass
@property
def type(self):
'''
The scalar type for the array, e.g. ``int``
I... | 12 | 2 | 5 | 0 | 3 | 2 | 1 | 0.53 | 1 | 5 | 1 | 0 | 3 | 0 | 5 | 5 | 33 | 4 | 19 | 12 | 7 | 10 | 13 | 6 | 7 | 2 | 1 | 1 | 6 |
9,730 | ray-project/ray | python/ray/air/util/tensor_extensions/arrow.py | ray.air.util.tensor_extensions.arrow.ArrowConversionError | from ray.util.annotations import DeveloperAPI, PublicAPI
@DeveloperAPI
class ArrowConversionError(Exception):
"""Error raised when there is an issue converting data to Arrow."""
MAX_DATA_STR_LEN = 200
def __init__(self, data_str: str):
if len(data_str) > self.MAX_DATA_STR_LEN:
data_str... | @DeveloperAPI
class ArrowConversionError(Exception):
'''Error raised when there is an issue converting data to Arrow.'''
def __init__(self, data_str: str):
pass | 3 | 1 | 5 | 0 | 5 | 0 | 2 | 0.14 | 1 | 2 | 0 | 0 | 1 | 0 | 1 | 11 | 10 | 2 | 7 | 4 | 5 | 1 | 7 | 4 | 5 | 2 | 3 | 1 | 2 |
9,731 | ray-project/ray | python/ray/air/util/tensor_extensions/arrow.py | ray.air.util.tensor_extensions.arrow.ArrowTensorArray | from typing import Any, Dict, Iterable, List, Optional, Sequence, Tuple, Union
import sys
from ray.air.util.tensor_extensions.utils import ArrayLike, _is_ndarray_variable_shaped_tensor, _should_convert_to_tensor, create_ragged_ndarray
from ray.util.annotations import DeveloperAPI, PublicAPI
import pyarrow as pa
import ... | @PublicAPI(stability='beta')
class ArrowTensorArray(_ArrowTensorScalarIndexingMixin, pa.ExtensionArray):
'''
An array of fixed-shape, homogeneous-typed tensors.
This is the Arrow side of TensorArray.
See Arrow docs for customizing extension arrays:
https://arrow.apache.org/docs/python/extending_type... | 13 | 7 | 39 | 3 | 21 | 15 | 4 | 0.74 | 1 | 16 | 6 | 0 | 3 | 0 | 7 | 11 | 292 | 27 | 152 | 63 | 125 | 113 | 97 | 42 | 88 | 9 | 1 | 3 | 30 |
9,732 | ray-project/ray | python/ray/air/util/tensor_extensions/arrow.py | ray.air.util.tensor_extensions.arrow.ArrowTensorType | import numpy as np
from typing import Any, Dict, Iterable, List, Optional, Sequence, Tuple, Union
from ray.util.annotations import DeveloperAPI, PublicAPI
import pyarrow as pa
@PublicAPI(stability='beta')
class ArrowTensorType(_BaseFixedShapeArrowTensorType):
"""Arrow ExtensionType (v1) for tensors.
NOTE: Thi... | @PublicAPI(stability='beta')
class ArrowTensorType(_BaseFixedShapeArrowTensorType):
'''Arrow ExtensionType (v1) for tensors.
NOTE: This type does *NOT* support tensors larger than 4Gb (due to
overflow of int32 offsets utilized inside Pyarrow `ListType`)
'''
def __init__(self, shape: Tuple[int... | 6 | 2 | 7 | 1 | 3 | 3 | 1 | 1.25 | 1 | 3 | 0 | 0 | 1 | 0 | 2 | 34 | 24 | 6 | 8 | 6 | 4 | 10 | 7 | 5 | 4 | 1 | 5 | 0 | 2 |
9,733 | ray-project/ray | python/ray/air/util/tensor_extensions/arrow.py | ray.air.util.tensor_extensions.arrow.ArrowTensorTypeV2 | from ray.util.annotations import DeveloperAPI, PublicAPI
import numpy as np
from typing import Any, Dict, Iterable, List, Optional, Sequence, Tuple, Union
import pyarrow as pa
@PublicAPI(stability='alpha')
class ArrowTensorTypeV2(_BaseFixedShapeArrowTensorType):
"""Arrow ExtensionType (v2) for tensors (supporting ... | @PublicAPI(stability='alpha')
class ArrowTensorTypeV2(_BaseFixedShapeArrowTensorType):
'''Arrow ExtensionType (v2) for tensors (supporting tensors > 4Gb).'''
def __init__(self, shape: Tuple[int, ...], dtype: pa.DataType):
'''
Construct the Arrow extension type for array of fixed-shaped tensors.... | 6 | 2 | 7 | 1 | 3 | 3 | 1 | 0.88 | 1 | 3 | 0 | 0 | 1 | 0 | 2 | 34 | 20 | 5 | 8 | 6 | 4 | 7 | 7 | 5 | 4 | 1 | 5 | 0 | 2 |
9,734 | ray-project/ray | python/ray/air/util/tensor_extensions/arrow.py | ray.air.util.tensor_extensions.arrow.ArrowVariableShapedTensorArray | import pyarrow as pa
import numpy as np
import sys
from ray.air.util.tensor_extensions.utils import ArrayLike, _is_ndarray_variable_shaped_tensor, _should_convert_to_tensor, create_ragged_ndarray
from typing import Any, Dict, Iterable, List, Optional, Sequence, Tuple, Union
from ray.util.annotations import DeveloperAPI... | @PublicAPI(stability='alpha')
class ArrowVariableShapedTensorArray(_ArrowTensorScalarIndexingMixin, pa.ExtensionArray):
'''
An array of heterogeneous-shaped, homogeneous-typed tensors.
This is the Arrow side of TensorArray for tensor elements that have differing
shapes. Note that this extension only sup... | 6 | 4 | 49 | 3 | 23 | 23 | 4 | 1.05 | 1 | 8 | 1 | 0 | 2 | 0 | 3 | 7 | 165 | 13 | 74 | 31 | 65 | 78 | 53 | 26 | 49 | 9 | 1 | 2 | 12 |
9,735 | ray-project/ray | python/ray/air/util/tensor_extensions/arrow.py | ray.air.util.tensor_extensions.arrow.ArrowVariableShapedTensorType | import json
from ray.util.annotations import DeveloperAPI, PublicAPI
import ray.cloudpickle as cloudpickle
import pyarrow as pa
import numpy as np
@PublicAPI(stability='alpha')
class ArrowVariableShapedTensorType(pa.ExtensionType):
"""
Arrow ExtensionType for an array of heterogeneous-shaped, homogeneous-typed... | @PublicAPI(stability='alpha')
class ArrowVariableShapedTensorType(pa.ExtensionType):
'''
Arrow ExtensionType for an array of heterogeneous-shaped, homogeneous-typed
tensors.
This is the Arrow side of TensorDtype for tensor elements with different shapes.
Note that this extension only supports non-ra... | 18 | 8 | 7 | 0 | 4 | 2 | 1 | 0.67 | 0 | 7 | 3 | 0 | 11 | 1 | 12 | 12 | 111 | 19 | 55 | 30 | 36 | 37 | 39 | 25 | 25 | 1 | 0 | 1 | 12 |
9,736 | ray-project/ray | python/ray/air/util/tensor_extensions/arrow.py | ray.air.util.tensor_extensions.arrow._ArrowTensorScalarIndexingMixin | class _ArrowTensorScalarIndexingMixin:
"""
A mixin providing support for scalar indexing in tensor extension arrays for
Arrow < 9.0.0, before full ExtensionScalar support was added. This mixin overrides
__getitem__, __iter__, and to_pylist.
"""
if not _arrow_extension_scalars_are_subclassable():... | class _ArrowTensorScalarIndexingMixin:
'''
A mixin providing support for scalar indexing in tensor extension arrays for
Arrow < 9.0.0, before full ExtensionScalar support was added. This mixin overrides
__getitem__, __iter__, and to_pylist.
'''
def __iter__(self):
pass
... | 4 | 1 | 10 | 1 | 4 | 6 | 2 | 2 | 0 | 4 | 0 | 2 | 4 | 0 | 4 | 4 | 60 | 6 | 18 | 7 | 13 | 36 | 17 | 7 | 12 | 2 | 0 | 2 | 7 |
9,737 | ray-project/ray | python/ray/air/util/tensor_extensions/arrow.py | ray.air.util.tensor_extensions.arrow._BaseFixedShapeArrowTensorType | import json
from typing import Any, Dict, Iterable, List, Optional, Sequence, Tuple, Union
import pyarrow as pa
import ray.cloudpickle as cloudpickle
import abc
import numpy as np
class _BaseFixedShapeArrowTensorType(pa.ExtensionType, abc.ABC):
"""
Arrow ExtensionType for an array of fixed-shaped, homogeneous-... |
class _BaseFixedShapeArrowTensorType(pa.ExtensionType, abc.ABC):
'''
Arrow ExtensionType for an array of fixed-shaped, homogeneous-typed
tensors.
This is the Arrow side of TensorDtype.
See Arrow extension type docs:
https://arrow.apache.org/docs/python/extending_types.html#defining-extension-ty... | 17 | 8 | 9 | 1 | 5 | 3 | 1 | 0.73 | 1 | 9 | 4 | 2 | 11 | 1 | 12 | 32 | 134 | 20 | 66 | 36 | 38 | 48 | 43 | 22 | 29 | 5 | 4 | 2 | 16 |
9,738 | ray-project/ray | python/ray/air/util/tensor_extensions/pandas.py | ray.air.util.tensor_extensions.pandas.TensorArray | import numbers
from pandas._typing import Dtype
from pandas.core.dtypes.generic import ABCDataFrame, ABCSeries
from pandas.core.indexers import check_array_indexer, validate_indices
from typing import Any, Callable, List, Optional, Sequence, Tuple, Union
import pandas as pd
from ray.air.util.tensor_extensions.utils imp... | @PublicAPI(stability='beta')
class TensorArray(pd.api.extensions.ExtensionArray, _TensorOpsMixin, _TensorScalarCastMixin):
'''
Pandas `ExtensionArray` representing a tensor column, i.e. a column
consisting of ndarrays as elements.
This extension supports tensors in which the elements have different shap... | 43 | 27 | 22 | 2 | 9 | 11 | 3 | 1.42 | 3 | 21 | 4 | 0 | 27 | 2 | 30 | 38 | 804 | 96 | 293 | 97 | 221 | 416 | 184 | 57 | 152 | 10 | 2 | 3 | 88 |
9,739 | ray-project/ray | python/ray/air/util/tensor_extensions/pandas.py | ray.air.util.tensor_extensions.pandas.TensorArrayElement | import numpy as np
from ray.util.annotations import PublicAPI
@PublicAPI(stability='beta')
class TensorArrayElement(_TensorOpsMixin, _TensorScalarCastMixin):
"""
Single element of a TensorArray, wrapping an underlying ndarray.
"""
def __init__(self, values: np.ndarray):
"""
Construct a... | @PublicAPI(stability='beta')
class TensorArrayElement(_TensorOpsMixin, _TensorScalarCastMixin):
'''
Single element of a TensorArray, wrapping an underlying ndarray.
'''
def __init__(self, values: np.ndarray):
'''
Construct a TensorArrayElement from a NumPy ndarray.
Args:
... | 15 | 7 | 5 | 0 | 2 | 3 | 1 | 1.17 | 2 | 0 | 0 | 0 | 9 | 1 | 9 | 17 | 60 | 10 | 23 | 15 | 9 | 27 | 19 | 11 | 9 | 1 | 2 | 0 | 9 |
9,740 | ray-project/ray | python/ray/air/util/tensor_extensions/pandas.py | ray.air.util.tensor_extensions.pandas.TensorDtype | from ray.util.annotations import PublicAPI
import pandas as pd
import pyarrow as pa
from typing import Any, Callable, List, Optional, Sequence, Tuple, Union
import numpy as np
@PublicAPI(stability='beta')
@pd.api.extensions.register_extension_dtype
class TensorDtype(pd.api.extensions.ExtensionDtype):
"""
Panda... | @PublicAPI(stability='beta')
@pd.api.extensions.register_extension_dtype
class TensorDtype(pd.api.extensions.ExtensionDtype):
'''
Pandas extension type for a column of homogeneous-typed tensors.
This extension supports tensors in which the elements have different shapes.
However, each tensor element mus... | 23 | 10 | 14 | 1 | 5 | 7 | 1 | 2.72 | 1 | 6 | 2 | 0 | 10 | 2 | 12 | 12 | 284 | 31 | 68 | 33 | 44 | 185 | 48 | 25 | 32 | 4 | 1 | 2 | 17 |
9,741 | ray-project/ray | python/ray/air/util/tensor_extensions/pandas.py | ray.air.util.tensor_extensions.pandas._TensorOpsMixin | import numpy as np
import pandas as pd
from pandas.compat import set_function_name
from pandas.core.dtypes.generic import ABCDataFrame, ABCSeries
class _TensorOpsMixin(pd.api.extensions.ExtensionScalarOpsMixin):
"""
Mixin for TensorArray operator support, applying operations on the
underlying ndarrays.
... |
class _TensorOpsMixin(pd.api.extensions.ExtensionScalarOpsMixin):
'''
Mixin for TensorArray operator support, applying operations on the
underlying ndarrays.
'''
@classmethod
def _create_method(cls, op, coerce_to_dtype=True, result_dtype=None):
'''
Add support for binary operato... | 6 | 2 | 24 | 5 | 14 | 5 | 2 | 0.58 | 1 | 3 | 2 | 2 | 0 | 0 | 2 | 2 | 52 | 11 | 26 | 11 | 20 | 15 | 20 | 9 | 16 | 5 | 1 | 1 | 7 |
9,742 | ray-project/ray | python/ray/air/util/tensor_extensions/pandas.py | ray.air.util.tensor_extensions.pandas._TensorScalarCastMixin | from typing import Any, Callable, List, Optional, Sequence, Tuple, Union
class _TensorScalarCastMixin:
"""
Mixin for casting scalar tensors to a particular numeric type.
"""
def _scalarfunc(self, func: Callable[[Any], Any]):
return func(self._tensor)
def __complex__(self):
return ... |
class _TensorScalarCastMixin:
'''
Mixin for casting scalar tensors to a particular numeric type.
'''
def _scalarfunc(self, func: Callable[[Any], Any]):
pass
def __complex__(self):
pass
def __float__(self):
pass
def __int__(self):
pass
def __hex__(sel... | 7 | 1 | 2 | 0 | 2 | 0 | 1 | 0.23 | 0 | 4 | 0 | 2 | 6 | 0 | 6 | 6 | 22 | 6 | 13 | 7 | 6 | 3 | 13 | 7 | 6 | 1 | 0 | 0 | 6 |
9,743 | ray-project/ray | python/ray/air/util/torch_dist.py | ray.air.util.torch_dist.TorchDistributedWorker | from abc import ABC
from typing import Callable, List, T
class TorchDistributedWorker(ABC):
"""Defines the interfaces required by the init_torch_dist_process_group().
This is modeled after RayTrainerWorker, which allows arbitrary functions
to be executed on a remote DDP worker.
"""
def execute(se... |
class TorchDistributedWorker(ABC):
'''Defines the interfaces required by the init_torch_dist_process_group().
This is modeled after RayTrainerWorker, which allows arbitrary functions
to be executed on a remote DDP worker.
'''
def execute(self, func: Callable[..., T], *args, **kwargs) -> T:
... | 2 | 2 | 8 | 1 | 2 | 5 | 1 | 3 | 1 | 0 | 0 | 2 | 1 | 0 | 1 | 21 | 15 | 3 | 3 | 2 | 1 | 9 | 3 | 2 | 1 | 1 | 4 | 0 | 1 |
9,744 | ray-project/ray | python/ray/autoscaler/_private/_azure/node_provider.py | ray.autoscaler._private._azure.node_provider.AzureNodeProvider | from azure.mgmt.network import NetworkManagementClient
from ray.autoscaler._private.constants import AUTOSCALER_NODE_START_WAIT_S, AUTOSCALER_NODE_TERMINATE_WAIT_S, MAX_PARALLEL_SHUTDOWN_WORKERS
from azure.mgmt.resource import ResourceManagementClient
from azure.mgmt.compute import ComputeManagementClient
from ray.auto... |
class AzureNodeProvider(NodeProvider):
'''Node Provider for Azure
This provider assumes Azure credentials are set by running ``az login``
and the default subscription is configured through ``az account``
or set in the ``provider`` field of the autoscaler configuration.
Nodes may be in one of three ... | 23 | 11 | 21 | 2 | 17 | 3 | 3 | 0.2 | 1 | 7 | 0 | 0 | 17 | 8 | 18 | 39 | 435 | 55 | 317 | 93 | 294 | 64 | 185 | 85 | 165 | 23 | 1 | 7 | 53 |
9,745 | ray-project/ray | python/ray/autoscaler/_private/aliyun/node_provider.py | ray.autoscaler._private.aliyun.node_provider.AliyunNodeProvider | from ray.autoscaler._private.aliyun.config import PENDING, RUNNING, STOPPED, STOPPING, bootstrap_aliyun
from ray.autoscaler.tags import TAG_RAY_CLUSTER_NAME, TAG_RAY_LAUNCH_CONFIG, TAG_RAY_NODE_KIND, TAG_RAY_NODE_NAME, TAG_RAY_NODE_STATUS, TAG_RAY_USER_NODE_TYPE
from collections import defaultdict
from ray.autoscaler._... |
class AliyunNodeProvider(NodeProvider):
def __init__(self, provider_config, cluster_name):
pass
def non_terminated_nodes(self, tag_filters: Dict[str, str]) -> List[str]:
pass
def is_running(self, node_id: str) -> bool:
pass
def is_terminated(self, node_id: str) -> bool:
... | 18 | 2 | 17 | 1 | 15 | 1 | 3 | 0.06 | 1 | 9 | 2 | 0 | 15 | 11 | 16 | 37 | 290 | 36 | 241 | 67 | 221 | 14 | 172 | 64 | 155 | 11 | 1 | 6 | 53 |
9,746 | ray-project/ray | python/ray/autoscaler/_private/aliyun/utils.py | ray.autoscaler._private.aliyun.utils.AcsClient | from aliyunsdkecs.request.v20140526.StartInstanceRequest import StartInstanceRequest
from aliyunsdkecs.request.v20140526.DescribeKeyPairsRequest import DescribeKeyPairsRequest
from aliyunsdkcore import client
from aliyunsdkecs.request.v20140526.StopInstancesRequest import StopInstancesRequest
from aliyunsdkecs.request.... |
class AcsClient:
'''
A wrapper around Aliyun SDK. We use this wrapper in aliyun node provider.
Parameters:
access_key: The AccessKey ID of your aliyun account.
access_key_secret: The AccessKey secret of your aliyun account.
region_id: A region is a geographic area where a data cente... | 24 | 23 | 17 | 1 | 10 | 6 | 2 | 0.61 | 0 | 0 | 0 | 0 | 23 | 1 | 23 | 23 | 419 | 48 | 230 | 96 | 179 | 141 | 192 | 68 | 168 | 4 | 0 | 1 | 45 |
9,747 | ray-project/ray | python/ray/autoscaler/_private/autoscaler.py | ray.autoscaler._private.autoscaler.AutoscalerSummary | from ray.autoscaler._private.util import ConcurrentCounter, NodeCount, NodeID, NodeIP, NodeType, NodeTypeConfigDict, format_info_string, hash_launch_conf, hash_runtime_conf, validate_config, with_head_node_ip
from typing import Any, Callable, Dict, FrozenSet, List, Optional, Set, Tuple, Union
from ray.autoscaler._priva... | @dataclass
class AutoscalerSummary:
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0.38 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 18 | 0 | 13 | 6 | 12 | 5 | 11 | 6 | 10 | 0 | 0 | 0 | 0 |
9,748 | ray-project/ray | python/ray/autoscaler/_private/autoscaler.py | ray.autoscaler._private.autoscaler.NonTerminatedNodes | from ray.autoscaler.node_provider import NodeProvider
from ray.autoscaler.tags import NODE_KIND_HEAD, NODE_KIND_UNMANAGED, NODE_KIND_WORKER, STATUS_UP_TO_DATE, STATUS_UPDATE_FAILED, TAG_RAY_FILE_MOUNTS_CONTENTS, TAG_RAY_LAUNCH_CONFIG, TAG_RAY_NODE_KIND, TAG_RAY_NODE_STATUS, TAG_RAY_RUNTIME_CONFIG, TAG_RAY_USER_NODE_TYP... |
class NonTerminatedNodes:
'''Class to extract and organize information on non-terminated nodes.'''
def __init__(self, provider: NodeProvider):
pass
def remove_terminating_nodes(self, terminating_nodes: List[NodeID]) -> None:
'''Remove nodes we're in the process of terminating from interna... | 4 | 2 | 14 | 2 | 8 | 4 | 2 | 0.59 | 0 | 3 | 1 | 0 | 2 | 4 | 2 | 2 | 43 | 8 | 22 | 11 | 18 | 13 | 18 | 11 | 14 | 4 | 0 | 2 | 6 |
9,749 | ray-project/ray | python/ray/autoscaler/_private/autoscaler.py | ray.autoscaler._private.autoscaler.StandardAutoscaler | from ray.autoscaler._private.prom_metrics import AutoscalerPrometheusMetrics
import time
from ray._common.utils import PLACEMENT_GROUP_BUNDLE_RESOURCE_NAME
from ray.autoscaler._private.util import ConcurrentCounter, NodeCount, NodeID, NodeIP, NodeType, NodeTypeConfigDict, format_info_string, hash_launch_conf, hash_runt... |
class StandardAutoscaler:
'''The autoscaling control loop for a Ray cluster.
There are two ways to start an autoscaling cluster: manually by running
`ray start --head --autoscaling-config=/path/to/config.yaml` on a instance
that has permission to launch other instances, or you can also use `ray up
... | 40 | 15 | 34 | 3 | 25 | 7 | 4 | 0.31 | 0 | 31 | 14 | 1 | 35 | 33 | 35 | 35 | 1,338 | 143 | 916 | 246 | 846 | 285 | 560 | 209 | 521 | 12 | 0 | 4 | 165 |
9,750 | ray-project/ray | python/ray/autoscaler/_private/aws/cloudwatch/cloudwatch_helper.py | ray.autoscaler._private.aws.cloudwatch.cloudwatch_helper.CloudwatchConfigType | from enum import Enum
class CloudwatchConfigType(str, Enum):
AGENT = 'agent'
DASHBOARD = 'dashboard'
ALARM = 'alarm' |
class CloudwatchConfigType(str, Enum):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 115 | 4 | 0 | 4 | 4 | 3 | 0 | 4 | 4 | 3 | 0 | 4 | 0 | 0 |
9,751 | ray-project/ray | python/ray/autoscaler/_private/aws/cloudwatch/cloudwatch_helper.py | ray.autoscaler._private.aws.cloudwatch.cloudwatch_helper.CloudwatchHelper | from ray.autoscaler.tags import NODE_KIND_HEAD, TAG_RAY_CLUSTER_NAME, TAG_RAY_NODE_KIND
import os
import botocore
from typing import Any, Callable, Dict, List, Union
import copy
import logging
import json
import hashlib
from ray.autoscaler._private.aws.utils import client_cache, resource_cache
import time
class Cloudw... |
class CloudwatchHelper:
def __init__(self, provider_config: Dict[str, Any], node_id: str, cluster_name: str) -> None:
pass
def update_from_config(self, is_head_node: bool) -> None:
'''Discovers and applies CloudWatch config updates as required.
Args:
is_head_node: whether ... | 43 | 27 | 20 | 0 | 16 | 3 | 2 | 0.17 | 0 | 9 | 1 | 0 | 34 | 10 | 38 | 38 | 791 | 55 | 629 | 195 | 558 | 107 | 314 | 157 | 275 | 8 | 0 | 4 | 82 |
9,752 | ray-project/ray | python/ray/autoscaler/_private/aws/node_provider.py | ray.autoscaler._private.aws.node_provider.AWSNodeProvider | from ray.autoscaler.node_launch_exception import NodeLaunchException
import ray._private.ray_constants as ray_constants
from ray.autoscaler._private.constants import BOTO_CREATE_MAX_RETRIES, BOTO_MAX_RETRIES
from ray.autoscaler._private.aws.cloudwatch.cloudwatch_helper import CLOUDWATCH_AGENT_INSTALLED_AMI_TAG, CLOUDWA... |
class AWSNodeProvider(NodeProvider):
def __init__(self, provider_config, cluster_name):
pass
def non_terminated_nodes(self, tag_filters):
pass
def is_running(self, node_id):
pass
def is_terminated(self, node_id):
pass
def node_tags(self, node_id):
pass
... | 24 | 5 | 28 | 3 | 22 | 4 | 4 | 0.17 | 1 | 13 | 3 | 0 | 17 | 11 | 20 | 41 | 595 | 74 | 449 | 117 | 421 | 75 | 266 | 109 | 245 | 11 | 1 | 5 | 78 |
9,753 | ray-project/ray | python/ray/autoscaler/_private/aws/utils.py | ray.autoscaler._private.aws.utils.LazyDefaultDict | from collections import defaultdict
class LazyDefaultDict(defaultdict):
"""
LazyDefaultDict(default_factory[, ...]) --> dict with default factory
The default factory is call with the key argument to produce
a new value when a key is not present, in __getitem__ only.
A LazyDefaultDict compares equa... |
class LazyDefaultDict(defaultdict):
'''
LazyDefaultDict(default_factory[, ...]) --> dict with default factory
The default factory is call with the key argument to produce
a new value when a key is not present, in __getitem__ only.
A LazyDefaultDict compares equal to a dict with the same items.
... | 2 | 2 | 9 | 0 | 3 | 6 | 1 | 3.5 | 1 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 20 | 2 | 4 | 2 | 2 | 14 | 4 | 2 | 2 | 1 | 1 | 0 | 1 |
9,754 | ray-project/ray | python/ray/autoscaler/_private/cli_logger.py | ray.autoscaler._private.cli_logger.SilentClickException | import click
class SilentClickException(click.ClickException):
"""`ClickException` that does not print a message.
Some of our tooling relies on catching ClickException in particular.
However the default prints a message, which is undesirable since we expect
our code to log errors manually using `cli_... |
class SilentClickException(click.ClickException):
'''`ClickException` that does not print a message.
Some of our tooling relies on catching ClickException in particular.
However the default prints a message, which is undesirable since we expect
our code to log errors manually using `cli_logger.error()`... | 3 | 1 | 2 | 0 | 2 | 0 | 1 | 1.2 | 0 | 2 | 0 | 0 | 2 | 0 | 2 | 2 | 15 | 4 | 5 | 3 | 2 | 6 | 5 | 3 | 2 | 1 | 0 | 0 | 2 |
9,755 | ray-project/ray | python/ray/autoscaler/_private/cli_logger.py | ray.autoscaler._private.cli_logger._CliLogger | import sys
import click
import logging
import time
from typing import Any, Callable, Dict, List, Optional, Tuple
class _CliLogger:
"""Singleton class for CLI logging.
Without calling 'cli_logger.configure', the CLILogger will default
to 'record' style logging.
Attributes:
color_mode (str):
... |
class _CliLogger:
'''Singleton class for CLI logging.
Without calling 'cli_logger.configure', the CLILogger will default
to 'record' style logging.
Attributes:
color_mode (str):
Can be "true", "false", or "auto".
Enables or disables `colorful`.
If `color_mode... | 44 | 23 | 12 | 2 | 8 | 3 | 2 | 0.42 | 0 | 12 | 3 | 0 | 34 | 6 | 34 | 34 | 532 | 103 | 303 | 104 | 234 | 126 | 243 | 77 | 201 | 20 | 0 | 7 | 88 |
9,756 | ray-project/ray | python/ray/autoscaler/_private/cli_logger.py | ray.autoscaler._private.cli_logger._ColorfulMock | from contextlib import contextmanager
class _ColorfulMock:
def __init__(self):
self.identity = lambda x: x
self.colorful = self
self.colormode = None
self.NO_COLORS = None
self.ANSI_8_COLORS = None
def disable(self):
pass
@contextmanager
def with_style... |
class _ColorfulMock:
def __init__(self):
pass
def disable(self):
pass
@contextmanager
def with_style(self, x):
pass
class IdentityClass:
def __getattr__(self, name):
pass
def __getattr__(self, name):
... | 8 | 0 | 5 | 1 | 4 | 0 | 1 | 0.05 | 0 | 1 | 1 | 0 | 4 | 5 | 4 | 4 | 27 | 7 | 19 | 13 | 11 | 1 | 18 | 12 | 11 | 2 | 0 | 1 | 6 |
9,757 | ray-project/ray | python/ray/autoscaler/_private/cli_logger.py | ray.autoscaler._private.cli_logger._ColorfulProxy | class _ColorfulProxy:
_proxy_allowlist = ['disable', 'reset', 'bold', 'italic', 'underlined', 'dimmed', 'dodgerBlue', 'limeGreen', 'red', 'orange', 'skyBlue', 'magenta', 'yellow']
def __getattr__(self, name):
res = getattr(_cf, name)
if callable(res) and name not in _ColorfulProxy._proxy_allowl... | class _ColorfulProxy:
def __getattr__(self, name):
pass | 2 | 0 | 9 | 0 | 9 | 0 | 2 | 0.36 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 1 | 28 | 1 | 25 | 4 | 23 | 9 | 7 | 4 | 5 | 2 | 0 | 1 | 2 |
9,758 | ray-project/ray | python/ray/autoscaler/_private/cluster_dump.py | ray.autoscaler._private.cluster_dump.Archive | from contextlib import contextmanager
import tarfile
import os
import tempfile
import threading
from typing import List, Optional, Sequence, Tuple
class Archive:
"""Archive object to collect and compress files into a single file.
Objects of this class can be passed around to different data collection
func... |
class Archive:
'''Archive object to collect and compress files into a single file.
Objects of this class can be passed around to different data collection
functions. These functions can use the :meth:`subdir` method to add
files to a sub directory of the archive.
'''
def __init__(self, file: O... | 13 | 2 | 7 | 1 | 4 | 2 | 1 | 0.7 | 0 | 3 | 1 | 0 | 7 | 3 | 7 | 7 | 68 | 17 | 30 | 16 | 17 | 21 | 27 | 13 | 17 | 1 | 0 | 0 | 8 |
9,759 | ray-project/ray | python/ray/autoscaler/_private/cluster_dump.py | ray.autoscaler._private.cluster_dump.CommandFailed | class CommandFailed(RuntimeError):
pass | class CommandFailed(RuntimeError):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 | 0 | 0 | 0 | 11 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 4 | 0 | 0 |
9,760 | ray-project/ray | python/ray/autoscaler/_private/cluster_dump.py | ray.autoscaler._private.cluster_dump.GetParameters | from typing import List, Optional, Sequence, Tuple
class GetParameters:
def __init__(self, logs: bool=True, debug_state: bool=True, pip: bool=True, processes: bool=True, processes_verbose: bool=True, processes_list: Optional[List[Tuple[str, bool]]]=None):
self.logs = logs
self.debug_state = debug_... |
class GetParameters:
def __init__(self, logs: bool=True, debug_state: bool=True, pip: bool=True, processes: bool=True, processes_verbose: bool=True, processes_list: Optional[List[Tuple[str, bool]]]=None):
pass | 2 | 0 | 15 | 0 | 15 | 0 | 1 | 0 | 0 | 2 | 0 | 0 | 1 | 6 | 1 | 1 | 16 | 0 | 16 | 16 | 6 | 0 | 8 | 8 | 6 | 1 | 0 | 0 | 1 |
9,761 | ray-project/ray | python/ray/autoscaler/_private/cluster_dump.py | ray.autoscaler._private.cluster_dump.LocalCommandFailed | class LocalCommandFailed(CommandFailed):
pass | class LocalCommandFailed(CommandFailed):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 11 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 5 | 0 | 0 |
9,762 | ray-project/ray | python/ray/autoscaler/_private/cluster_dump.py | ray.autoscaler._private.cluster_dump.Node | from typing import List, Optional, Sequence, Tuple
class Node:
"""Node (as in "machine")"""
def __init__(self, host: str, ssh_user: str='ubuntu', ssh_key: str='~/ray_bootstrap_key.pem', docker_container: Optional[str]=None, is_head: bool=False):
self.host = host
self.ssh_user = ssh_user
... |
class Node:
'''Node (as in "machine")'''
def __init__(self, host: str, ssh_user: str='ubuntu', ssh_key: str='~/ray_bootstrap_key.pem', docker_container: Optional[str]=None, is_head: bool=False):
pass | 2 | 1 | 13 | 0 | 13 | 0 | 1 | 0.07 | 0 | 2 | 0 | 0 | 1 | 5 | 1 | 1 | 16 | 1 | 14 | 14 | 5 | 1 | 7 | 7 | 5 | 1 | 0 | 0 | 1 |
9,763 | ray-project/ray | python/ray/autoscaler/_private/cluster_dump.py | ray.autoscaler._private.cluster_dump.RemoteCommandFailed | class RemoteCommandFailed(CommandFailed):
pass | class RemoteCommandFailed(CommandFailed):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 11 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 5 | 0 | 0 |
9,764 | ray-project/ray | python/ray/autoscaler/_private/command_runner.py | ray.autoscaler._private.command_runner.DockerCommandRunner | import sys
from ray.autoscaler._private.cli_logger import cf, cli_logger
from ray.autoscaler._private.constants import AUTOSCALER_NODE_SSH_INTERVAL_S, AUTOSCALER_NODE_START_WAIT_S, DEFAULT_OBJECT_STORE_MEMORY_PROPORTION
from ray._private.ray_constants import DEFAULT_OBJECT_STORE_MAX_MEMORY_BYTES
from typing import Dict... |
class DockerCommandRunner(CommandRunnerInterface):
def __init__(self, docker_config, **common_args):
pass
def run(self, cmd: Optional[str]=None, timeout: int=120, exit_on_fail: bool=False, port_forward: Optional[List[Tuple[int, int]]]=None, with_output: bool=False, environment_variables: Optional[Dic... | 14 | 1 | 36 | 2 | 32 | 2 | 4 | 0.08 | 1 | 7 | 1 | 1 | 13 | 6 | 13 | 18 | 478 | 35 | 411 | 83 | 381 | 32 | 169 | 65 | 154 | 16 | 1 | 4 | 56 |
9,765 | ray-project/ray | python/ray/autoscaler/_private/command_runner.py | ray.autoscaler._private.command_runner.SSHCommandRunner | import click
import time
import hashlib
import subprocess
from ray.autoscaler._private.constants import AUTOSCALER_NODE_SSH_INTERVAL_S, AUTOSCALER_NODE_START_WAIT_S, DEFAULT_OBJECT_STORE_MEMORY_PROPORTION
from ray.autoscaler.command_runner import CommandRunnerInterface
from typing import Dict, List, Optional, Tuple
fro... |
class SSHCommandRunner(CommandRunnerInterface):
def __init__(self, log_prefix, node_id, provider, auth_config, cluster_name, process_runner, use_internal_ip):
pass
def _get_node_ip(self):
pass
def _wait_for_ip(self, deadline):
pass
def _set_ssh_ip_if_required(self):
... | 11 | 1 | 27 | 2 | 22 | 3 | 3 | 0.15 | 1 | 9 | 3 | 1 | 10 | 12 | 10 | 15 | 283 | 32 | 221 | 68 | 187 | 34 | 130 | 42 | 119 | 12 | 1 | 3 | 33 |
9,766 | ray-project/ray | python/ray/autoscaler/_private/command_runner.py | ray.autoscaler._private.command_runner.SSHOptions | import os
import sys
class SSHOptions:
def __init__(self, ssh_key, control_path=None, **kwargs):
self.ssh_key = ssh_key
self.arg_dict = {'StrictHostKeyChecking': 'no', 'UserKnownHostsFile': os.devnull, 'IdentitiesOnly': 'yes', 'ExitOnForwardFailure': 'yes', 'ServerAliveInterval': 5, 'ServerAliveCo... |
class SSHOptions:
def __init__(self, ssh_key, control_path=None, **kwargs):
pass
def to_ssh_options_list(self, *, timeout=60):
pass | 3 | 0 | 21 | 0 | 16 | 6 | 2 | 0.34 | 0 | 0 | 0 | 0 | 2 | 2 | 2 | 2 | 44 | 1 | 32 | 7 | 29 | 11 | 11 | 6 | 8 | 2 | 0 | 1 | 4 |
9,767 | ray-project/ray | python/ray/autoscaler/_private/event_summarizer.py | ray.autoscaler._private.event_summarizer.EventSummarizer | import time
from threading import RLock
from typing import Any, Callable, Dict, List
class EventSummarizer:
"""Utility that aggregates related log messages to reduce log spam."""
def __init__(self):
self.events_by_key: Dict[str, int] = {}
self.messages_to_send: List[str] = []
self.thro... |
class EventSummarizer:
'''Utility that aggregates related log messages to reduce log spam.'''
def __init__(self):
pass
def add(self, template: str, *, quantity: Any, aggregate: Callable[[Any, Any], Any]) -> None:
'''Add a log message, which will be combined by template.
Args:
... | 6 | 5 | 13 | 1 | 7 | 5 | 2 | 0.68 | 0 | 5 | 0 | 0 | 5 | 4 | 5 | 5 | 70 | 8 | 37 | 15 | 29 | 25 | 32 | 13 | 26 | 3 | 0 | 3 | 11 |
9,768 | ray-project/ray | python/ray/autoscaler/_private/event_system.py | ray.autoscaler._private.event_system.CreateClusterEvent | from enum import Enum, auto
class CreateClusterEvent(Enum):
"""Events to track in ray.autoscaler.sdk.create_or_update_cluster.
Attributes:
up_started : Invoked at the beginning of create_or_update_cluster.
ssh_keypair_downloaded : Invoked when the ssh keypair is downloaded.
cluster_boo... |
class CreateClusterEvent(Enum):
'''Events to track in ray.autoscaler.sdk.create_or_update_cluster.
Attributes:
up_started : Invoked at the beginning of create_or_update_cluster.
ssh_keypair_downloaded : Invoked when the ssh keypair is downloaded.
cluster_booting_started : Invoked when w... | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 1.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 49 | 32 | 2 | 12 | 12 | 11 | 18 | 12 | 12 | 11 | 0 | 4 | 0 | 0 |
9,769 | ray-project/ray | python/ray/autoscaler/_private/event_system.py | ray.autoscaler._private.event_system._EventSystem | from ray.autoscaler._private.cli_logger import cli_logger
from typing import Any, Callable, Dict, List, Optional, Union
class _EventSystem:
"""Event system that handles storing and calling callbacks for events.
Attributes:
callback_map (Dict[str, List[Callable]]) : Stores list of callbacks
... |
class _EventSystem:
'''Event system that handles storing and calling callbacks for events.
Attributes:
callback_map (Dict[str, List[Callable]]) : Stores list of callbacks
for events when registered.
'''
def __init__(self):
pass
def add_callback_handler(self, event: str... | 5 | 4 | 13 | 1 | 7 | 5 | 3 | 0.89 | 0 | 5 | 1 | 0 | 4 | 1 | 4 | 4 | 63 | 10 | 28 | 13 | 17 | 25 | 17 | 7 | 12 | 4 | 0 | 2 | 10 |
9,770 | ray-project/ray | python/ray/autoscaler/_private/fake_multi_node/command_runner.py | ray.autoscaler._private.fake_multi_node.command_runner.FakeDockerCommandRunner | from ray.autoscaler.command_runner import CommandRunnerInterface
from ray.autoscaler._private.docker import with_docker_exec
from typing import Dict, List, Tuple
import subprocess
import os
class FakeDockerCommandRunner(CommandRunnerInterface):
"""Command runner for the fke docker multinode cluster.
This comm... |
class FakeDockerCommandRunner(CommandRunnerInterface):
'''Command runner for the fke docker multinode cluster.
This command runner uses ``docker exec`` and ``docker cp`` to
run commands and copy files, respectively.
The regular ``DockerCommandRunner`` is made for use in SSH settings
where Docker ru... | 9 | 1 | 8 | 1 | 7 | 0 | 2 | 0.13 | 1 | 4 | 0 | 0 | 8 | 5 | 8 | 13 | 83 | 15 | 60 | 32 | 38 | 8 | 33 | 19 | 24 | 5 | 1 | 2 | 13 |
9,771 | ray-project/ray | python/ray/autoscaler/_private/fake_multi_node/node_provider.py | ray.autoscaler._private.fake_multi_node.node_provider.FakeMultiNodeDockerProvider | from typing import Any, Dict, Optional
import time
import subprocess
from ray.autoscaler.command_runner import CommandRunnerInterface
import os
import ray._private.ray_constants as ray_constants
from types import ModuleType
import yaml
from ray.autoscaler._private.fake_multi_node.command_runner import FakeDockerCommand... |
class FakeMultiNodeDockerProvider(FakeMultiNodeProvider):
'''A node provider that implements multi-node on a single machine.
This is used for laptop mode testing of multi node functionality
where each node has their own FS and IP.'''
def __init__(self, provider_config, cluster_name):
pass
... | 24 | 1 | 13 | 1 | 11 | 1 | 2 | 0.06 | 1 | 12 | 2 | 0 | 20 | 19 | 21 | 59 | 301 | 53 | 234 | 78 | 195 | 14 | 145 | 57 | 123 | 6 | 2 | 3 | 43 |
9,772 | ray-project/ray | python/ray/autoscaler/_private/fake_multi_node/node_provider.py | ray.autoscaler._private.fake_multi_node.node_provider.FakeMultiNodeProvider | import os
import json
import ray
import ray._private.ray_constants as ray_constants
from ray.autoscaler.node_provider import NodeProvider
import copy
from ray._common.network_utils import build_address
from ray.autoscaler.tags import NODE_KIND_HEAD, NODE_KIND_WORKER, STATUS_UP_TO_DATE, TAG_RAY_NODE_KIND, TAG_RAY_NODE_N... |
class FakeMultiNodeProvider(NodeProvider):
'''A node provider that implements multi-node on a single machine.
This is used for laptop mode testing of autoscaling functionality.'''
def __init__(self, provider_config, cluster_name):
'''
Args:
provider_config: Configuration for th... | 19 | 4 | 10 | 0 | 8 | 1 | 2 | 0.15 | 1 | 6 | 1 | 2 | 16 | 8 | 17 | 38 | 189 | 25 | 142 | 49 | 115 | 22 | 80 | 39 | 62 | 5 | 1 | 4 | 29 |
9,773 | ray-project/ray | python/ray/autoscaler/_private/gcp/node.py | ray.autoscaler._private.gcp.node.GCPCompute | from copy import deepcopy
import time
import httplib2
from typing import Any, Dict, List, Optional, Tuple, Union
import re
from ray.autoscaler.tags import TAG_RAY_CLUSTER_NAME, TAG_RAY_NODE_NAME
from google_auth_httplib2 import AuthorizedHttp
class GCPCompute(GCPResource):
"""Abstraction around GCP compute resourc... |
class GCPCompute(GCPResource):
'''Abstraction around GCP compute resource'''
def get_new_authorized_http(self, http: AuthorizedHttp) -> AuthorizedHttp:
'''Generate a new AuthorizedHttp object with the given credentials.'''
pass
def wait_for_operation(self, operation: dict, max_polls: int=... | 11 | 4 | 28 | 3 | 22 | 3 | 2 | 0.14 | 1 | 9 | 2 | 0 | 10 | 2 | 10 | 41 | 294 | 42 | 222 | 59 | 196 | 31 | 80 | 42 | 69 | 4 | 4 | 2 | 23 |
9,774 | ray-project/ray | python/ray/autoscaler/_private/gcp/node.py | ray.autoscaler._private.gcp.node.GCPComputeNode | class GCPComputeNode(GCPNode):
"""Abstraction around compute nodes"""
NON_TERMINATED_STATUSES = {'PROVISIONING', 'STAGING', 'RUNNING'}
TERMINATED_STATUSES = {'TERMINATED', 'SUSPENDED'}
RUNNING_STATUSES = {'RUNNING'}
STATUS_FIELD = 'status'
def get_labels(self) -> dict:
return self.get('... | class GCPComputeNode(GCPNode):
'''Abstraction around compute nodes'''
def get_labels(self) -> dict:
pass
def get_external_ip(self) -> str:
pass
def get_internal_ip(self) -> str:
pass | 4 | 1 | 3 | 0 | 3 | 0 | 1 | 0.13 | 1 | 2 | 0 | 0 | 3 | 0 | 3 | 65 | 21 | 4 | 15 | 8 | 11 | 2 | 11 | 8 | 7 | 1 | 9 | 0 | 3 |
9,775 | ray-project/ray | python/ray/autoscaler/_private/gcp/node.py | ray.autoscaler._private.gcp.node.GCPNode | import abc
from collections import UserDict
class GCPNode(UserDict, metaclass=abc.ABCMeta):
"""Abstraction around compute and tpu nodes"""
NON_TERMINATED_STATUSES = None
RUNNING_STATUSES = None
STATUS_FIELD = None
def __init__(self, base_dict: dict, resource: 'GCPResource', **kwargs) -> None:
... |
class GCPNode(UserDict, metaclass=abc.ABCMeta):
'''Abstraction around compute and tpu nodes'''
def __init__(self, base_dict: dict, resource: 'GCPResource', **kwargs) -> None:
pass
def is_running(self) -> bool:
pass
def is_terminated(self) -> bool:
pass
@abc.abstractmethod... | 11 | 1 | 2 | 0 | 2 | 0 | 1 | 0.04 | 2 | 5 | 1 | 2 | 7 | 1 | 7 | 62 | 32 | 8 | 23 | 15 | 12 | 1 | 20 | 12 | 12 | 1 | 8 | 0 | 7 |
9,776 | ray-project/ray | python/ray/autoscaler/_private/gcp/node.py | ray.autoscaler._private.gcp.node.GCPNodeType | from enum import Enum
class GCPNodeType(Enum):
"""Enum for GCP node types (compute & tpu)"""
COMPUTE = 'compute'
TPU = 'tpu'
@staticmethod
def from_gcp_node(node: 'GCPNode'):
"""Return GCPNodeType based on ``node``'s class"""
if isinstance(node, GCPTPUNode):
return GCPN... |
class GCPNodeType(Enum):
'''Enum for GCP node types (compute & tpu)'''
@staticmethod
def from_gcp_node(node: 'GCPNode'):
'''Return GCPNodeType based on ``node``'s class'''
pass
@staticmethod
def name_to_type(name: str):
'''Provided a node name, determine the type.
Th... | 5 | 3 | 7 | 1 | 4 | 3 | 2 | 0.46 | 1 | 5 | 2 | 0 | 0 | 0 | 2 | 51 | 23 | 4 | 13 | 7 | 8 | 6 | 11 | 5 | 8 | 3 | 4 | 1 | 4 |
9,777 | ray-project/ray | python/ray/autoscaler/_private/gcp/node.py | ray.autoscaler._private.gcp.node.GCPResource | import abc
from google_auth_httplib2 import AuthorizedHttp
from googleapiclient.discovery import Resource
from typing import Any, Dict, List, Optional, Tuple, Union
class GCPResource(metaclass=abc.ABCMeta):
"""Abstraction around compute and TPU resources"""
def __init__(self, resource: Resource, project_id: s... |
class GCPResource(metaclass=abc.ABCMeta):
'''Abstraction around compute and TPU resources'''
def __init__(self, resource: Resource, project_id: str, availability_zone: str, cluster_name: str) -> None:
pass
@abc.abstractmethod
def get_new_authorized_http(self, http: AuthorizedHttp) -> Authorize... | 21 | 11 | 8 | 1 | 6 | 2 | 1 | 0.28 | 1 | 6 | 1 | 2 | 11 | 4 | 11 | 31 | 108 | 17 | 71 | 53 | 25 | 20 | 30 | 18 | 18 | 2 | 3 | 1 | 12 |
9,778 | ray-project/ray | python/ray/autoscaler/_private/gcp/node.py | ray.autoscaler._private.gcp.node.GCPTPU | import httplib2
from typing import Any, Dict, List, Optional, Tuple, Union
from google_auth_httplib2 import AuthorizedHttp
import time
from googleapiclient.errors import HttpError
from ray.autoscaler.tags import TAG_RAY_CLUSTER_NAME, TAG_RAY_NODE_NAME
class GCPTPU(GCPResource):
"""Abstraction around GCP TPU resour... |
class GCPTPU(GCPResource):
'''Abstraction around GCP TPU resource'''
@property
def path(self):
pass
def get_new_authorized_http(self, http: AuthorizedHttp) -> AuthorizedHttp:
'''Generate a new AuthorizedHttp object with the given credentials.'''
pass
def wait_for_operation... | 14 | 3 | 20 | 3 | 16 | 1 | 2 | 0.1 | 1 | 10 | 2 | 0 | 10 | 0 | 10 | 41 | 227 | 39 | 171 | 49 | 144 | 17 | 83 | 34 | 71 | 6 | 4 | 3 | 27 |
9,779 | ray-project/ray | python/ray/autoscaler/_private/gcp/node.py | ray.autoscaler._private.gcp.node.GCPTPUNode | from typing import Any, Dict, List, Optional, Tuple, Union
class GCPTPUNode(GCPNode):
"""Abstraction around tpu nodes"""
NON_TERMINATED_STATUSES = {'CREATING', 'STARTING', 'RESTARTING', 'READY'}
RUNNING_STATUSES = {'READY'}
STATUS_FIELD = 'state'
def get_labels(self) -> dict:
return self.g... |
class GCPTPUNode(GCPNode):
'''Abstraction around tpu nodes'''
def get_labels(self) -> dict:
pass
@property
def num_workers(self) -> int:
pass
def get_external_ips(self) -> List[str]:
pass
def get_external_ips(self) -> List[str]:
pass
def get_internal_ips(... | 8 | 1 | 3 | 0 | 3 | 0 | 1 | 0.1 | 1 | 3 | 0 | 0 | 6 | 0 | 6 | 68 | 31 | 8 | 21 | 11 | 13 | 2 | 16 | 10 | 9 | 1 | 9 | 0 | 6 |
9,780 | ray-project/ray | python/ray/autoscaler/_private/gcp/node_provider.py | ray.autoscaler._private.gcp.node_provider.GCPNodeProvider | import googleapiclient
from ray.autoscaler.command_runner import CommandRunnerInterface
import copy
from ray.autoscaler._private.gcp.node import GCPTPU, GCPCompute, GCPNode, GCPNodeType, GCPResource
from threading import RLock
from ray.autoscaler._private.gcp.tpu_command_runner import TPUCommandRunner
from types import... |
class GCPNodeProvider(NodeProvider):
def __init__(self, provider_config: dict, cluster_name: str):
pass
def _construct_clients(self):
pass
def _get_resource_depending_on_node_name(self, node_name: str) -> GCPResource:
'''Return the resource responsible for the node, based on node... | 26 | 4 | 15 | 2 | 11 | 2 | 2 | 0.15 | 1 | 13 | 7 | 0 | 16 | 4 | 18 | 39 | 288 | 45 | 213 | 82 | 176 | 32 | 141 | 62 | 122 | 7 | 1 | 4 | 40 |
9,781 | ray-project/ray | python/ray/autoscaler/_private/gcp/tpu_command_runner.py | ray.autoscaler._private.gcp.tpu_command_runner.TPUCommandRunner | from concurrent.futures import ThreadPoolExecutor
from ray._private import ray_constants
from ray.autoscaler.command_runner import CommandRunnerInterface
from types import ModuleType
from ray.autoscaler._private.gcp.node import GCPTPUNode
from ray.autoscaler.node_provider import NodeProvider
from typing import Any, Dic... |
class TPUCommandRunner(CommandRunnerInterface):
'''A TPU pod command runner.'''
def __init__(self, instance: GCPTPUNode, log_prefix: str, node_id: str, auth_config: Dict[str, Any], provider: NodeProvider, cluster_name: str, process_runner: ModuleType, use_internal_ip: bool, docker_config: Optional[Dict[str, A... | 10 | 6 | 20 | 1 | 15 | 4 | 1 | 0.34 | 1 | 11 | 4 | 0 | 7 | 2 | 7 | 12 | 149 | 15 | 101 | 45 | 67 | 34 | 30 | 16 | 21 | 2 | 1 | 1 | 10 |
9,782 | ray-project/ray | python/ray/autoscaler/_private/gcp/tpu_command_runner.py | ray.autoscaler._private.gcp.tpu_command_runner.TPUVMDockerCommandRunner | from typing import Any, Dict, Optional
from ray.autoscaler._private.command_runner import DockerCommandRunner, SSHCommandRunner
class TPUVMDockerCommandRunner(DockerCommandRunner):
"""A Docker command runner with overwritten IP addresses."""
def __init__(self, docker_config: Dict[str, Any], internal_ip: str, ... |
class TPUVMDockerCommandRunner(DockerCommandRunner):
'''A Docker command runner with overwritten IP addresses.'''
def __init__(self, docker_config: Dict[str, Any], internal_ip: str, external_ip: str, worker_id: int, accelerator_type: str, **common_args):
pass
def run(self, cmd, timeout=120, exit_... | 3 | 1 | 24 | 1 | 23 | 0 | 2 | 0.02 | 1 | 6 | 1 | 0 | 2 | 3 | 2 | 20 | 51 | 3 | 47 | 25 | 25 | 1 | 10 | 6 | 7 | 2 | 2 | 1 | 3 |
9,783 | ray-project/ray | python/ray/autoscaler/_private/gcp/tpu_command_runner.py | ray.autoscaler._private.gcp.tpu_command_runner.TPUVMSSHCommandRunner | from ray.autoscaler._private.command_runner import DockerCommandRunner, SSHCommandRunner
from typing import Any, Dict, Optional
class TPUVMSSHCommandRunner(SSHCommandRunner):
"""An SSH command runner with overwritten IP address calls."""
def __init__(self, internal_ip: str, external_ip: str, worker_id: int, a... |
class TPUVMSSHCommandRunner(SSHCommandRunner):
'''An SSH command runner with overwritten IP address calls.'''
def __init__(self, internal_ip: str, external_ip: str, worker_id: int, accelerator_type: str, *args, **kwargs):
pass
def _get_node_ip(self) -> str:
pass
def run(self, cmd, ti... | 4 | 2 | 21 | 2 | 15 | 4 | 2 | 0.26 | 1 | 4 | 0 | 0 | 3 | 4 | 3 | 18 | 67 | 9 | 47 | 27 | 24 | 12 | 15 | 8 | 11 | 2 | 2 | 1 | 5 |
9,784 | ray-project/ray | python/ray/autoscaler/_private/kuberay/autoscaling_config.py | ray.autoscaler._private.kuberay.autoscaling_config.AutoscalingConfigProducer | from ray.autoscaler._private.kuberay import node_provider, utils
import requests
import time
from typing import Any, Dict, Optional
class AutoscalingConfigProducer:
"""Produces an autoscaling config by reading data from the RayCluster CR.
Used to fetch the autoscaling config at the beginning of each autoscale... |
class AutoscalingConfigProducer:
'''Produces an autoscaling config by reading data from the RayCluster CR.
Used to fetch the autoscaling config at the beginning of each autoscaler iteration.
In the context of Ray deployment on Kubernetes, the autoscaling config is an
internal interface.
The autosca... | 4 | 2 | 10 | 1 | 7 | 2 | 2 | 0.61 | 0 | 6 | 1 | 1 | 3 | 2 | 3 | 3 | 46 | 9 | 23 | 10 | 19 | 14 | 18 | 9 | 14 | 4 | 0 | 3 | 6 |
9,785 | ray-project/ray | python/ray/autoscaler/_private/kuberay/node_provider.py | ray.autoscaler._private.kuberay.node_provider.IKubernetesHttpApiClient | from typing import Any, Dict, List, Optional, Tuple
from abc import ABC, abstractmethod
class IKubernetesHttpApiClient(ABC):
"""
An interface for a Kubernetes HTTP API client.
This interface could be used to mock the Kubernetes API client in tests.
"""
@abstractmethod
def get(self, path: str)... |
class IKubernetesHttpApiClient(ABC):
'''
An interface for a Kubernetes HTTP API client.
This interface could be used to mock the Kubernetes API client in tests.
'''
@abstractmethod
def get(self, path: str) -> Dict[str, Any]:
'''Wrapper for REST GET of resource with proper headers.'''
... | 5 | 3 | 3 | 0 | 2 | 1 | 1 | 0.86 | 1 | 2 | 0 | 2 | 2 | 0 | 2 | 22 | 16 | 3 | 7 | 5 | 2 | 6 | 5 | 3 | 2 | 1 | 4 | 0 | 2 |
9,786 | ray-project/ray | python/ray/autoscaler/_private/kuberay/node_provider.py | ray.autoscaler._private.kuberay.node_provider.KubeRayNodeProvider | import requests
from collections import defaultdict
from ray.autoscaler.batching_node_provider import BatchingNodeProvider, NodeData, ScaleRequest
from ray.autoscaler._private.constants import WORKER_LIVENESS_CHECK_KEY
from ray.autoscaler._private.util import NodeID, NodeIP, NodeKind, NodeStatus, NodeType
from typing i... |
class KubeRayNodeProvider(BatchingNodeProvider):
def __init__(self, provider_config: Dict[str, Any], cluster_name: str):
pass
def get_node_data(self) -> Dict[NodeID, NodeData]:
'''Queries K8s for pods in the RayCluster. Converts that pod data into a
map of pod name to Ray NodeData, as... | 10 | 8 | 21 | 2 | 12 | 6 | 3 | 0.5 | 1 | 9 | 3 | 0 | 9 | 4 | 9 | 41 | 194 | 26 | 113 | 47 | 97 | 56 | 86 | 41 | 76 | 7 | 2 | 3 | 25 |
9,787 | ray-project/ray | python/ray/autoscaler/_private/kuberay/node_provider.py | ray.autoscaler._private.kuberay.node_provider.KubernetesHttpApiClient | import requests
import json
from typing import Any, Dict, List, Optional, Tuple
import datetime
class KubernetesHttpApiClient(IKubernetesHttpApiClient):
def __init__(self, namespace: str, kuberay_crd_version: str=KUBERAY_CRD_VER):
self._kuberay_crd_version = kuberay_crd_version
self._namespace = n... |
class KubernetesHttpApiClient(IKubernetesHttpApiClient):
def __init__(self, namespace: str, kuberay_crd_version: str=KUBERAY_CRD_VER):
pass
def _get_refreshed_headers_and_verify(self):
pass
def get(self, path: str) -> Dict[str, Any]:
'''Wrapper for REST GET of resource with prope... | 5 | 2 | 18 | 2 | 12 | 4 | 2 | 0.35 | 1 | 3 | 0 | 0 | 4 | 5 | 4 | 26 | 75 | 10 | 48 | 15 | 43 | 17 | 27 | 15 | 22 | 2 | 5 | 1 | 7 |
9,788 | ray-project/ray | python/ray/autoscaler/_private/load_metrics.py | ray.autoscaler._private.load_metrics.LoadMetrics | from ray._private.gcs_utils import PlacementGroupTableData
from ray.autoscaler._private.util import DictCount, LoadMetricsSummary, NodeIP, ResourceDict
from functools import reduce
from ray.autoscaler._private.constants import AUTOSCALER_MAX_RESOURCE_DEMAND_VECTOR_SIZE, AUTOSCALER_REPORT_PER_NODE_STATUS
from typing imp... |
class LoadMetrics:
'''Container for cluster load metrics.
Metrics here are updated from raylet heartbeats. The autoscaler
queries these metrics to determine when to scale up, and which nodes
can be removed.
'''
def __init__(self):
pass
def __bool__(self):
'''A load metrics... | 22 | 6 | 15 | 1 | 12 | 2 | 2 | 0.2 | 0 | 12 | 1 | 0 | 18 | 10 | 18 | 18 | 312 | 40 | 227 | 77 | 193 | 45 | 141 | 66 | 118 | 8 | 0 | 3 | 52 |
9,789 | ray-project/ray | python/ray/autoscaler/_private/local/coordinator_node_provider.py | ray.autoscaler._private.local.coordinator_node_provider.CoordinatorSenderNodeProvider | from ray.autoscaler.node_provider import NodeProvider
from http.client import RemoteDisconnected
import json
from ray.autoscaler.tags import TAG_RAY_CLUSTER_NAME
class CoordinatorSenderNodeProvider(NodeProvider):
"""NodeProvider for automatically managed private/local clusters.
The cluster management is handl... |
class CoordinatorSenderNodeProvider(NodeProvider):
'''NodeProvider for automatically managed private/local clusters.
The cluster management is handled by a remote coordinating server.
The server listens on <coordinator_address>, therefore, the address
should be provided in the provider section in the c... | 13 | 1 | 7 | 0 | 6 | 0 | 1 | 0.15 | 1 | 3 | 0 | 0 | 12 | 1 | 12 | 33 | 100 | 16 | 74 | 33 | 59 | 11 | 54 | 33 | 39 | 3 | 1 | 1 | 14 |
9,790 | ray-project/ray | python/ray/autoscaler/_private/local/node_provider.py | ray.autoscaler._private.local.node_provider.ClusterState | import os
from ray.autoscaler.tags import NODE_KIND_HEAD, NODE_KIND_WORKER, STATUS_UP_TO_DATE, TAG_RAY_NODE_KIND, TAG_RAY_NODE_NAME, TAG_RAY_NODE_STATUS, TAG_RAY_USER_NODE_TYPE
from filelock import FileLock
import json
from threading import RLock
class ClusterState:
def __init__(self, lock_path, save_path, provid... |
class ClusterState:
def __init__(self, lock_path, save_path, provider_config):
pass
def get(self):
pass
def put(self, worker_id, info):
pass | 4 | 0 | 28 | 1 | 25 | 2 | 4 | 0.06 | 0 | 1 | 0 | 1 | 3 | 3 | 3 | 3 | 87 | 5 | 77 | 17 | 73 | 5 | 51 | 15 | 47 | 9 | 0 | 4 | 11 |
9,791 | ray-project/ray | python/ray/autoscaler/_private/local/node_provider.py | ray.autoscaler._private.local.node_provider.LocalNodeProvider | import socket
from ray.autoscaler.tags import NODE_KIND_HEAD, NODE_KIND_WORKER, STATUS_UP_TO_DATE, TAG_RAY_NODE_KIND, TAG_RAY_NODE_NAME, TAG_RAY_NODE_STATUS, TAG_RAY_USER_NODE_TYPE
from ray.autoscaler.node_provider import NodeProvider
from ray.autoscaler._private.local.config import LOCAL_CLUSTER_NODE_TYPE, bootstrap_l... |
class LocalNodeProvider(NodeProvider):
'''NodeProvider for private/local clusters.
`node_id` is overloaded to also be `node_ip` in this class.
When `cluster_name` is provided, it manages a single cluster in a cluster
specific state file. But when `cluster_name` is None, it manages multiple
clusters... | 13 | 3 | 8 | 0 | 7 | 1 | 2 | 0.27 | 1 | 2 | 2 | 0 | 10 | 2 | 11 | 32 | 113 | 18 | 75 | 30 | 62 | 20 | 62 | 29 | 50 | 6 | 1 | 4 | 21 |
9,792 | ray-project/ray | python/ray/autoscaler/_private/local/node_provider.py | ray.autoscaler._private.local.node_provider.OnPremCoordinatorState | from threading import RLock
import os
import json
from filelock import FileLock
class OnPremCoordinatorState(ClusterState):
"""Generates & updates the state file of CoordinatorSenderNodeProvider.
Unlike ClusterState, which generates a cluster specific file with
predefined head and worker ips, OnPremCoordi... |
class OnPremCoordinatorState(ClusterState):
'''Generates & updates the state file of CoordinatorSenderNodeProvider.
Unlike ClusterState, which generates a cluster specific file with
predefined head and worker ips, OnPremCoordinatorState overwrites
ClusterState's __init__ function to generate and manage... | 2 | 1 | 34 | 3 | 30 | 1 | 6 | 0.23 | 1 | 1 | 0 | 0 | 1 | 3 | 1 | 4 | 43 | 5 | 31 | 8 | 29 | 7 | 21 | 7 | 19 | 6 | 1 | 4 | 6 |
9,793 | ray-project/ray | python/ray/autoscaler/_private/log_timer.py | ray.autoscaler._private.log_timer.LogTimer | import datetime
from ray.autoscaler._private.cli_logger import cli_logger
class LogTimer:
def __init__(self, message, show_status=False):
self._message = message
self._show_status = show_status
def __enter__(self):
self._start_time = datetime.datetime.utcnow()
def __exit__(self, ... |
class LogTimer:
def __init__(self, message, show_status=False):
pass
def __enter__(self):
pass
def __exit__(self, *error_vals):
pass | 4 | 0 | 7 | 0 | 7 | 0 | 2 | 0 | 0 | 1 | 0 | 0 | 3 | 3 | 3 | 3 | 25 | 3 | 22 | 9 | 18 | 0 | 14 | 9 | 10 | 4 | 0 | 1 | 6 |
9,794 | ray-project/ray | python/ray/autoscaler/_private/monitor.py | ray.autoscaler._private.monitor.Monitor | from ray.experimental.internal_kv import _initialize_internal_kv, _internal_kv_del, _internal_kv_get, _internal_kv_initialized, _internal_kv_put
import json
from dataclasses import asdict
import ray._private.ray_constants as ray_constants
from ray._common.network_utils import build_address, parse_address
from ray.autos... |
class Monitor:
'''Autoscaling monitor.
This process periodically collects stats from the GCS and triggers
autoscaler updates.
'''
def __init__(self, address: str, autoscaling_config: Union[str, Callable[[], Dict[str, Any]]], log_dir: str=None, prefix_cluster_info: bool=False, monitor_ip: Optional[... | 14 | 7 | 36 | 3 | 28 | 5 | 5 | 0.2 | 0 | 12 | 4 | 0 | 12 | 13 | 12 | 12 | 482 | 57 | 358 | 86 | 335 | 73 | 223 | 78 | 208 | 12 | 0 | 6 | 67 |
9,795 | ray-project/ray | python/ray/autoscaler/_private/node_launcher.py | ray.autoscaler._private.node_launcher.BaseNodeLauncher | import copy
from ray.autoscaler._private.prom_metrics import AutoscalerPrometheusMetrics
from ray.autoscaler.node_launch_exception import NodeLaunchException
from ray.autoscaler._private.node_provider_availability_tracker import NodeProviderAvailabilityTracker
import operator
from typing import Any, Dict, Optional
impo... |
class BaseNodeLauncher:
'''Launches Ray nodes in the main thread using
`BaseNodeLauncher.launch_node()`.
This is a superclass of NodeLauncher, which launches nodes asynchronously
in the background.
By default, the subclass NodeLauncher is used to launch nodes in subthreads.
That behavior can be... | 5 | 1 | 34 | 2 | 28 | 3 | 4 | 0.19 | 0 | 9 | 3 | 1 | 4 | 7 | 4 | 4 | 150 | 14 | 114 | 44 | 93 | 22 | 62 | 27 | 57 | 10 | 0 | 2 | 14 |
9,796 | ray-project/ray | python/ray/autoscaler/_private/node_launcher.py | ray.autoscaler._private.node_launcher.NodeLauncher | import threading
from typing import Any, Dict, Optional
class NodeLauncher(BaseNodeLauncher, threading.Thread):
"""Launches nodes asynchronously in the background."""
def __init__(self, provider, queue, pending, event_summarizer, node_provider_availability_tracker, session_name: Optional[str]=None, prom_metri... |
class NodeLauncher(BaseNodeLauncher, threading.Thread):
'''Launches nodes asynchronously in the background.'''
def __init__(self, provider, queue, pending, event_summarizer, node_provider_availability_tracker, session_name: Optional[str]=None, prom_metrics=None, node_types=None, index=None, *thread_args, **th... | 3 | 2 | 19 | 1 | 16 | 3 | 2 | 0.22 | 2 | 1 | 0 | 0 | 2 | 1 | 2 | 31 | 42 | 3 | 32 | 18 | 16 | 7 | 9 | 5 | 6 | 2 | 1 | 1 | 3 |
9,797 | ray-project/ray | python/ray/autoscaler/_private/node_provider_availability_tracker.py | ray.autoscaler._private.node_provider_availability_tracker.NodeAvailabilityRecord | from dataclasses import dataclass
from typing import Callable, Dict, Optional, Tuple
@dataclass
class NodeAvailabilityRecord:
node_type: str
is_available: bool
last_checked_timestamp: float
unavailable_node_information: Optional[UnavailableNodeInformation] | @dataclass
class NodeAvailabilityRecord:
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 | 0 | 5 | 1 | 4 | 0 | 5 | 1 | 4 | 0 | 0 | 0 | 0 |
9,798 | ray-project/ray | python/ray/autoscaler/_private/node_provider_availability_tracker.py | ray.autoscaler._private.node_provider_availability_tracker.NodeAvailabilitySummary | from dataclasses import dataclass
from typing import Callable, Dict, Optional, Tuple
@dataclass
class NodeAvailabilitySummary:
node_availabilities: Dict[str, NodeAvailabilityRecord]
@classmethod
def from_fields(cls, **fields) -> Optional['NodeAvailabilitySummary']:
"""Implement marshalling from ne... | @dataclass
class NodeAvailabilitySummary:
@classmethod
def from_fields(cls, **fields) -> Optional['NodeAvailabilitySummary']:
'''Implement marshalling from nested fields. pydantic isn't a core dependency
so we're implementing this by hand instead.'''
pass
def __eq__(self, other: 'N... | 6 | 1 | 9 | 1 | 7 | 1 | 2 | 0.12 | 0 | 3 | 2 | 0 | 2 | 0 | 3 | 3 | 35 | 7 | 26 | 10 | 21 | 3 | 16 | 9 | 12 | 3 | 0 | 2 | 5 |
9,799 | ray-project/ray | python/ray/autoscaler/_private/node_provider_availability_tracker.py | ray.autoscaler._private.node_provider_availability_tracker.NodeProviderAvailabilityTracker | from ray.autoscaler._private.constants import AUTOSCALER_NODE_AVAILABILITY_MAX_STALENESS_S
from typing import Callable, Dict, Optional, Tuple
import threading
from ray.autoscaler.node_launch_exception import NodeLaunchException
import time
class NodeProviderAvailabilityTracker:
"""A thread safe, TTL cache of node ... |
class NodeProviderAvailabilityTracker:
'''A thread safe, TTL cache of node provider availability. We don't use
cachetools.TTLCache because it always sets the expiration time relative to
insertion time, but in our case, we want entries to expire relative to when
the node creation was attempted (and entr... | 6 | 5 | 18 | 1 | 12 | 5 | 2 | 0.54 | 0 | 8 | 4 | 0 | 5 | 4 | 5 | 5 | 102 | 11 | 59 | 30 | 39 | 32 | 27 | 15 | 21 | 3 | 0 | 3 | 8 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.