From 298051c33489f3224a28b3a9915608cb9a4ec154 Mon Sep 17 00:00:00 2001 From: Christoph Kluge Date: Fri, 4 Aug 2023 10:54:18 +0200 Subject: [PATCH] add fallback for acc metrics only on node level --- web/frontend/src/Job.root.svelte | 4 +++- web/frontend/src/StatsTable.svelte | 17 +++++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/web/frontend/src/Job.root.svelte b/web/frontend/src/Job.root.svelte index 0806768..9017144 100644 --- a/web/frontend/src/Job.root.svelte +++ b/web/frontend/src/Job.root.svelte @@ -34,6 +34,7 @@ export let roles; const accMetrics = ['acc_utilization', 'acc_mem_used', 'acc_power', 'nv_mem_util', 'nv_sm_clock', 'nv_temp']; + let accNodeOnly const { query: initq } = init(` job(id: "${dbid}") { @@ -78,7 +79,7 @@ ]); // Select default Scopes to load: Check before if accelerator metrics are not on accelerator scope by default - const accNodeOnly = [...toFetch].some(function(m) { + accNodeOnly = [...toFetch].some(function(m) { if (accMetrics.includes(m)) { const mc = metrics(job.cluster, m) return mc.scope !== 'accelerator' @@ -398,6 +399,7 @@ job={$initq.data.job} jobMetrics={$jobMetrics.data.jobMetrics} accMetrics={accMetrics} + accNodeOnly={accNodeOnly} /> {/key} {/if} diff --git a/web/frontend/src/StatsTable.svelte b/web/frontend/src/StatsTable.svelte index ae15437..e85e835 100644 --- a/web/frontend/src/StatsTable.svelte +++ b/web/frontend/src/StatsTable.svelte @@ -8,6 +8,7 @@ export let job export let jobMetrics export let accMetrics + export let accNodeOnly const allMetrics = [...new Set(jobMetrics.map(m => m.name))].sort(), scopesForMetric = (metric) => jobMetrics @@ -20,11 +21,19 @@ isMetricSelectionOpen = false, selectedMetrics = getContext('cc-config')[`job_view_nodestats_selectedMetrics:${job.cluster}`] || getContext('cc-config')['job_view_nodestats_selectedMetrics'] - + for (let metric of allMetrics) { - selectedScopes[metric] = (job.exclusive != 1 || job.numNodes == 1) ? - (job.numAccs != 0 && accMetrics.includes(metric)) ? 'accelerator' : 'core' - : maxScope(scopesForMetric(metric)) + // Not Exclusive or Single Node: Get maxScope() + // No Accelerators in Job and not Acc-Metric: Use 'core' + // Accelerator Metric available on accelerator scope: Use 'accelerator' + // Accelerator Metric only on node scope: Fallback to 'node' + selectedScopes[metric] = (job.exclusive != 1 || job.numNodes == 1) ? + (job.numAccs != 0 && accMetrics.includes(metric)) ? + accNodeOnly ? + 'node' + : 'accelerator' + : 'core' + : maxScope(scopesForMetric(metric)) sorting[metric] = { min: { dir: 'up', active: false }, avg: { dir: 'up', active: false },