[core] Cancel worker lease requests that are no longer needed (#7929)

* regression test

* Cancel lease requests

* unit tests

* update

* fix build

* Move unit test

* Set success

* Ref to shared_ptr

* debug

* Revert "debug"

This reverts commit 6b2c25805a8223b41ffcc2d88d903e16ea415089.

* Bad move

* Fix bad status handling
This commit is contained in:
Stephanie Wang
2020-04-11 16:51:32 -07:00
committed by GitHub
parent 87e3c39b48
commit 18e9a076e5
12 changed files with 366 additions and 51 deletions
+28
View File
@@ -661,6 +661,34 @@ def test_move_log_files_to_old(shutdown_only):
assert ray.services.remaining_processes_alive()
def test_lease_request_leak(shutdown_only):
ray.init(
num_cpus=1,
_internal_config=json.dumps({
"initial_reconstruction_timeout_milliseconds": 200
}))
assert len(ray.objects()) == 0
@ray.remote
def f(x):
time.sleep(0.1)
return
# Submit pairs of tasks. Tasks in a pair can reuse the same worker leased
# from the raylet.
tasks = []
for _ in range(10):
oid = ray.put(1)
for _ in range(2):
tasks.append(f.remote(oid))
del oid
ray.get(tasks)
time.sleep(
1) # Sleep for an amount longer than the reconstruction timeout.
assert len(ray.objects()) == 0, ray.objects()
if __name__ == "__main__":
import pytest
sys.exit(pytest.main(["-v", __file__]))