Skip to content

Commit

Permalink
fix: fix scope autoselect on jobview statstable
Browse files Browse the repository at this point in the history
  • Loading branch information
spacehamster87 committed Nov 29, 2023
1 parent 782262b commit aac3e7d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 19 deletions.
8 changes: 4 additions & 4 deletions web/frontend/src/Job.root.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@
startFetching(
job,
[...toFetch],
job.numNodes > 2 ? ["node"] : ["node", "core"]
job.numNodes > 2
? ["node"]
: ["node", "socket", "core"]
);
} else {
// Accels and not on node scope
Expand All @@ -102,7 +104,7 @@
[...toFetch],
job.numNodes > 2
? ["node", "accelerator"]
: ["node", "accelerator", "core"]
: ["node", "accelerator", "socket", "core"]
);
}
Expand Down Expand Up @@ -390,8 +392,6 @@
bind:this={statsTable}
job={$initq.data.job}
jobMetrics={$jobMetrics.data.jobMetrics}
accMetrics={accMetrics}
accNodeOnly={accNodeOnly}
/>
{/key}
{/if}
Expand Down
33 changes: 18 additions & 15 deletions web/frontend/src/StatsTable.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
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
Expand All @@ -23,17 +21,23 @@
|| getContext('cc-config')['job_view_nodestats_selectedMetrics']
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) ?
(job.numAccs != 0 && accMetrics.includes(metric)) ?
accNodeOnly ?
'node'
: 'accelerator'
: 'core'
: maxScope(scopesForMetric(metric))
// Not Exclusive or Multi-Node: get maxScope directly (mostly: node)
// -> Else: Load smallest available granularity as default as per availability
const availableScopes = scopesForMetric(metric)
if (job.exclusive != 1 || job.numNodes == 1) {
if (availableScopes.includes('accelerator')) {
selectedScopes[metric] = 'accelerator'
} else if (availableScopes.includes('core')) {
selectedScopes[metric] = 'core'
} else if (availableScopes.includes('socket')) {
selectedScopes[metric] = 'socket'
} else {
selectedScopes[metric] = 'node'
}
} else {
selectedScopes[metric] = maxScope(availableScopes)
}
sorting[metric] = {
min: { dir: 'up', active: false },
avg: { dir: 'up', active: false },
Expand Down Expand Up @@ -84,8 +88,7 @@
{metric}
</InputGroupText>
<select class="form-select"
bind:value={selectedScopes[metric]}
disabled={scopesForMetric(metric, jobMetrics).length == 1}>
bind:value={selectedScopes[metric]}>
{#each scopesForMetric(metric, jobMetrics) as scope}
<option value={scope}>{scope}</option>
{/each}
Expand Down

0 comments on commit aac3e7d

Please sign in to comment.