Skip to content

Commit

Permalink
Address comments: filter live nodes for get_all_node_info
Browse files Browse the repository at this point in the history
Signed-off-by: Chi-Sheng Liu <chishengliu@chishengliu.com>
  • Loading branch information
MortalHappiness committed Feb 25, 2025
1 parent 1a8ce21 commit daa21d8
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions python/ray/dashboard/state_aggregator.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
protobuf_to_task_state_dict,
)
from ray.util.state.state_manager import DataSourceUnavailable, StateDataSourceClient
from ray.core.generated.gcs_pb2 import GcsNodeInfo

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -364,7 +363,9 @@ async def list_objects(self, *, option: ListApiOptions) -> ListApiResponse:
object_data_in_dict's schema is in ObjectState
"""
all_node_info_reply = await self._client.get_all_node_info(
timeout=option.timeout, limit=None
timeout=option.timeout,
limit=None,
filters=[("state", "=", "ALIVE")],
)
tasks = [
self._client.get_object_info(
Expand Down Expand Up @@ -476,14 +477,15 @@ async def list_runtime_envs(self, *, option: ListApiOptions) -> ListApiResponse:
We don't have id -> data mapping like other API because runtime env
doesn't have unique ids.
"""
all_node_info_reply = await self._client.get_all_node_info(
timeout=option.timeout, limit=None
live_node_info_reply = await self._client.get_all_node_info(
timeout=option.timeout,
limit=None,
filters=[("state", "=", "ALIVE")],
)
node_infos = [
node_info
for node_info in all_node_info_reply.node_info_list
if node_info.state == GcsNodeInfo.GcsNodeState.ALIVE
and node_info.runtime_env_agent_port is not None
for node_info in live_node_info_reply.node_info_list
if node_info.runtime_env_agent_port is not None
]
tasks = [
self._client.get_runtime_envs_info(
Expand Down

0 comments on commit daa21d8

Please sign in to comment.