mirror of
https://github.com/wassname/ray.git
synced 2026-06-30 08:10:28 +08:00
[Core] Force get_actor(name)'s name to be non-empty string (#12218)
This commit is contained in:
@@ -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__]))
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user