mirror of
https://github.com/wassname/ray.git
synced 2026-09-09 11:32:43 +08:00
committed by
Philipp Moritz
parent
34e9c1778b
commit
a28920bb24
+8
-9
@@ -140,21 +140,20 @@ class WorkerTest(unittest.TestCase):
|
||||
|
||||
services.cleanup()
|
||||
|
||||
"""
|
||||
class APITest(unittest.TestCase):
|
||||
|
||||
def testObjRefAliasing(self):
|
||||
services.start_scheduler(address(IP_ADDRESS, new_scheduler_port()))
|
||||
time.sleep(0.1)
|
||||
services.start_objstore(address(IP_ADDRESS, scheduler_port), address(IP_ADDRESS, new_objstore_port()))
|
||||
time.sleep(0.2)
|
||||
worker1 = worker.Worker()
|
||||
orchpy.connect(address(IP_ADDRESS, scheduler_port), address(IP_ADDRESS, objstore_port), address(IP_ADDRESS, new_worker_port()), worker1)
|
||||
w = worker.Worker()
|
||||
test_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
test_path = os.path.join(test_dir, "testrecv.py")
|
||||
services.start_worker(test_path, address(IP_ADDRESS, scheduler_port), address(IP_ADDRESS, objstore_port), address(IP_ADDRESS, new_worker_port()))
|
||||
"""
|
||||
services.start_cluster(num_workers=3, worker_path=test_path, driver_worker=w)
|
||||
|
||||
objref = w.remote_call("__main__.test_alias_f", [])
|
||||
self.assertTrue(np.alltrue(orchpy.pull(objref[0], w) == np.ones([3, 4, 5])))
|
||||
objref = w.remote_call("__main__.test_alias_g", [])
|
||||
self.assertTrue(np.alltrue(orchpy.pull(objref[0], w) == np.ones([3, 4, 5])))
|
||||
objref = w.remote_call("__main__.test_alias_h", [])
|
||||
self.assertTrue(np.alltrue(orchpy.pull(objref[0], w) == np.ones([3, 4, 5])))
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import argparse
|
||||
import numpy as np
|
||||
|
||||
import orchpy
|
||||
import orchpy.services as services
|
||||
@@ -18,6 +19,18 @@ parser.add_argument("--scheduler-address", default="127.0.0.1:10001", type=str,
|
||||
parser.add_argument("--objstore-address", default="127.0.0.1:20001", type=str, help="the objstore's address")
|
||||
parser.add_argument("--worker-address", default="127.0.0.1:30001", type=str, help="the worker's address")
|
||||
|
||||
@orchpy.distributed([], [np.ndarray])
|
||||
def test_alias_f():
|
||||
return np.ones([3, 4, 5])
|
||||
|
||||
@orchpy.distributed([], [np.ndarray])
|
||||
def test_alias_g():
|
||||
return test_alias_f()
|
||||
|
||||
@orchpy.distributed([], [np.ndarray])
|
||||
def test_alias_h():
|
||||
return test_alias_g()
|
||||
|
||||
@orchpy.distributed([str], [str])
|
||||
def print_string(string):
|
||||
print "called print_string with", string
|
||||
|
||||
+4
-1
@@ -20,8 +20,11 @@ def test_alias_f():
|
||||
|
||||
@orchpy.distributed([], [np.ndarray])
|
||||
def test_alias_g():
|
||||
return f()
|
||||
return test_alias_f()
|
||||
|
||||
@orchpy.distributed([], [np.ndarray])
|
||||
def test_alias_h():
|
||||
return test_alias_g()
|
||||
|
||||
@orchpy.distributed([str], [str])
|
||||
def print_string(string):
|
||||
|
||||
Reference in New Issue
Block a user