Make polarplot metrics cluster specific

This commit is contained in:
Lou Knauer 2022-07-08 11:51:58 +02:00
parent f2f54bec4b
commit 9198d160a1
4 changed files with 30 additions and 11 deletions

View File

@ -43,12 +43,19 @@
// TODO: Do not even fetch metrics that are not one of the following: flops_any, mem_bw, job_view_selectedMetrics, job_view_nodestats_selectedMetrics
selectedMetrics = ccconfig[`job_view_selectedMetrics:${job.cluster}`]
|| clusters.find(c => c.name == job.cluster).metricConfig.map(mc => mc.name)
// selectedMetrics = ccconfig[`job_view_selectedMetrics:${job.cluster}`]
// || clusters.find(c => c.name == job.cluster).metricConfig.map(mc => mc.name)
// let toFetch = new Set(['flops_any', 'mem_bw', ])
})
let plots = {}, jobTags, fullWidth, statsTable
$: polarPlotSize = Math.min(fullWidth / 3 - 10, 300)
$: document.title = $initq.fetching ? 'Loading...' : ($initq.error ? 'Error' : `Job ${$initq.data.job.jobId} - ClusterCockpit`)
// Find out what metrics or hosts are missing:
let missingMetrics = [], missingHosts = [], somethingMissing = false
$: if ($initq.data && $jobMetrics.data) {
let job = $initq.data.job,
@ -81,7 +88,7 @@
<Col>
<PolarPlot
width={polarPlotSize} height={polarPlotSize}
metrics={ccconfig.job_view_polarPlotMetrics}
metrics={ccconfig[`job_view_polarPlotMetrics:${$initq.data.job.cluster}`] || ccconfig.job_view_polarPlotMetrics}
cluster={$initq.data.job.cluster}
jobMetrics={$jobMetrics.data.jobMetrics} />
</Col>
@ -179,7 +186,12 @@
{/if}
<TabPane tabId="stats" tab="Statistics Table" active={!somethingMissing}>
{#if $jobMetrics.data}
<StatsTable bind:this={statsTable} job={$initq.data.job} jobMetrics={$jobMetrics.data.jobMetrics} />
{#key $jobMetrics.data}
<StatsTable
bind:this={statsTable}
job={$initq.data.job}
jobMetrics={$jobMetrics.data.jobMetrics} />
{/key}
{/if}
</TabPane>
<TabPane tabId="job-script" tab="Job Script">

View File

@ -34,7 +34,8 @@
}
newMetricsOrder = [...allMetrics].filter(m => !metrics.includes(m))
newMetricsOrder.unshift(...metrics)
newMetricsOrder.unshift(...metrics.filter(m => allMetrics.has(m)))
unorderedMetrics = unorderedMetrics.filter(m => allMetrics.has(m))
})
const updateConfiguration = mutation({

View File

@ -17,7 +17,8 @@
selectedScopes = {},
sorting = {},
isMetricSelectionOpen = false,
selectedMetrics = getContext('cc-config').job_view_nodestats_selectedMetrics
selectedMetrics = getContext('cc-config')[`job_view_nodestats_selectedMetrics:${job.cluster}`]
|| getContext('cc-config')['job_view_nodestats_selectedMetrics']
for (let metric of allMetrics) {
selectedScopes[metric] = maxScope(scopesForMetric(metric))
@ -116,7 +117,8 @@
<br/>
<MetricSelection
cluster={job.cluster}
configName='job_view_nodestats_selectedMetrics'
allMetrics={allMetrics}
allMetrics={new Set(allMetrics)}
bind:metrics={selectedMetrics}
bind:isOpen={isMetricSelectionOpen} />

View File

@ -250,13 +250,17 @@ export async function fetchMetrics(job, metrics, scopes) {
export function fetchMetricsStore() {
let set = null
let prev = { fetching: true, error: null, data: null }
return [
readable({ fetching: true, error: null, data: null }, (_set) => { set = _set }),
(job, metrics, scopes) => fetchMetrics(job, metrics, scopes).then(res => set({
fetching: false,
error: res.error,
data: res.data
}))
readable(prev, (_set) => { set = _set }),
(job, metrics, scopes) => fetchMetrics(job, metrics, scopes).then(res => {
let next = { fetching: false, error: res.error, data: res.data }
if (prev.data && next.data)
next.data.jobMetrics.push(...prev.data.jobMetrics)
prev = next
set(next)
})
]
}