Merge pull request #152 from ClusterCockpit/hotfix

Rework disabled metrics, fix systems
This commit is contained in:
Jan Eitzinger 2023-06-19 16:23:11 +02:00 committed by GitHub
commit 1f60963cbb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 62 additions and 88 deletions

View File

@ -227,12 +227,13 @@
<PlotTable <PlotTable
let:item let:item
let:width let:width
renderFor="analysis"
items={metricsInHistograms.map(metric => ({ metric, ...binsFromFootprint( items={metricsInHistograms.map(metric => ({ metric, ...binsFromFootprint(
$footprintsQuery.data.footprints.nodehours, $footprintsQuery.data.footprints.nodehours,
$footprintsQuery.data.footprints.metrics.find(f => f.metric == metric).data, numBins) }))} $footprintsQuery.data.footprints.metrics.find(f => f.metric == metric).data, numBins) }))}
itemsPerRow={ccconfig.plot_view_plotsPerRow}> itemsPerRow={ccconfig.plot_view_plotsPerRow}>
<h4>Average Distribution of '{item.metric}'</h4>
<h4>Average Distribution of '{item.metric}'</h4>
<Histogram <Histogram
width={width} height={250} width={width} height={250}
min={item.min} max={item.max} min={item.min} max={item.max}

View File

@ -190,6 +190,7 @@
<PlotTable <PlotTable
let:item let:item
let:width let:width
renderFor="job"
items={orderAndMap(groupByScope($jobMetrics.data.jobMetrics), selectedMetrics)} items={orderAndMap(groupByScope($jobMetrics.data.jobMetrics), selectedMetrics)}
itemsPerRow={ccconfig.plot_view_plotsPerRow}> itemsPerRow={ccconfig.plot_view_plotsPerRow}>
{#if item.data} {#if item.data}
@ -203,7 +204,7 @@
width={width} width={width}
isShared={($initq.data.job.exclusive != 1)}/> isShared={($initq.data.job.exclusive != 1)}/>
{:else} {:else}
<Card body color="warning">No data for <code>{item.metric}</code></Card> <Card body color="warning">No dataset returned for <code>{item.metric}</code></Card>
{/if} {/if}
</PlotTable> </PlotTable>
{/if} {/if}

View File

@ -1,5 +1,5 @@
<script> <script>
import { init } from './utils.js' import { init, checkMetricDisabled } from './utils.js'
import { Row, Col, InputGroup, InputGroupText, Icon, Spinner, Card } from 'sveltestrap' import { Row, Col, InputGroup, InputGroupText, Icon, Spinner, Card } from 'sveltestrap'
import { queryStore, gql, getContextClient } from '@urql/svelte' import { queryStore, gql, getContextClient } from '@urql/svelte'
import TimeSelection from './filters/TimeSelection.svelte' import TimeSelection from './filters/TimeSelection.svelte'
@ -100,13 +100,23 @@
<PlotTable <PlotTable
let:item let:item
let:width let:width
renderFor="node"
itemsPerRow={ccconfig.plot_view_plotsPerRow} itemsPerRow={ccconfig.plot_view_plotsPerRow}
items={$nodesQuery.data.nodeMetrics[0].metrics.sort((a, b) => a.name.localeCompare(b.name))}> items={$nodesQuery.data.nodeMetrics[0].metrics
.map(m => ({ ...m, disabled: checkMetricDisabled(m.name, cluster, $nodesQuery.data.nodeMetrics[0].subCluster)}))
.sort((a, b) => a.name.localeCompare(b.name))}>
<h4 style="text-align: center; padding-top:15px;">{item.name} {metricUnits[item.name]}</h4> <h4 style="text-align: center; padding-top:15px;">{item.name} {metricUnits[item.name]}</h4>
{#if item.disabled === false && item.metric}
<MetricPlot <MetricPlot
width={width} height={300} metric={item.name} timestep={item.metric.timestep} width={width} height={300} metric={item.name} timestep={item.metric.timestep}
cluster={clusters.find(c => c.name == cluster)} subCluster={$nodesQuery.data.nodeMetrics[0].subCluster} cluster={clusters.find(c => c.name == cluster)} subCluster={$nodesQuery.data.nodeMetrics[0].subCluster}
series={item.metric.series} /> series={item.metric.series} />
{:else if item.disabled === true && item.metric}
<Card style="margin-left: 2rem;margin-right: 2rem;" body color="info">Metric disabled for subcluster <code>{item.name}:{$nodesQuery.data.nodeMetrics[0].subCluster}</code></Card>
{:else}
<Card style="margin-left: 2rem;margin-right: 2rem;" body color="warning">No dataset returned for <code>{item.name}</code></Card>
{/if}
</PlotTable> </PlotTable>
{/if} {/if}
</Col> </Col>

View File

@ -10,7 +10,9 @@
export let itemsPerRow export let itemsPerRow
export let items export let items
export let padding = 10 export let padding = 10
export let renderFor
let rows = []
let tableWidth = 0 let tableWidth = 0
const isPlaceholder = x => x._is_placeholder === true const isPlaceholder = x => x._is_placeholder === true
@ -30,8 +32,13 @@
return rows return rows
} }
// Analysis Implements PlotTable: Disable flag can not be present, add to row if not defined explicitly (Helps with systems view also)
$: rows = tile(items.filter(item => (item.disabled !== null && item.disabled === false)), itemsPerRow) $: if (renderFor === 'job') {
rows = tile(items.filter(item => item.disabled === false), itemsPerRow)
} else {
rows = tile(items, itemsPerRow)
}
$: plotWidth = (tableWidth / itemsPerRow) - (padding * itemsPerRow) $: plotWidth = (tableWidth / itemsPerRow) - (padding * itemsPerRow)
</script> </script>

View File

@ -1,5 +1,5 @@
<script> <script>
import { init } from './utils.js' import { init, checkMetricDisabled } from './utils.js'
import { Row, Col, Input, InputGroup, InputGroupText, Icon, Spinner, Card } from 'sveltestrap' import { Row, Col, Input, InputGroup, InputGroupText, Icon, Spinner, Card } from 'sveltestrap'
import { queryStore, gql, getContextClient } from '@urql/svelte' import { queryStore, gql, getContextClient } from '@urql/svelte'
import TimeSelection from './filters/TimeSelection.svelte' import TimeSelection from './filters/TimeSelection.svelte'
@ -114,25 +114,21 @@
<PlotTable <PlotTable
let:item let:item
let:width let:width
renderFor="systems"
itemsPerRow={ccconfig.plot_view_plotsPerRow} itemsPerRow={ccconfig.plot_view_plotsPerRow}
items={$nodesQuery.data.nodeMetrics items={$nodesQuery.data.nodeMetrics
.filter(h => h.host.includes(hostnameFilter) && h.metrics.some(m => m.name == selectedMetric && m.scope == 'node')) .filter(h => h.host.includes(hostnameFilter) && h.metrics.some(m => m.name == selectedMetric && m.scope == 'node'))
.map(function (h) { .map(h => ({
let thisConfig = metricConfig(cluster, selectedMetric) host: h.host,
let thisSCIndex = thisConfig.subClusters.findIndex(sc => sc.name == h.subCluster) subCluster: h.subCluster,
// Metric remove == true data: h.metrics.find(m => m.name == selectedMetric && m.scope == 'node'),
if (thisSCIndex >= 0) { disabled: checkMetricDisabled(selectedMetric, cluster, h.subCluster)
if (thisConfig.subClusters[thisSCIndex].remove == true) { }))
return { host: h.host, subCluster: h.subCluster, data: null, removed: true } .sort((a, b) => a.host.localeCompare(b.host))
} }>
}
// Else
return { host: h.host, subCluster: h.subCluster, data: h.metrics.find(m => m.name == selectedMetric && m.scope == 'node'), removed: false }
})
.sort((a, b) => a.host.localeCompare(b.host))}>
<h4 style="width: 100%; text-align: center;"><a style="display: block;padding-top: 15px;" href="/monitoring/node/{cluster}/{item.host}">{item.host} ({item.subCluster})</a></h4> <h4 style="width: 100%; text-align: center;"><a style="display: block;padding-top: 15px;" href="/monitoring/node/{cluster}/{item.host}">{item.host} ({item.subCluster})</a></h4>
{#if item.removed == false && item.data != null} {#if item.disabled === false && item.data}
<MetricPlot <MetricPlot
width={width} width={width}
height={plotHeight} height={plotHeight}
@ -141,10 +137,10 @@
metric={item.data.name} metric={item.data.name}
cluster={clusters.find(c => c.name == cluster)} cluster={clusters.find(c => c.name == cluster)}
subCluster={item.subCluster} /> subCluster={item.subCluster} />
{:else if item.removed == true && item.data == null} {:else if item.disabled === true && item.data}
<Card body color="info">Metric '{ selectedMetric }' disabled for subcluster '{ item.subCluster }'</Card> <Card style="margin-left: 2rem;margin-right: 2rem;" body color="info">Metric disabled for subcluster <code>{selectedMetric}:{item.subCluster}</code></Card>
{:else} {:else}
<Card body color="warning">Missing Full Dataset</Card> <Card style="margin-left: 2rem;margin-right: 2rem;" body color="warning">No dataset returned for <code>{selectedMetric}</code></Card>
{/if} {/if}
</PlotTable> </PlotTable>
{/if} {/if}

View File

@ -14,7 +14,7 @@
import { Card, Spinner } from "sveltestrap"; import { Card, Spinner } from "sveltestrap";
import MetricPlot from "../plots/MetricPlot.svelte"; import MetricPlot from "../plots/MetricPlot.svelte";
import JobInfo from "./JobInfo.svelte"; import JobInfo from "./JobInfo.svelte";
import { maxScope } from "../utils.js"; import { maxScope, checkMetricDisabled } from "../utils.js";
export let job; export let job;
export let metrics; export let metrics;
@ -85,56 +85,17 @@
jobMetrics[0] jobMetrics[0]
); );
const sortAndSelectScope = (jobMetrics) =>
metrics const sortAndSelectScope = (jobMetrics) => metrics
.map(function (name) { .map(name => jobMetrics.filter(jobMetric => jobMetric.name == name))
// Get MetricConf for this selected/requested metric .map(jobMetrics => ({ disabled: false, data: jobMetrics.length > 0 ? selectScope(jobMetrics) : null }))
let thisConfig = metricConfig(cluster, name); .map(jobMetric => {
let thisSCIndex = -1 if (jobMetric.data) {
if (thisConfig) { return { disabled: checkMetricDisabled(jobMetric.data.name, job.cluster, job.subCluster), data: jobMetric.data }
thisSCIndex = thisConfig.subClusters.findIndex(
(sc) => sc.name == job.subCluster
);
};
// Check if Subcluster has MetricConf: If not found (index == -1), no further remove flag check required
if (thisSCIndex >= 0) {
// SubCluster Config present: Check if remove flag is set
if (thisConfig.subClusters[thisSCIndex].remove == true) {
// Return null data and informational flag
return { removed: true, data: null };
} else { } else {
// load and return metric, if data available return jobMetric
let thisMetric = jobMetrics.filter(
(jobMetric) => jobMetric.name == name
); // Returns Array
if (thisMetric.length > 0) {
return { removed: false, data: thisMetric };
} else {
return { removed: false, data: null };
}
}
} else {
// No specific subCluster config: 'remove' flag not set, deemed false -> load and return metric, if data available
let thisMetric = jobMetrics.filter(
(jobMetric) => jobMetric.name == name
); // Returns Array
if (thisMetric.length > 0) {
return { removed: false, data: thisMetric };
} else {
return { removed: false, data: null };
}
} }
}) })
.map(function (jobMetrics) {
if (jobMetrics.data != null && jobMetrics.data.length > 0) {
return {
removed: jobMetrics.removed,
data: selectScope(jobMetrics.data),
};
} else {
return jobMetrics;
}
});
if (job.monitoringStatus) refresh(); if (job.monitoringStatus) refresh();
</script> </script>
@ -163,7 +124,7 @@
{#each sortAndSelectScope($metricsQuery.data.jobMetrics) as metric, i (metric || i)} {#each sortAndSelectScope($metricsQuery.data.jobMetrics) as metric, i (metric || i)}
<td> <td>
<!-- Subluster Metricconfig remove keyword for jobtables (joblist main, user joblist, project joblist) to be used here as toplevel case--> <!-- Subluster Metricconfig remove keyword for jobtables (joblist main, user joblist, project joblist) to be used here as toplevel case-->
{#if metric.removed == false && metric.data != null} {#if metric.disabled == false && metric.data}
<MetricPlot <MetricPlot
width={plotWidth} width={plotWidth}
height={plotHeight} height={plotHeight}
@ -176,12 +137,10 @@
subCluster={job.subCluster} subCluster={job.subCluster}
isShared={(job.exclusive != 1)} isShared={(job.exclusive != 1)}
/> />
{:else if metric.removed == true && metric.data == null} {:else if metric.disabled == true && metric.data}
<Card body color="info" <Card body color="info">Metric disabled for subcluster <code>{metric.data.name}:{job.subCluster}</code></Card>
>Metric disabled for subcluster '{job.subCluster}'</Card
>
{:else} {:else}
<Card body color="warning">Missing Full Dataset</Card> <Card body color="warning">No dataset returned</Card>
{/if} {/if}
</td> </td>
{/each} {/each}

View File

@ -320,7 +320,7 @@
{#if series[0].data.length > 0} {#if series[0].data.length > 0}
<div bind:this={plotWrapper} class="cc-plot"></div> <div bind:this={plotWrapper} class="cc-plot"></div>
{:else} {:else}
<Card style="margin-left: 2rem;margin-right: 2rem;" body color="warning">Cannot render plot: No series data found for <code>{metric}</code></Card> <Card style="margin-left: 2rem;margin-right: 2rem;" body color="warning">Cannot render plot: No series data returned for <code>{metric}</code></Card>
{/if} {/if}
<style> <style>
.cc-plot { .cc-plot {