Fix wait timeout logic (#10199)

This commit is contained in:
Edward Oakes
2020-08-25 22:41:39 -05:00
committed by GitHub
parent 08adbb371f
commit cbd9632f3a
3 changed files with 31 additions and 44 deletions
+16
View File
@@ -258,6 +258,22 @@ def test_put_get(shutdown_only):
assert value_before == value_after
def test_wait_timing(shutdown_only):
ray.init(num_cpus=2)
@ray.remote
def f():
time.sleep(1)
future = f.remote()
start = time.time()
ready, not_ready = ray.wait([future], timeout=0.2)
assert 0.2 < time.time() - start < 0.3
assert len(ready) == 0
assert len(not_ready) == 1
def test_function_descriptor():
python_descriptor = ray._raylet.PythonFunctionDescriptor(
"module_name", "function_name", "class_name", "function_hash")