From 8a473de793278e3133ca038fff28c967c7601577 Mon Sep 17 00:00:00 2001 From: Christoph Kluge Date: Thu, 3 Aug 2023 19:09:15 +0200 Subject: [PATCH] fix: core/accelerator scope in statstable on load --- web/frontend/src/Job.root.svelte | 4 +++- web/frontend/src/StatsTable.svelte | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/web/frontend/src/Job.root.svelte b/web/frontend/src/Job.root.svelte index 21f0c7f..0806768 100644 --- a/web/frontend/src/Job.root.svelte +++ b/web/frontend/src/Job.root.svelte @@ -33,6 +33,8 @@ export let authlevel; export let roles; + const accMetrics = ['acc_utilization', 'acc_mem_used', 'acc_power', 'nv_mem_util', 'nv_sm_clock', 'nv_temp']; + const { query: initq } = init(` job(id: "${dbid}") { id, jobId, user, project, cluster, startTime, @@ -76,7 +78,6 @@ ]); // Select default Scopes to load: Check before if accelerator metrics are not on accelerator scope by default - const accMetrics = ['acc_utilization', 'acc_mem_used', 'acc_power', 'nv_mem_util', 'nv_sm_clock', 'nv_temp'] const accNodeOnly = [...toFetch].some(function(m) { if (accMetrics.includes(m)) { const mc = metrics(job.cluster, m) @@ -396,6 +397,7 @@ bind:this={statsTable} job={$initq.data.job} jobMetrics={$jobMetrics.data.jobMetrics} + accMetrics={accMetrics} /> {/key} {/if} diff --git a/web/frontend/src/StatsTable.svelte b/web/frontend/src/StatsTable.svelte index f40c204..ae15437 100644 --- a/web/frontend/src/StatsTable.svelte +++ b/web/frontend/src/StatsTable.svelte @@ -7,6 +7,7 @@ export let job export let jobMetrics + export let accMetrics const allMetrics = [...new Set(jobMetrics.map(m => m.name))].sort(), scopesForMetric = (metric) => jobMetrics @@ -21,7 +22,9 @@ || getContext('cc-config')['job_view_nodestats_selectedMetrics'] for (let metric of allMetrics) { - selectedScopes[metric] = maxScope(scopesForMetric(metric)) + selectedScopes[metric] = (job.exclusive != 1 || job.numNodes == 1) ? + (job.numAccs != 0 && accMetrics.includes(metric)) ? 'accelerator' : 'core' + : maxScope(scopesForMetric(metric)) sorting[metric] = { min: { dir: 'up', active: false }, avg: { dir: 'up', active: false },