mirror of
https://github.com/wassname/ray.git
synced 2026-07-07 21:02:05 +08:00
[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:
@@ -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__]))
|
||||
|
||||
Reference in New Issue
Block a user