mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2024-12-27 05:49:04 +01:00
Add colors based on thresholds
This commit is contained in:
parent
9689f95ea1
commit
a2c99fb56d
@ -29,7 +29,7 @@
|
|||||||
export let jobMetrics
|
export let jobMetrics
|
||||||
|
|
||||||
export let size = 200
|
export let size = 200
|
||||||
export let displayLegend = true
|
export let displayLegend = false
|
||||||
|
|
||||||
const footprintMetrics = ['mem_used', 'mem_bw','flops_any', 'cpu_load', 'acc_utilization'] // missing: energy , move to central config before deployment
|
const footprintMetrics = ['mem_used', 'mem_bw','flops_any', 'cpu_load', 'acc_utilization'] // missing: energy , move to central config before deployment
|
||||||
|
|
||||||
@ -56,7 +56,7 @@
|
|||||||
|
|
||||||
console.log("MVs", meanVals)
|
console.log("MVs", meanVals)
|
||||||
|
|
||||||
const footprintLabels = meanVals.map((mv) => [mv.name, mv.name+' Threshold'])
|
const footprintLabels = meanVals.map((mv) => [mv.name, 'Threshold'])
|
||||||
|
|
||||||
const footprintData = meanVals.map((mv) => {
|
const footprintData = meanVals.map((mv) => {
|
||||||
const metricConfig = footprintMetricConfigs.find((fmc) => fmc.name === mv.name)
|
const metricConfig = footprintMetricConfigs.find((fmc) => fmc.name === mv.name)
|
||||||
@ -65,35 +65,49 @@
|
|||||||
const levelCaution = metricConfig.caution - mv.avg
|
const levelCaution = metricConfig.caution - mv.avg
|
||||||
const levelAlert = metricConfig.alert - mv.avg
|
const levelAlert = metricConfig.alert - mv.avg
|
||||||
|
|
||||||
if (levelAlert > 0) {
|
if (mv.name !== 'mem_used') { // Alert if usage is low, peak is high good usage
|
||||||
return [mv.avg, levelAlert]
|
if (levelAlert > 0) {
|
||||||
} else if (levelCaution > 0) {
|
return {data: [mv.avg, levelAlert], color: ['hsl(0, 100%, 60%)', '#AAA']} // 'hsl(0, 100%, 35%)'
|
||||||
return [mv.avg, levelCaution]
|
} else if (levelCaution > 0) {
|
||||||
} else if (levelNormal > 0) {
|
return {data: [mv.avg, levelCaution], color: ['hsl(56, 100%, 50%)', '#AAA']} // '#d5b60a'
|
||||||
return [mv.avg, levelNormal]
|
} else if (levelNormal > 0) {
|
||||||
} else {
|
return {data: [mv.avg, levelNormal], color: ['hsl(100, 100%, 60%)', '#AAA']} // 'hsl(100, 100%, 35%)'
|
||||||
return [mv.avg, levelPeak]
|
} else {
|
||||||
|
return {data: [mv.avg, levelPeak], color: ['hsl(180, 100%, 60%)', '#AAA']} // 'hsl(180, 100%, 35%)'
|
||||||
|
}
|
||||||
|
} else { // Inverse Logic: Alert if usage is high, Peak is bad and limits execution
|
||||||
|
if (levelPeak > 0 && (levelAlert <= 0 && levelCaution <= 0 && levelNormal <= 0)) {
|
||||||
|
return {data: [mv.avg, levelPeak], color: ['#7F00FF', '#AAA']} // '#5D3FD3'
|
||||||
|
} else if (levelAlert > 0 && (levelCaution <= 0 && levelNormal <= 0)) {
|
||||||
|
return {data: [mv.avg, levelAlert], color: ['hsl(0, 100%, 60%)', '#AAA']} // 'hsl(0, 100%, 35%)'
|
||||||
|
} else if (levelCaution > 0 && levelNormal <= 0) {
|
||||||
|
return {data: [mv.avg, levelCaution], color: ['hsl(56, 100%, 50%)', '#AAA']} // '#d5b60a'
|
||||||
|
} else {
|
||||||
|
return {data: [mv.avg, levelNormal], color: ['hsl(100, 100%, 60%)', '#AAA']} // 'hsl(100, 100%, 35%)'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
console.log("FPD", footprintData)
|
||||||
|
|
||||||
$: data = {
|
$: data = {
|
||||||
labels: footprintLabels.flat(),
|
labels: footprintLabels.flat(),
|
||||||
datasets: [
|
datasets: [
|
||||||
{
|
{
|
||||||
backgroundColor: ['#AAA', '#777'],
|
backgroundColor: footprintData[0].color,
|
||||||
data: footprintData[0]
|
data: footprintData[0].data
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
backgroundColor: ['hsl(0, 100%, 60%)', 'hsl(0, 100%, 35%)'],
|
backgroundColor: footprintData[1].color,
|
||||||
data: footprintData[1]
|
data: footprintData[1].data
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
backgroundColor: ['hsl(100, 100%, 60%)', 'hsl(100, 100%, 35%)'],
|
backgroundColor: footprintData[2].color,
|
||||||
data: footprintData[2]
|
data: footprintData[2].data
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
backgroundColor: ['hsl(180, 100%, 60%)', 'hsl(180, 100%, 35%)'],
|
backgroundColor: footprintData[3].color,
|
||||||
data: footprintData[3]
|
data: footprintData[3].data
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user