Skip to content

Commit

Permalink
fix frontend crash caused by missing data for warnings (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
conradtchan authored Nov 8, 2024
1 parent d712a6f commit 06072a9
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions frontend/src/warnings.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,25 @@ export function instantWarnings(data) {
if (node.cpu.core.length > 0) {
for (let k = 0; k < nCores; k += 1) {
const iLayout = layout[k];
cpuUsage += node.cpu.core[iLayout][config.cpuKeys.user]

// Check if iLayout is in node.cpu.core
if (iLayout <= node.cpu.core.length) {
cpuUsage += node.cpu.core[iLayout][config.cpuKeys.user]
+ node.cpu.core[iLayout][config.cpuKeys.system]
+ node.cpu.core[iLayout][config.cpuKeys.nice];
cpuSys += node.cpu.core[iLayout][config.cpuKeys.system];
cpuWait += node.cpu.core[iLayout][config.cpuKeys.wait];
cpuSys += node.cpu.core[iLayout][config.cpuKeys.system];
cpuWait += node.cpu.core[iLayout][config.cpuKeys.wait];
} else {
// If the core is not reported, there is likely a transient issue with telegraf
// Set usage to 100 if per-core usage is not reported
// to prevent false alarm
cpuUsage += 100;
}
}
} else {
// Set usage to 100 if per-core usage is not reported
// to prevent false alarm
cpuUsage += 100;
cpuUsage += 100 * nCores;
}

// Perform util check unless this is a single-core GPU job
Expand Down

0 comments on commit 06072a9

Please sign in to comment.