[Core] fix named actor bug (#10550)

This commit is contained in:
Edward Oakes
2020-09-03 19:48:31 -05:00
committed by GitHub
parent 94374e1dd9
commit ead30ca655
3 changed files with 33 additions and 2 deletions
+23 -1
View File
@@ -11,7 +11,8 @@ import time
import ray
import ray.test_utils
import ray.cluster_utils
from ray.test_utils import run_string_as_driver, get_non_head_nodes
from ray.test_utils import (run_string_as_driver, get_non_head_nodes,
wait_for_condition)
from ray.experimental.internal_kv import _internal_kv_get, _internal_kv_put
@@ -646,6 +647,27 @@ assert ray.get(handle.ping.remote()) == "pong"
detached_actor = ray.get_actor("actor")
ray.get(detached_actor.ping.remote())
# Check that the names are reclaimed after actors die.
def check_name_available(name):
try:
ray.get_actor(name)
return False
except ValueError:
return True
@ray.remote
class A:
pass
a = A.options(name="my_actor_1").remote()
ray.kill(a, no_restart=True)
wait_for_condition(lambda: check_name_available("my_actor_1"))
b = A.options(name="my_actor_2").remote()
del b
wait_for_condition(lambda: check_name_available("my_actor_2"))
def test_detached_actor(ray_start_regular):
@ray.remote