From a5c846c83be84bd0adfb757e6e8c3ed618df6ac7 Mon Sep 17 00:00:00 2001 From: Max Fitton Date: Wed, 2 Dec 2020 14:08:14 -0800 Subject: [PATCH] [Dashboard][Bugfix] Filter dead nodes from Machine View (fixes duplicate node issue) (#12579) --- dashboard/client/src/api.ts | 2 +- .../client/src/pages/dashboard/node-info/NodeInfo.tsx | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/dashboard/client/src/api.ts b/dashboard/client/src/api.ts index d8a979c58..767ee4a0d 100644 --- a/dashboard/client/src/api.ts +++ b/dashboard/client/src/api.ts @@ -112,7 +112,7 @@ export type NodeDetails = { } & BaseNodeInfo; export type RayletData = { - // Merger of GCSNodeStats and GetNodeStatsReply + // Merger of GCSNodeInfo and GetNodeStatsReply // GetNodeStatsReply fields. // Note workers are in an array in NodeDetails objectStoreUsedMemory: number; diff --git a/dashboard/client/src/pages/dashboard/node-info/NodeInfo.tsx b/dashboard/client/src/pages/dashboard/node-info/NodeInfo.tsx index 2b1a12c03..c3669eaa2 100644 --- a/dashboard/client/src/pages/dashboard/node-info/NodeInfo.tsx +++ b/dashboard/client/src/pages/dashboard/node-info/NodeInfo.tsx @@ -139,7 +139,12 @@ const useNodeInfoStyles = makeStyles((theme: Theme) => }), ); -const nodesSelector = (state: StoreState) => state.dashboard?.nodeInfo?.clients; +// Dead node payloads don't contain the full information needed to render +// so we filter them out here. +const liveNodesSelector = (state: StoreState) => + state.dashboard?.nodeInfo?.clients.filter( + (node) => node.raylet.state === "ALIVE", + ); type DialogState = { nodeIp: string; @@ -170,7 +175,7 @@ const NodeInfo: React.FC<{}> = () => { const toggleOrder = () => setOrder(order === "asc" ? "desc" : "asc"); const [orderBy, setOrderBy] = React.useState(null); const classes = useNodeInfoStyles(); - const nodes = useSelector(nodesSelector); + const nodes = useSelector(liveNodesSelector); if (!nodes) { return Loading...; }