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 // 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}`] selectedMetrics = ccconfig[`job_view_selectedMetrics:${job.cluster}`]
|| clusters.find(c => c.name == job.cluster).metricConfig.map(mc => mc.name) || 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 let plots = {}, jobTags, fullWidth, statsTable
$: polarPlotSize = Math.min(fullWidth / 3 - 10, 300) $: polarPlotSize = Math.min(fullWidth / 3 - 10, 300)
$: document.title = $initq.fetching ? 'Loading...' : ($initq.error ? 'Error' : `Job ${$initq.data.job.jobId} - ClusterCockpit`) $: 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 let missingMetrics = [], missingHosts = [], somethingMissing = false
$: if ($initq.data && $jobMetrics.data) { $: if ($initq.data && $jobMetrics.data) {
let job = $initq.data.job, let job = $initq.data.job,
@ -81,7 +88,7 @@
<Col> <Col>
<PolarPlot <PolarPlot
width={polarPlotSize} height={polarPlotSize} 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} cluster={$initq.data.job.cluster}
jobMetrics={$jobMetrics.data.jobMetrics} /> jobMetrics={$jobMetrics.data.jobMetrics} />
</Col> </Col>
@ -179,7 +186,12 @@
{/if} {/if}
<TabPane tabId="stats" tab="Statistics Table" active={!somethingMissing}> <TabPane tabId="stats" tab="Statistics Table" active={!somethingMissing}>
{#if $jobMetrics.data} {#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} {/if}
</TabPane> </TabPane>
<TabPane tabId="job-script" tab="Job Script"> <TabPane tabId="job-script" tab="Job Script">

View File

@ -34,7 +34,8 @@
} }
newMetricsOrder = [...allMetrics].filter(m => !metrics.includes(m)) 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({ const updateConfiguration = mutation({

View File

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

View File

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