From 599a36466a064102ba461195c4c30fdc69e019d8 Mon Sep 17 00:00:00 2001 From: Christoph Kluge Date: Tue, 20 Aug 2024 14:52:13 +0200 Subject: [PATCH] fix new data reactivity for accelerators --- web/frontend/src/job/Metric.svelte | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/web/frontend/src/job/Metric.svelte b/web/frontend/src/job/Metric.svelte index eb4c90b..5c5a87a 100644 --- a/web/frontend/src/job/Metric.svelte +++ b/web/frontend/src/job/Metric.svelte @@ -18,7 +18,6 @@ gql, getContextClient } from "@urql/svelte"; - // import { createEventDispatcher } from "svelte"; import { InputGroup, InputGroupText, @@ -44,11 +43,10 @@ let selectedResolution; let pendingResolution = 600; let selectedScopeIndex = scopes.findIndex((s) => s == minScope(scopes)); - const statsPattern = /(.*)-stat$/; let patternMatches = false; let statsSeries = rawData.map((data) => data?.statisticsSeries ? data.statisticsSeries : null); - // const dispatch = createEventDispatcher(); + const statsPattern = /(.*)-stat$/; const unit = (metricUnit?.prefix ? metricUnit.prefix : "") + (metricUnit?.base ? metricUnit.base : ""); const resolutions = [600, 240, 60] // DEV: Make configable const client = getContextClient(); @@ -89,21 +87,23 @@ const selectedMetrics = [metricName] $: if (selectedScope || pendingResolution) { - - if (selectedScope == "load-all") { - selectedScopes = [...scopes, "socket", "core"] - } - - // What if accelerator scope / native core scopes? - if ((selectedResolution !== pendingResolution) && selectedScopes.length >= 2) { - selectedScope = String("node") - selectedScopes = ["node"] - } - if (!selectedResolution) { // Skips reactive data load on init selectedResolution = Number(pendingResolution) + } else { + + if (selectedScope == "load-all") { + selectedScopes = [...scopes, "socket", "core", "accelerator"] + } + + if ((selectedResolution !== pendingResolution) && selectedScopes.length >= 2) { + selectedScope = String("node") + selectedScopes = ["node"] + // Instead of adding acc to load-all: always add by default if native is acc + // selectedScopes = nativeScope == "accelerator" ? ["node", "accelerator"] : ["node"] + } + selectedResolution = Number(pendingResolution) metricData = queryStore({