From c5e6c90e1e5695d604ae3c5e4d0ac0015fea8ddb Mon Sep 17 00:00:00 2001 From: Kishan Sagathiya Date: Sat, 7 Nov 2020 00:15:44 +0530 Subject: [PATCH] [Core] Add name of actor in the result of `ray.actors()` (#11828) Added name field to `actor_info` Fixes #11112 --- python/ray/state.py | 1 + python/ray/tests/test_advanced_3.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/python/ray/state.py b/python/ray/state.py index c7ec20183..66cc60a13 100644 --- a/python/ray/state.py +++ b/python/ray/state.py @@ -237,6 +237,7 @@ class GlobalState: """ actor_info = { "ActorID": binary_to_hex(actor_table_data.actor_id), + "Name": actor_table_data.name, "JobID": binary_to_hex(actor_table_data.job_id), "Address": { "IPAddress": actor_table_data.address.ip_address, diff --git a/python/ray/tests/test_advanced_3.py b/python/ray/tests/test_advanced_3.py index 3acf170c1..6e279bcd4 100644 --- a/python/ray/tests/test_advanced_3.py +++ b/python/ray/tests/test_advanced_3.py @@ -154,7 +154,7 @@ def test_global_state_api(shutdown_only): def __init__(self): pass - _ = Actor.remote() # noqa: F841 + _ = Actor.options(name="test_actor").remote() # noqa: F841 # Wait for actor to be created wait_for_num_actors(1) @@ -163,6 +163,7 @@ def test_global_state_api(shutdown_only): actor_info, = actor_table.values() assert actor_info["JobID"] == job_id.hex() + assert actor_info["Name"] == "test_actor" assert "IPAddress" in actor_info["Address"] assert "IPAddress" in actor_info["OwnerAddress"] assert actor_info["Address"]["Port"] != actor_info["OwnerAddress"]["Port"]