mirror of
https://github.com/wassname/ray.git
synced 2026-06-29 04:44:28 +08:00
[Core]Fix get workrer table bug (#11516)
* fix get_worker_table bug * fix lint * fix comment * remove actor table * fix comment * fix get alive worker * remove unused python import
This commit is contained in:
@@ -110,6 +110,7 @@ __all__ = [
|
||||
"get_runtime_context",
|
||||
"actor",
|
||||
"actors",
|
||||
"workers",
|
||||
"available_resources",
|
||||
"cancel",
|
||||
"cluster_resources",
|
||||
|
||||
@@ -112,7 +112,7 @@ cdef class GlobalStateAccessor:
|
||||
def get_worker_table(self):
|
||||
cdef c_vector[c_string] result
|
||||
with nogil:
|
||||
self.inner.get().GetAllWorkerInfo()
|
||||
result = self.inner.get().GetAllWorkerInfo()
|
||||
return result
|
||||
|
||||
def get_worker_info(self, worker_id):
|
||||
|
||||
@@ -876,6 +876,15 @@ def nodes():
|
||||
return state.node_table()
|
||||
|
||||
|
||||
def workers():
|
||||
"""Get a list of the workers in the cluster.
|
||||
|
||||
Returns:
|
||||
Information about the Ray workers in the cluster.
|
||||
"""
|
||||
return state.workers()
|
||||
|
||||
|
||||
def current_node_id():
|
||||
"""Return the node id of the current node.
|
||||
|
||||
|
||||
@@ -110,6 +110,14 @@ def test_global_state_actor_table(ray_start_regular):
|
||||
assert get_state() == dead_state
|
||||
|
||||
|
||||
def test_global_state_worker_table(ray_start_regular):
|
||||
|
||||
# Get worker table from gcs.
|
||||
workers_data = ray.state.workers()
|
||||
|
||||
assert len(workers_data) == 1
|
||||
|
||||
|
||||
def test_global_state_actor_entry(ray_start_regular):
|
||||
@ray.remote
|
||||
class Actor:
|
||||
|
||||
Reference in New Issue
Block a user