[Core] Force get_actor(name)'s name to be non-empty string (#12218)

This commit is contained in:
Ian Rodney
2020-11-23 12:38:16 -08:00
committed by GitHub
parent 32d159a2ed
commit 7f1f16d99e
3 changed files with 11 additions and 0 deletions
+6
View File
@@ -1032,6 +1032,12 @@ def test_kill(ray_start_regular_shared):
ray.kill("not_an_actor_handle")
def test_get_actor_no_input(ray_start_regular_shared):
for bad_name in [None, "", " "]:
with pytest.raises(ValueError):
ray.get_actor(bad_name)
if __name__ == "__main__":
import pytest
sys.exit(pytest.main(["-v", __file__]))
+2
View File
@@ -1538,6 +1538,8 @@ def get_actor(name):
Raises:
ValueError if the named actor does not exist.
"""
if not name:
raise ValueError("Please supply a non-empty value to get_actor")
worker = global_worker
worker.check_connected()
handle = worker.core_worker.get_named_actor_handle(name)