mirror of
https://github.com/wassname/ray.git
synced 2026-08-03 13:10:57 +08:00
Remove (object) from class declarations. (#6658)
This commit is contained in:
committed by
Philipp Moritz
parent
f1b56fa5ee
commit
39a3459886
@@ -5,7 +5,7 @@ from __future__ import print_function
|
||||
import ray
|
||||
|
||||
|
||||
class ActorPool(object):
|
||||
class ActorPool:
|
||||
"""Utility class to operate on a fixed pool of actors.
|
||||
|
||||
Arguments:
|
||||
|
||||
@@ -9,7 +9,7 @@ import ray
|
||||
BLOCK_SIZE = 10
|
||||
|
||||
|
||||
class DistArray(object):
|
||||
class DistArray:
|
||||
def __init__(self, shape, objectids=None):
|
||||
self.shape = shape
|
||||
self.ndim = len(shape)
|
||||
|
||||
@@ -15,7 +15,7 @@ transport = None
|
||||
protocol = None
|
||||
|
||||
|
||||
class _ThreadSafeProxy(object):
|
||||
class _ThreadSafeProxy:
|
||||
"""This class is used to create a thread-safe proxy for a given object.
|
||||
Every method call will be guarded with a lock.
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import ray
|
||||
import ray.cloudpickle as pickle
|
||||
|
||||
|
||||
class GcsFlushPolicy(object):
|
||||
class GcsFlushPolicy:
|
||||
"""Experimental: a policy to control GCS flushing.
|
||||
|
||||
Used by Monitor to enable automatic control of memory usage.
|
||||
|
||||
@@ -105,7 +105,7 @@ class ResultThread(threading.Thread):
|
||||
raise TimeoutError
|
||||
|
||||
|
||||
class AsyncResult(object):
|
||||
class AsyncResult:
|
||||
"""An asynchronous interface to task results.
|
||||
|
||||
This should not be constructed directly.
|
||||
@@ -168,7 +168,7 @@ class AsyncResult(object):
|
||||
return not self._result_thread.got_error()
|
||||
|
||||
|
||||
class IMapIterator(object):
|
||||
class IMapIterator:
|
||||
"""Base class for OrderedIMapIterator and UnorderedIMapIterator."""
|
||||
|
||||
def __init__(self, pool, func, iterable, chunksize=None):
|
||||
@@ -273,7 +273,7 @@ class UnorderedIMapIterator(IMapIterator):
|
||||
|
||||
|
||||
@ray.remote
|
||||
class PoolActor(object):
|
||||
class PoolActor:
|
||||
"""Actor used to process tasks submitted to a Pool."""
|
||||
|
||||
def __init__(self, initializer=None, initargs=None):
|
||||
@@ -298,7 +298,7 @@ class PoolActor(object):
|
||||
|
||||
|
||||
# https://docs.python.org/3/library/multiprocessing.html#module-multiprocessing.pool
|
||||
class Pool(object):
|
||||
class Pool:
|
||||
"""A pool of actor processes that is used to process tasks in parallel.
|
||||
|
||||
Args:
|
||||
|
||||
@@ -3,7 +3,7 @@ from __future__ import division
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
class NoReturn(object):
|
||||
class NoReturn:
|
||||
"""Do not store the return value in the object store.
|
||||
|
||||
If a task returns this object, then Ray will not store this object in the
|
||||
|
||||
@@ -16,7 +16,7 @@ class Full(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class Queue(object):
|
||||
class Queue:
|
||||
"""Queue implementation on Ray.
|
||||
|
||||
Args:
|
||||
@@ -132,7 +132,7 @@ class Queue(object):
|
||||
|
||||
|
||||
@ray.remote
|
||||
class _QueueActor(object):
|
||||
class _QueueActor:
|
||||
def __init__(self, maxsize):
|
||||
self.maxsize = maxsize
|
||||
self._init(maxsize)
|
||||
|
||||
@@ -8,7 +8,7 @@ from ray.experimental.serve.metric import MetricMonitor
|
||||
@pytest.fixture(scope="session")
|
||||
def start_target_actor(ray_instance):
|
||||
@ray.remote
|
||||
class Target(object):
|
||||
class Target:
|
||||
def __init__(self):
|
||||
self.counter_value = 0
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ from ray.experimental.sgd import utils
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class PyTorchRunner(object):
|
||||
class PyTorchRunner:
|
||||
"""Manages a PyTorch model for training."""
|
||||
|
||||
def __init__(self,
|
||||
|
||||
@@ -21,7 +21,7 @@ from ray.experimental.sgd.pytorch.pytorch_runner import PyTorchRunner
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class PyTorchTrainer(object):
|
||||
class PyTorchTrainer:
|
||||
"""Train a PyTorch model using distributed PyTorch.
|
||||
|
||||
Launches a set of actors which connect via distributed PyTorch and
|
||||
|
||||
@@ -108,7 +108,7 @@ def validate(model, val_iterator, criterion, config):
|
||||
return stats
|
||||
|
||||
|
||||
class AverageMeter(object):
|
||||
class AverageMeter:
|
||||
"""Computes and stores the average and current value."""
|
||||
|
||||
def __init__(self):
|
||||
|
||||
@@ -20,7 +20,7 @@ def _try_import_strategy():
|
||||
return tf.distribute.experimental.MultiWorkerMirroredStrategy
|
||||
|
||||
|
||||
class TFRunner(object):
|
||||
class TFRunner:
|
||||
"""Manages a TensorFlow model for training."""
|
||||
|
||||
def __init__(self, model_creator, data_creator, config=None,
|
||||
|
||||
@@ -16,7 +16,7 @@ from ray.experimental.sgd.tf.tf_runner import TFRunner
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class TFTrainer(object):
|
||||
class TFTrainer:
|
||||
def __init__(self,
|
||||
model_creator,
|
||||
data_creator,
|
||||
|
||||
@@ -8,7 +8,7 @@ import socket
|
||||
import time
|
||||
|
||||
|
||||
class TimerStat(object):
|
||||
class TimerStat:
|
||||
"""A running stat for conveniently logging the duration of a code block.
|
||||
|
||||
Note that this class is *not* thread-safe.
|
||||
@@ -108,7 +108,7 @@ def find_free_port():
|
||||
return s.getsockname()[1]
|
||||
|
||||
|
||||
class AverageMeter(object):
|
||||
class AverageMeter:
|
||||
"""Computes and stores the average and current value."""
|
||||
|
||||
def __init__(self):
|
||||
|
||||
@@ -18,7 +18,7 @@ ACTOR_DIED_STR = "ACTOR_DIED_SIGNAL"
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Signal(object):
|
||||
class Signal:
|
||||
"""Base class for Ray signals."""
|
||||
pass
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ def unflatten(vector, shapes):
|
||||
return arrays
|
||||
|
||||
|
||||
class TensorFlowVariables(object):
|
||||
class TensorFlowVariables:
|
||||
"""A class used to set and get weights for Tensorflow networks.
|
||||
|
||||
Attributes:
|
||||
|
||||
Reference in New Issue
Block a user