From 16ec1e69d949a3266eb71b67bdd23245366e11bd Mon Sep 17 00:00:00 2001 From: Christoph Kluge Date: Thu, 19 Mar 2026 13:30:38 +0100 Subject: [PATCH] streamline and unify statsSeries calc and render --- internal/metricdispatch/dataLoader.go | 4 ++-- web/frontend/src/generic/joblist/JobListRow.svelte | 2 +- web/frontend/src/generic/plots/DoubleMetricPlot.svelte | 4 ++-- web/frontend/src/generic/plots/MetricPlot.svelte | 8 +------- web/frontend/src/job/Metric.svelte | 1 - web/frontend/src/systems/nodelist/NodeListRow.svelte | 5 ++--- 6 files changed, 8 insertions(+), 16 deletions(-) diff --git a/internal/metricdispatch/dataLoader.go b/internal/metricdispatch/dataLoader.go index c420fee4..2970f527 100644 --- a/internal/metricdispatch/dataLoader.go +++ b/internal/metricdispatch/dataLoader.go @@ -192,10 +192,10 @@ func LoadData(job *schema.Job, // Generate statistics series for jobs with many nodes to enable min/median/max graphs // instead of overwhelming the UI with individual node lines. Note that newly calculated // statistics use min/median/max, while archived statistics may use min/mean/max. - const maxSeriesSize int = 15 + const maxSeriesSize int = 8 for _, scopes := range jd { for _, jm := range scopes { - if jm.StatisticsSeries != nil || len(jm.Series) <= maxSeriesSize { + if jm.StatisticsSeries != nil || len(jm.Series) < maxSeriesSize { continue } diff --git a/web/frontend/src/generic/joblist/JobListRow.svelte b/web/frontend/src/generic/joblist/JobListRow.svelte index e9382bee..c0b18e63 100644 --- a/web/frontend/src/generic/joblist/JobListRow.svelte +++ b/web/frontend/src/generic/joblist/JobListRow.svelte @@ -229,7 +229,7 @@ timestep={metric.data.metric.timestep} scope={metric.data.scope} series={metric.data.metric.series} - statisticsSeries={metric.data.metric.statisticsSeries} + statisticsSeries={metric.data.metric?.statisticsSeries} metric={metric.data.name} cluster={clusterInfos.find((c) => c.name == job.cluster)} subCluster={job.subCluster} diff --git a/web/frontend/src/generic/plots/DoubleMetricPlot.svelte b/web/frontend/src/generic/plots/DoubleMetricPlot.svelte index a3a5bb28..5372aa22 100644 --- a/web/frontend/src/generic/plots/DoubleMetricPlot.svelte +++ b/web/frontend/src/generic/plots/DoubleMetricPlot.svelte @@ -236,7 +236,7 @@ // conditional hide series color markers: if ( - // useStatsSeries || // Min/Max/Median Self-Explanatory + // Min/Max/Median Self-Explanatory dataSize === 1 || // Only one Y-Dataseries dataSize > 8 // More than 8 Y-Dataseries ) { @@ -273,7 +273,7 @@ } } - if (dataSize <= 12 ) { // || useStatsSeries) { + if (dataSize <= 12 ) { return { hooks: { init: init, diff --git a/web/frontend/src/generic/plots/MetricPlot.svelte b/web/frontend/src/generic/plots/MetricPlot.svelte index 3969161d..7f72a298 100644 --- a/web/frontend/src/generic/plots/MetricPlot.svelte +++ b/web/frontend/src/generic/plots/MetricPlot.svelte @@ -9,7 +9,6 @@ - `height Number?`: The plot height [Default: 300] - `timestep Number`: The timestep used for X-axis rendering - `series [GraphQL.Series]`: The metric data object - - `useStatsSeries Bool?`: If this plot uses the statistics Min/Max/Median representation; automatically set to according bool [Default: false] - `statisticsSeries [GraphQL.StatisticsSeries]?`: Min/Max/Median representation of metric data [Default: null] - `cluster String?`: Cluster name of the parent job / data [Default: ""] - `subCluster String`: Name of the subCluster of the parent job @@ -37,7 +36,6 @@ height = 300, timestep, series, - useStatsSeries = false, statisticsSeries = null, cluster = "", subCluster, @@ -78,6 +76,7 @@ const resampleTrigger = $derived(resampleConfig?.trigger ? Number(resampleConfig.trigger) : null); const resampleResolutions = $derived(resampleConfig?.resolutions ? [...resampleConfig.resolutions] : null); const resampleMinimum = $derived(resampleConfig?.resolutions ? Math.min(...resampleConfig.resolutions) : null); + const useStatsSeries = $derived(!!statisticsSeries); // Display Stats Series By Default if Exists const thresholds = $derived(findJobAggregationThresholds( subClusterTopology, metricConfig, @@ -243,11 +242,6 @@ return pendingSeries; }) - /* Effects */ - $effect(() => { - if (!useStatsSeries && statisticsSeries != null) useStatsSeries = true; - }) - // This updates plot on all size changes if wrapper (== data) exists $effect(() => { if (plotWrapper) { diff --git a/web/frontend/src/job/Metric.svelte b/web/frontend/src/job/Metric.svelte index 1beb88fb..a0ab18e5 100644 --- a/web/frontend/src/job/Metric.svelte +++ b/web/frontend/src/job/Metric.svelte @@ -197,7 +197,6 @@ {zoomState} {thresholdState} statisticsSeries={statsSeries[selectedScopeIndex]} - useStatsSeries={!!statsSeries[selectedScopeIndex]} enableFlip /> {/if} diff --git a/web/frontend/src/systems/nodelist/NodeListRow.svelte b/web/frontend/src/systems/nodelist/NodeListRow.svelte index 62b6517b..dc8ea09e 100644 --- a/web/frontend/src/systems/nodelist/NodeListRow.svelte +++ b/web/frontend/src/systems/nodelist/NodeListRow.svelte @@ -174,7 +174,7 @@

No dataset(s) returned for {selectedMetrics[i]}

Metric or host was not found in metric store for cluster {cluster}.

- {:else if !!metricData.data?.metric.statisticsSeries} + {:else if !!metricData?.data?.metric?.statisticsSeries}