fix: core/accelerator scope in statstable on load

This commit is contained in:
Christoph Kluge 2023-08-03 19:09:15 +02:00
parent 38f58047f2
commit 8a473de793
2 changed files with 7 additions and 2 deletions

View File

@ -33,6 +33,8 @@
export let authlevel; export let authlevel;
export let roles; export let roles;
const accMetrics = ['acc_utilization', 'acc_mem_used', 'acc_power', 'nv_mem_util', 'nv_sm_clock', 'nv_temp'];
const { query: initq } = init(` const { query: initq } = init(`
job(id: "${dbid}") { job(id: "${dbid}") {
id, jobId, user, project, cluster, startTime, 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 // 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) { const accNodeOnly = [...toFetch].some(function(m) {
if (accMetrics.includes(m)) { if (accMetrics.includes(m)) {
const mc = metrics(job.cluster, m) const mc = metrics(job.cluster, m)
@ -396,6 +397,7 @@
bind:this={statsTable} bind:this={statsTable}
job={$initq.data.job} job={$initq.data.job}
jobMetrics={$jobMetrics.data.jobMetrics} jobMetrics={$jobMetrics.data.jobMetrics}
accMetrics={accMetrics}
/> />
{/key} {/key}
{/if} {/if}

View File

@ -7,6 +7,7 @@
export let job export let job
export let jobMetrics export let jobMetrics
export let accMetrics
const allMetrics = [...new Set(jobMetrics.map(m => m.name))].sort(), const allMetrics = [...new Set(jobMetrics.map(m => m.name))].sort(),
scopesForMetric = (metric) => jobMetrics scopesForMetric = (metric) => jobMetrics
@ -21,7 +22,9 @@
|| getContext('cc-config')['job_view_nodestats_selectedMetrics'] || getContext('cc-config')['job_view_nodestats_selectedMetrics']
for (let metric of allMetrics) { 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] = { sorting[metric] = {
min: { dir: 'up', active: false }, min: { dir: 'up', active: false },
avg: { dir: 'up', active: false }, avg: { dir: 'up', active: false },