rename test_path -> worker_path (#128)

This commit is contained in:
Robert Nishihara
2016-06-19 22:01:31 -07:00
committed by Philipp Moritz
parent aaa0a514fa
commit ac65f1031e
7 changed files with 29 additions and 41 deletions
+2 -2
View File
@@ -15,8 +15,8 @@ parser.add_argument("--drop-ipython", default=False, type=bool, help="Drop into
if __name__ == "__main__":
args = parser.parse_args()
test_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "worker.py")
services.start_singlenode_cluster(return_drivers=False, num_workers_per_objstore=5, worker_path=test_path)
worker_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "worker.py")
services.start_singlenode_cluster(return_drivers=False, num_workers_per_objstore=5, worker_path=worker_path)
s3 = boto3.resource("s3")
imagenet_bucket = s3.Bucket(args.s3_bucket)
+2 -3
View File
@@ -19,9 +19,8 @@ num_batches = mnist.train.num_examples / batch_size
batches = [mnist.train.next_batch(batch_size) for _ in range(num_batches)]
if __name__ == "__main__":
test_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "worker.py")
test_path = os.path.join("worker.py")
services.start_singlenode_cluster(return_drivers=False, num_workers_per_objstore=16, worker_path=test_path)
worker_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "worker.py")
services.start_singlenode_cluster(return_drivers=False, num_workers_per_objstore=16, worker_path=worker_path)
x_batches = [ray.push(batches[i][0]) for i in range(num_batches)]
y_batches = [ray.push(batches[i][1]) for i in range(num_batches)]
+2 -2
View File
@@ -77,9 +77,9 @@ def start_objstore(scheduler_address, objstore_address):
p = subprocess.Popen([os.path.join(_services_path, "objstore"), scheduler_address, objstore_address, "--log-file-name", objstore_log_filename])
all_processes.append((p, objstore_address))
def start_worker(test_path, scheduler_address, objstore_address, worker_address):
def start_worker(worker_path, scheduler_address, objstore_address, worker_address):
p = subprocess.Popen(["python",
test_path,
worker_path,
"--scheduler-address=" + scheduler_address,
"--objstore-address=" + objstore_address,
"--worker-address=" + worker_address])
+6 -9
View File
@@ -14,9 +14,8 @@ import ray.arrays.distributed as da
class ArraysSingleTest(unittest.TestCase):
def testMethods(self):
test_dir = os.path.dirname(os.path.abspath(__file__))
test_path = os.path.join(test_dir, "test_worker.py")
services.start_singlenode_cluster(return_drivers=False, num_workers_per_objstore=1, worker_path=test_path)
worker_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "test_worker.py")
services.start_singlenode_cluster(return_drivers=False, num_workers_per_objstore=1, worker_path=worker_path)
# test eye
ref = ra.eye(3)
@@ -60,9 +59,8 @@ class ArraysDistTest(unittest.TestCase):
services.cleanup()
def testAssemble(self):
test_dir = os.path.dirname(os.path.abspath(__file__))
test_path = os.path.join(test_dir, "test_worker.py")
services.start_singlenode_cluster(return_drivers=False, num_workers_per_objstore=1, worker_path=test_path)
worker_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "test_worker.py")
services.start_singlenode_cluster(return_drivers=False, num_workers_per_objstore=1, worker_path=worker_path)
a = ra.ones([da.BLOCK_SIZE, da.BLOCK_SIZE])
b = ra.zeros([da.BLOCK_SIZE, da.BLOCK_SIZE])
@@ -73,9 +71,8 @@ class ArraysDistTest(unittest.TestCase):
services.cleanup()
def testMethods(self):
test_dir = os.path.dirname(os.path.abspath(__file__))
test_path = os.path.join(test_dir, "test_worker.py")
services.start_singlenode_cluster(return_drivers=False, num_objstores=2, num_workers_per_objstore=5, worker_path=test_path)
worker_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "test_worker.py")
services.start_singlenode_cluster(return_drivers=False, num_objstores=2, num_workers_per_objstore=5, worker_path=worker_path)
x = da.zeros([9, 25, 51], "float")
y = da.assemble(x)
+3 -4
View File
@@ -8,11 +8,10 @@ import ray.datasets.imagenet as imagenet
class ImageNetTest(unittest.TestCase):
def testImageNetLoading(self):
test_dir = os.path.dirname(os.path.abspath(__file__))
test_path = os.path.join(test_dir, "test_worker.py")
services.start_singlenode_cluster(return_drivers=False, num_workers_per_objstore=5, worker_path=test_path)
worker_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "test_worker.py")
services.start_singlenode_cluster(return_drivers=False, num_workers_per_objstore=5, worker_path=worker_path)
chunk_name = os.path.join(test_dir, "..", "data", "mini.tar")
chunk_name = os.path.join(os.path.dirname(os.path.abspath(__file__)), "../data/mini.tar")
tar = tarfile.open(chunk_name, mode= "r")
chunk = imagenet.load_chunk(tar, size=(256, 256))
self.assertEqual(chunk.shape, (2, 256, 256, 3))
+2 -3
View File
@@ -10,9 +10,8 @@ import test_functions
class MicroBenchmarkTest(unittest.TestCase):
def testTiming(self):
test_dir = os.path.dirname(os.path.abspath(__file__))
test_path = os.path.join(test_dir, "test_worker.py")
services.start_singlenode_cluster(return_drivers=False, num_workers_per_objstore=3, worker_path=test_path)
worker_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "test_worker.py")
services.start_singlenode_cluster(return_drivers=False, num_workers_per_objstore=3, worker_path=worker_path)
# measure the time required to submit a remote task to the scheduler
elapsed_times = []
+12 -18
View File
@@ -126,9 +126,8 @@ class ObjStoreTest(unittest.TestCase):
class SchedulerTest(unittest.TestCase):
def testRemoteTask(self):
test_dir = os.path.dirname(os.path.abspath(__file__))
test_path = os.path.join(test_dir, "test_worker.py")
[w] = services.start_singlenode_cluster(return_drivers=True, num_workers_per_objstore=1, worker_path=test_path)
worker_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "test_worker.py")
[w] = services.start_singlenode_cluster(return_drivers=True, num_workers_per_objstore=1, worker_path=worker_path)
value_before = "test_string"
objref = w.submit_task("test_functions.print_string", [value_before])
@@ -176,9 +175,8 @@ class WorkerTest(unittest.TestCase):
class APITest(unittest.TestCase):
def testObjRefAliasing(self):
test_dir = os.path.dirname(os.path.abspath(__file__))
test_path = os.path.join(test_dir, "test_worker.py")
[w] = services.start_singlenode_cluster(return_drivers=True, num_workers_per_objstore=3, worker_path=test_path)
worker_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "test_worker.py")
[w] = services.start_singlenode_cluster(return_drivers=True, num_workers_per_objstore=3, worker_path=worker_path)
objref = w.submit_task("test_functions.test_alias_f", [])
self.assertTrue(np.alltrue(ray.pull(objref[0], w) == np.ones([3, 4, 5])))
@@ -190,9 +188,8 @@ class APITest(unittest.TestCase):
services.cleanup()
def testKeywordArgs(self):
test_dir = os.path.dirname(os.path.abspath(__file__))
test_path = os.path.join(test_dir, "test_worker.py")
services.start_singlenode_cluster(return_drivers=False, num_workers_per_objstore=1, worker_path=test_path)
worker_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "test_worker.py")
services.start_singlenode_cluster(return_drivers=False, num_workers_per_objstore=1, worker_path=worker_path)
x = test_functions.keyword_fct1(1)
self.assertEqual(ray.pull(x), "1 hello")
@@ -228,9 +225,8 @@ class APITest(unittest.TestCase):
services.cleanup()
def testVariableNumberOfArgs(self):
test_dir = os.path.dirname(os.path.abspath(__file__))
test_path = os.path.join(test_dir, "test_worker.py")
services.start_singlenode_cluster(return_drivers=False, num_workers_per_objstore=1, worker_path=test_path)
worker_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "test_worker.py")
services.start_singlenode_cluster(return_drivers=False, num_workers_per_objstore=1, worker_path=worker_path)
x = test_functions.varargs_fct1(0, 1, 2)
self.assertEqual(ray.pull(x), "0 1 2")
@@ -244,9 +240,8 @@ class APITest(unittest.TestCase):
class TaskStatusTest(unittest.TestCase):
def testFailedTask(self):
test_dir = os.path.dirname(os.path.abspath(__file__))
test_path = os.path.join(test_dir, "test_worker.py")
services.start_singlenode_cluster(return_drivers=False, num_workers_per_objstore=3, worker_path=test_path)
worker_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "test_worker.py")
services.start_singlenode_cluster(return_drivers=False, num_workers_per_objstore=3, worker_path=worker_path)
test_functions.test_alias_f()
test_functions.throw_exception_fct()
test_functions.throw_exception_fct()
@@ -264,9 +259,8 @@ class TaskStatusTest(unittest.TestCase):
class ReferenceCountingTest(unittest.TestCase):
def testDeallocation(self):
test_dir = os.path.dirname(os.path.abspath(__file__))
test_path = os.path.join(test_dir, "test_worker.py")
services.start_singlenode_cluster(return_drivers=False, num_workers_per_objstore=3, worker_path=test_path)
worker_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "test_worker.py")
services.start_singlenode_cluster(return_drivers=False, num_workers_per_objstore=3, worker_path=worker_path)
x = test_functions.test_alias_f()
ray.pull(x)