Add metrics to histoselect, add userfilters

- edit struct to make only count return required
This commit is contained in:
Christoph Kluge
2023-12-08 12:03:04 +01:00
parent 7d14086e54
commit 1185737eaa
8 changed files with 136 additions and 130 deletions

View File

@@ -4,10 +4,10 @@
import { gql, getContextClient , mutationStore } from '@urql/svelte'
export let cluster
export let availableMetrics = ['cpu_load', 'flops_any', 'mem_bw']
export let metricsInHistograms
export let isOpen
let availableMetrics = ['cpu_load', 'flops_any', 'mem_used', 'mem_bw', 'net_bw', 'file_bw']
let pendingMetrics = [...metricsInHistograms] // Copy
const client = getContextClient()

View File

@@ -44,7 +44,7 @@
histNumNodes { count, value }
histMetrics { metric, unit, data { min, max, count, bin } }
}}`,
variables: { jobFilters, metricsInHistograms}
variables: { jobFilters, metricsInHistograms }
})
onMount(() => filterComponent.update())

View File

@@ -316,16 +316,18 @@ export function checkMetricDisabled(m, c, s) { //[m]etric, [c]luster, [s]ubclust
}
export function convert2uplot(canvasData) {
// initial use: Canvas Histogram Data to Uplot
// Prep: Uplot Data Structure
let uplotData = [[],[]] // [X, Y1, Y2, ...]
// MetricHisto Only: Check if 1st bin not-null -> Set 0-Value bin for scaling
// Else: Only Single 0-Value bin returned -> No reset required
if (canvasData[0]?.bin) {
uplotData[0].push(0)
uplotData[1].push(0)
}
// Iterate
canvasData.forEach( cd => {
if (cd.bin) { // MetricHisto Datafromat
// Force Zero Entry for scaling
if (uplotData[0].length == 0) {
uplotData[0].push(0)
uplotData[1].push(0)
}
uplotData[0].push(cd.max)
if (Object.keys(cd).length == 4) { // MetricHisto Datafromat
uplotData[0].push(cd?.max ? cd.max : 0)
uplotData[1].push(cd.count)
} else { // Default
uplotData[0].push(cd.value)