add fallback for acc metrics only on node level

This commit is contained in:
Christoph Kluge 2023-08-04 10:54:18 +02:00
parent 8a473de793
commit 298051c334
2 changed files with 16 additions and 5 deletions

View File

@ -34,6 +34,7 @@
export let roles; export let roles;
const accMetrics = ['acc_utilization', 'acc_mem_used', 'acc_power', 'nv_mem_util', 'nv_sm_clock', 'nv_temp']; const accMetrics = ['acc_utilization', 'acc_mem_used', 'acc_power', 'nv_mem_util', 'nv_sm_clock', 'nv_temp'];
let accNodeOnly
const { query: initq } = init(` const { query: initq } = init(`
job(id: "${dbid}") { job(id: "${dbid}") {
@ -78,7 +79,7 @@
]); ]);
// 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 accNodeOnly = [...toFetch].some(function(m) { 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)
return mc.scope !== 'accelerator' return mc.scope !== 'accelerator'
@ -398,6 +399,7 @@
job={$initq.data.job} job={$initq.data.job}
jobMetrics={$jobMetrics.data.jobMetrics} jobMetrics={$jobMetrics.data.jobMetrics}
accMetrics={accMetrics} accMetrics={accMetrics}
accNodeOnly={accNodeOnly}
/> />
{/key} {/key}
{/if} {/if}

View File

@ -8,6 +8,7 @@
export let job export let job
export let jobMetrics export let jobMetrics
export let accMetrics export let accMetrics
export let accNodeOnly
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
@ -22,9 +23,17 @@
|| getContext('cc-config')['job_view_nodestats_selectedMetrics'] || getContext('cc-config')['job_view_nodestats_selectedMetrics']
for (let metric of allMetrics) { for (let metric of allMetrics) {
// 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) ? selectedScopes[metric] = (job.exclusive != 1 || job.numNodes == 1) ?
(job.numAccs != 0 && accMetrics.includes(metric)) ? 'accelerator' : 'core' (job.numAccs != 0 && accMetrics.includes(metric)) ?
: maxScope(scopesForMetric(metric)) accNodeOnly ?
'node'
: '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 },