mirror of
https://github.com/wassname/ray.git
synced 2026-07-27 11:26:41 +08:00
Test blocking behavior of select. (#379)
This commit is contained in:
committed by
Philipp Moritz
parent
e06311d415
commit
314bc9e980
@@ -321,6 +321,16 @@ class APITest(unittest.TestCase):
|
||||
time.sleep(0.5)
|
||||
self.assertEqual(ray.select(objectids), [0, 1, 2, 3])
|
||||
|
||||
objectids = [f.remote(0.5), f.remote(0.75), f.remote(0.25), f.remote(1.0)]
|
||||
values = ["a", "b", "c", "d"]
|
||||
indices = []
|
||||
while len(objectids) > 0:
|
||||
index = ray.select(objectids, num_objects=1)[0]
|
||||
indices.append(values[index])
|
||||
objectids.pop(index)
|
||||
values.pop(index)
|
||||
self.assertEqual(indices, ["c", "a", "b", "d"])
|
||||
|
||||
ray.worker.cleanup()
|
||||
|
||||
def testCachingReusables(self):
|
||||
|
||||
Reference in New Issue
Block a user