[Dashboard][Bugfix] Filter dead nodes from Machine View (fixes duplicate node issue) (#12579)

This commit is contained in:
Max Fitton 2020-12-02 14:08:14 -08:00 committed by GitHub
parent 2ec7b7367e
commit a5c846c83b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View file

@ -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;

View file

@ -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<nodeInfoColumnId | null>(null);
const classes = useNodeInfoStyles();
const nodes = useSelector(nodesSelector);
const nodes = useSelector(liveNodesSelector);
if (!nodes) {
return <Typography color="textSecondary">Loading...</Typography>;
}