mirror of
https://github.com/wassname/ray.git
synced 2026-08-12 12:20:11 +08:00
Deprecate 'driver_mode' argument. (#2758)
* Deprecate 'driver_mode' argument. * Fix * Fix
This commit is contained in:
committed by
Philipp Moritz
parent
de047daea7
commit
b7722897b4
+2
-2
@@ -21,7 +21,7 @@ class ActorAPI(unittest.TestCase):
|
||||
ray.shutdown()
|
||||
|
||||
def testKeywordArgs(self):
|
||||
ray.init(num_workers=0, driver_mode=ray.SILENT_MODE)
|
||||
ray.init(num_workers=0)
|
||||
|
||||
@ray.remote
|
||||
class Actor(object):
|
||||
@@ -189,7 +189,7 @@ class ActorAPI(unittest.TestCase):
|
||||
assert ray.get(f.get_val.remote()) == 3
|
||||
|
||||
def testDecoratorArgs(self):
|
||||
ray.init(num_workers=0, driver_mode=ray.SILENT_MODE)
|
||||
ray.init(num_workers=0)
|
||||
|
||||
# This is an invalid way of using the actor decorator.
|
||||
with pytest.raises(Exception):
|
||||
|
||||
@@ -31,7 +31,6 @@ class ComponentFailureTest(unittest.TestCase):
|
||||
|
||||
ray.worker._init(
|
||||
num_workers=1,
|
||||
driver_mode=ray.SILENT_MODE,
|
||||
start_workers_from_local_scheduler=False,
|
||||
start_ray_local=True,
|
||||
redirect_output=True)
|
||||
@@ -73,7 +72,6 @@ class ComponentFailureTest(unittest.TestCase):
|
||||
|
||||
ray.worker._init(
|
||||
num_workers=1,
|
||||
driver_mode=ray.SILENT_MODE,
|
||||
start_workers_from_local_scheduler=False,
|
||||
start_ray_local=True,
|
||||
redirect_output=True)
|
||||
|
||||
+14
-20
@@ -44,7 +44,7 @@ class TaskStatusTest(unittest.TestCase):
|
||||
def throw_exception_fct3(x):
|
||||
raise Exception("Test function 3 intentionally failed.")
|
||||
|
||||
ray.init(num_workers=3, driver_mode=ray.SILENT_MODE)
|
||||
ray.init(num_workers=3)
|
||||
|
||||
throw_exception_fct1.remote()
|
||||
throw_exception_fct1.remote()
|
||||
@@ -86,7 +86,7 @@ class TaskStatusTest(unittest.TestCase):
|
||||
assert False
|
||||
|
||||
def testFailImportingRemoteFunction(self):
|
||||
ray.init(num_workers=2, driver_mode=ray.SILENT_MODE)
|
||||
ray.init(num_workers=2)
|
||||
|
||||
# Create the contents of a temporary Python file.
|
||||
temporary_python_file = """
|
||||
@@ -125,7 +125,7 @@ def temporary_helper_function():
|
||||
sys.path.pop(-1)
|
||||
|
||||
def testFailedFunctionToRun(self):
|
||||
ray.init(num_workers=2, driver_mode=ray.SILENT_MODE)
|
||||
ray.init(num_workers=2)
|
||||
|
||||
def f(worker):
|
||||
if ray.worker.global_worker.mode == ray.WORKER_MODE:
|
||||
@@ -140,7 +140,7 @@ def temporary_helper_function():
|
||||
assert "Function to run failed." in error_info[1]["message"]
|
||||
|
||||
def testFailImportingActor(self):
|
||||
ray.init(num_workers=2, driver_mode=ray.SILENT_MODE)
|
||||
ray.init(num_workers=2)
|
||||
|
||||
# Create the contents of a temporary Python file.
|
||||
temporary_python_file = """
|
||||
@@ -203,7 +203,7 @@ class ActorTest(unittest.TestCase):
|
||||
ray.shutdown()
|
||||
|
||||
def testFailedActorInit(self):
|
||||
ray.init(num_workers=0, driver_mode=ray.SILENT_MODE)
|
||||
ray.init(num_workers=0)
|
||||
|
||||
error_message1 = "actor constructor failed"
|
||||
error_message2 = "actor method failed"
|
||||
@@ -233,7 +233,7 @@ class ActorTest(unittest.TestCase):
|
||||
assert error_message2 in ray.error_info()[1]["message"]
|
||||
|
||||
def testIncorrectMethodCalls(self):
|
||||
ray.init(num_workers=0, driver_mode=ray.SILENT_MODE)
|
||||
ray.init(num_workers=0)
|
||||
|
||||
@ray.remote
|
||||
class Actor(object):
|
||||
@@ -275,7 +275,7 @@ class WorkerDeath(unittest.TestCase):
|
||||
ray.shutdown()
|
||||
|
||||
def testWorkerRaisingException(self):
|
||||
ray.init(num_workers=1, driver_mode=ray.SILENT_MODE)
|
||||
ray.init(num_workers=1)
|
||||
|
||||
@ray.remote
|
||||
def f():
|
||||
@@ -290,7 +290,7 @@ class WorkerDeath(unittest.TestCase):
|
||||
assert len(ray.error_info()) == 2
|
||||
|
||||
def testWorkerDying(self):
|
||||
ray.init(num_workers=0, driver_mode=ray.SILENT_MODE)
|
||||
ray.init(num_workers=0)
|
||||
|
||||
# Define a remote function that will kill the worker that runs it.
|
||||
@ray.remote
|
||||
@@ -306,7 +306,7 @@ class WorkerDeath(unittest.TestCase):
|
||||
assert "died or was killed while executing" in error_info[0]["message"]
|
||||
|
||||
def testActorWorkerDying(self):
|
||||
ray.init(num_workers=0, driver_mode=ray.SILENT_MODE)
|
||||
ray.init(num_workers=0)
|
||||
|
||||
@ray.remote
|
||||
class Actor(object):
|
||||
@@ -326,7 +326,7 @@ class WorkerDeath(unittest.TestCase):
|
||||
wait_for_errors(ray_constants.WORKER_DIED_PUSH_ERROR, 1)
|
||||
|
||||
def testActorWorkerDyingFutureTasks(self):
|
||||
ray.init(num_workers=0, driver_mode=ray.SILENT_MODE)
|
||||
ray.init(num_workers=0)
|
||||
|
||||
@ray.remote
|
||||
class Actor(object):
|
||||
@@ -349,7 +349,7 @@ class WorkerDeath(unittest.TestCase):
|
||||
wait_for_errors(ray_constants.WORKER_DIED_PUSH_ERROR, 1)
|
||||
|
||||
def testActorWorkerDyingNothingInProgress(self):
|
||||
ray.init(num_workers=0, driver_mode=ray.SILENT_MODE)
|
||||
ray.init(num_workers=0)
|
||||
|
||||
@ray.remote
|
||||
class Actor(object):
|
||||
@@ -374,10 +374,7 @@ class PutErrorTest(unittest.TestCase):
|
||||
|
||||
def testPutError1(self):
|
||||
store_size = 10**6
|
||||
ray.worker._init(
|
||||
start_ray_local=True,
|
||||
driver_mode=ray.SILENT_MODE,
|
||||
object_store_memory=store_size)
|
||||
ray.worker._init(start_ray_local=True, object_store_memory=store_size)
|
||||
|
||||
num_objects = 3
|
||||
object_size = 4 * 10**5
|
||||
@@ -421,10 +418,7 @@ class PutErrorTest(unittest.TestCase):
|
||||
def testPutError2(self):
|
||||
# This is the same as the previous test, but it calls ray.put directly.
|
||||
store_size = 10**6
|
||||
ray.worker._init(
|
||||
start_ray_local=True,
|
||||
driver_mode=ray.SILENT_MODE,
|
||||
object_store_memory=store_size)
|
||||
ray.worker._init(start_ray_local=True, object_store_memory=store_size)
|
||||
|
||||
num_objects = 3
|
||||
object_size = 4 * 10**5
|
||||
@@ -473,7 +467,7 @@ class ConfigurationTest(unittest.TestCase):
|
||||
ray_version = ray.__version__
|
||||
ray.__version__ = "fake ray version"
|
||||
|
||||
ray.init(num_workers=1, driver_mode=ray.SILENT_MODE)
|
||||
ray.init(num_workers=1)
|
||||
|
||||
wait_for_errors(ray_constants.VERSION_MISMATCH_PUSH_ERROR, 1)
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ class MultiNodeTest(unittest.TestCase):
|
||||
|
||||
def testErrorIsolation(self):
|
||||
# Connect a driver to the Ray cluster.
|
||||
ray.init(redis_address=self.redis_address, driver_mode=ray.SILENT_MODE)
|
||||
ray.init(redis_address=self.redis_address)
|
||||
|
||||
# There shouldn't be any errors yet.
|
||||
assert len(ray.error_info()) == 0
|
||||
@@ -115,7 +115,7 @@ print("success")
|
||||
def testRemoteFunctionIsolation(self):
|
||||
# This test will run multiple remote functions with the same names in
|
||||
# two different drivers. Connect a driver to the Ray cluster.
|
||||
ray.init(redis_address=self.redis_address, driver_mode=ray.SILENT_MODE)
|
||||
ray.init(redis_address=self.redis_address)
|
||||
|
||||
# Start another driver and make sure that it can define and call its
|
||||
# own commands with the same names.
|
||||
@@ -158,7 +158,7 @@ print("success")
|
||||
def testDriverExitingQuickly(self):
|
||||
# This test will create some drivers that submit some tasks and then
|
||||
# exit without waiting for the tasks to complete.
|
||||
ray.init(redis_address=self.redis_address, driver_mode=ray.SILENT_MODE)
|
||||
ray.init(redis_address=self.redis_address)
|
||||
|
||||
# Define a driver that creates an actor and exits.
|
||||
driver_script1 = """
|
||||
@@ -322,7 +322,7 @@ def train_func(config, reporter): # add a reporter arg
|
||||
time.sleep(0.1)
|
||||
reporter(timesteps_total=i, mean_accuracy=i+97) # report metrics
|
||||
|
||||
ray.init(redis_address="{}", driver_mode=ray.SILENT_MODE)
|
||||
ray.init(redis_address="{}")
|
||||
ray.tune.register_trainable("train_func", train_func)
|
||||
|
||||
tune.run_experiments({{
|
||||
|
||||
+6
-4
@@ -1,4 +1,6 @@
|
||||
from __future__ import absolute_import, division, print_function
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
|
||||
import os
|
||||
import pytest
|
||||
@@ -1006,7 +1008,7 @@ class APITest(unittest.TestCase):
|
||||
os.environ.get("RAY_USE_XRAY") == "1",
|
||||
"This test does not work with xray (nor is it intended to).")
|
||||
def testLoggingAPI(self):
|
||||
self.init_ray(driver_mode=ray.SILENT_MODE)
|
||||
self.init_ray()
|
||||
|
||||
def events():
|
||||
# This is a hack for getting the event log. It is not part of the
|
||||
@@ -1175,7 +1177,7 @@ class APITest(unittest.TestCase):
|
||||
ray.get(3)
|
||||
|
||||
def testMultithreading(self):
|
||||
self.init_ray(driver_mode=ray.SILENT_MODE)
|
||||
self.init_ray()
|
||||
|
||||
@ray.remote
|
||||
def f():
|
||||
@@ -1316,7 +1318,7 @@ class LocalModeTest(unittest.TestCase):
|
||||
x[0] = 1
|
||||
return x
|
||||
|
||||
ray.init(driver_mode=ray.LOCAL_MODE)
|
||||
ray.init(local_mode=True)
|
||||
|
||||
@ray.remote
|
||||
def f():
|
||||
|
||||
Reference in New Issue
Block a user