Skip to content

Commit d1e7ea0

Browse files
review handling of disabled metrics in frontend
1 parent 7dd3ee3 commit d1e7ea0

File tree

5 files changed

+189
-196
lines changed

5 files changed

+189
-196
lines changed

web/frontend/src/Job.root.svelte

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,18 @@
333333
{:else if thisJob && $jobMetrics?.data?.scopedJobStats}
334334
<!-- Note: Ignore '#snippet' Error in IDE -->
335335
{#snippet gridContent(item)}
336-
{#if item.data}
336+
{#if item?.disabled}
337+
<Card color="info" class="mt-2">
338+
<CardHeader class="mb-0">
339+
<b>Disabled Metric</b>
340+
</CardHeader>
341+
<CardBody>
342+
<p>No dataset(s) returned for <b>{item.metric}</b></p>
343+
<p class="mb-1">Metric has been disabled for subcluster <b>{thisJob.subCluster}</b>.</p>
344+
<p class="mb-1">To remove this card, open metric selection, de-select the metric, and press "Close and Apply".</p>
345+
</CardBody>
346+
</Card>
347+
{:else if item?.data}
337348
<Metric
338349
bind:this={plots[item.metric]}
339350
job={thisJob}
@@ -343,16 +354,6 @@
343354
presetScopes={item.data.map((x) => x.scope)}
344355
isShared={thisJob.shared != "none"}
345356
/>
346-
{:else if item.disabled == true}
347-
<Card color="info">
348-
<CardHeader class="mb-0">
349-
<b>Disabled Metric</b>
350-
</CardHeader>
351-
<CardBody>
352-
<p>Metric <b>{item.metric}</b> is disabled for cluster <b>{thisJob.cluster}:{thisJob.subCluster}</b>.</p>
353-
<p class="mb-1">To remove this card, open metric selection and press "Close and Apply".</p>
354-
</CardBody>
355-
</Card>
356357
{:else}
357358
<Card color="warning" class="mt-2">
358359
<CardHeader class="mb-0">

web/frontend/src/Node.root.svelte

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -253,12 +253,15 @@
253253
forNode
254254
/>
255255
{:else if item.disabled === true && item.metric}
256-
<Card style="margin-left: 2rem;margin-right: 2rem;" body color="info"
257-
>Metric disabled for subcluster <code
258-
>{item.name}:{$nodeMetricsData.data.nodeMetrics[0]
259-
.subCluster}</code
260-
></Card
261-
>
256+
<Card color="info" class="mx-2">
257+
<CardHeader class="mb-0">
258+
<b>Disabled Metric</b>
259+
</CardHeader>
260+
<CardBody>
261+
<p>No dataset(s) returned for <b>{item.name}</b></p>
262+
<p class="mb-1">Metric has been disabled for subcluster <b>{$nodeMetricsData.data.nodeMetrics[0].subCluster}</b>.</p>
263+
</CardBody>
264+
</Card>
262265
{:else}
263266
<Card color="warning" class="mx-2">
264267
<CardHeader class="mb-0">

web/frontend/src/generic/joblist/JobListRow.svelte

Lines changed: 51 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@
9999
})
100100
);
101101
102-
const refinedData = $derived($metricsQuery?.data?.jobMetrics ? sortAndSelectScope($metricsQuery.data.jobMetrics) : []);
102+
const refinedData = $derived($metricsQuery?.data?.jobMetrics ? sortAndSelectScope(metrics, $metricsQuery.data.jobMetrics) : []);
103103
104104
/* Effects */
105105
$effect(() => {
@@ -140,6 +140,26 @@
140140
});
141141
}
142142
143+
function sortAndSelectScope(metricList = [], jobMetrics = []) {
144+
const pendingData = [];
145+
metricList.forEach((metricName) => {
146+
const pendingMetric = {
147+
name: metricName,
148+
disabled: checkMetricDisabled(
149+
globalMetrics,
150+
metricName,
151+
job.cluster,
152+
job.subCluster,
153+
),
154+
data: null
155+
};
156+
const scopesData = jobMetrics.filter((jobMetric) => jobMetric.name == metricName)
157+
if (scopesData.length > 0) pendingMetric.data = selectScope(scopesData)
158+
pendingData.push(pendingMetric)
159+
});
160+
return pendingData;
161+
};
162+
143163
const selectScope = (jobMetrics) =>
144164
jobMetrics.reduce(
145165
(a, b) =>
@@ -152,30 +172,6 @@
152172
: a,
153173
jobMetrics[0],
154174
);
155-
156-
const sortAndSelectScope = (jobMetrics) =>
157-
metrics
158-
.map((name) => jobMetrics.filter((jobMetric) => jobMetric.name == name))
159-
.map((jobMetrics) => ({
160-
disabled: false,
161-
data: jobMetrics.length > 0 ? selectScope(jobMetrics) : null,
162-
}))
163-
.map((jobMetric) => {
164-
if (jobMetric.data) {
165-
return {
166-
name: jobMetric.data.name,
167-
disabled: checkMetricDisabled(
168-
globalMetrics,
169-
jobMetric.data.name,
170-
job.cluster,
171-
job.subCluster,
172-
),
173-
data: jobMetric.data,
174-
};
175-
} else {
176-
return jobMetric;
177-
}
178-
});
179175
</script>
180176
181177
<tr>
@@ -211,39 +207,36 @@
211207
{/if}
212208
{#each refinedData as metric, i (metric?.name || i)}
213209
<td>
214-
{#key metric}
215-
{#if metric?.data}
216-
{#if metric?.disabled}
217-
<Card body class="mx-2" color="info">
218-
Metric <b>{metric.data.name}</b>: Disabled for subcluster <code>{job.subCluster}</code>
219-
</Card>
220-
{:else}
221-
<MetricPlot
222-
onZoom={(detail) => handleZoom(detail, metric.data.name)}
223-
height={plotHeight}
224-
timestep={metric.data.metric.timestep}
225-
scope={metric.data.scope}
226-
series={metric.data.metric.series}
227-
statisticsSeries={metric.data.metric.statisticsSeries}
228-
metric={metric.data.name}
229-
cluster={clusterInfos.find((c) => c.name == job.cluster)}
230-
subCluster={job.subCluster}
231-
isShared={job.shared != "none"}
232-
numhwthreads={job.numHWThreads}
233-
numaccs={job.numAcc}
234-
zoomState={zoomStates[metric.data.name] || null}
235-
thresholdState={thresholdStates[metric.data.name] || null}
236-
/>
237-
{/if}
238-
{:else}
239-
<Card body class="mx-2" color="warning">
240-
<p>No dataset(s) returned for <b>{metrics[i]}</b></p>
241-
<p class="mb-1">Metric or host was not found in metric store for cluster <b>{job.cluster}</b>:</p>
242-
<p class="mb-1">Identical messages in <i>{metrics[i]} column</i>: Metric not found.</p>
243-
<p class="mb-1">Identical messages in <i>job {job.jobId} row</i>: Host not found.</p>
244-
</Card>
245-
{/if}
246-
{/key}
210+
{#if metric?.disabled}
211+
<Card body class="mx-2" color="info">
212+
<p>No dataset(s) returned for <b>{metrics[i]}</b></p>
213+
<p class="mb-1">Metric has been disabled for subcluster <b>{job.subCluster}</b>.</p>
214+
</Card>
215+
{:else if metric?.data}
216+
<MetricPlot
217+
onZoom={(detail) => handleZoom(detail, metric.data.name)}
218+
height={plotHeight}
219+
timestep={metric.data.metric.timestep}
220+
scope={metric.data.scope}
221+
series={metric.data.metric.series}
222+
statisticsSeries={metric.data.metric.statisticsSeries}
223+
metric={metric.data.name}
224+
cluster={clusterInfos.find((c) => c.name == job.cluster)}
225+
subCluster={job.subCluster}
226+
isShared={job.shared != "none"}
227+
numhwthreads={job.numHWThreads}
228+
numaccs={job.numAcc}
229+
zoomState={zoomStates[metric.data.name] || null}
230+
thresholdState={thresholdStates[metric.data.name] || null}
231+
/>
232+
{:else}
233+
<Card body class="mx-2" color="warning">
234+
<p>No dataset(s) returned for <b>{metrics[i]}</b></p>
235+
<p class="mb-1">Metric or host was not found in metric store for cluster <b>{job.cluster}</b>:</p>
236+
<p class="mb-1">Identical messages in <i>{metrics[i]} column</i>: Metric not found.</p>
237+
<p class="mb-1">Identical messages in <i>job {job.jobId} row</i>: Host not found.</p>
238+
</Card>
239+
{/if}
247240
</td>
248241
{:else}
249242
<td>

web/frontend/src/systems/NodeOverview.svelte

Lines changed: 42 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@
110110
};
111111
});
112112
};
113-
113+
114114
let pendingMapped = [];
115115
if (rawData.length > 0) {
116116
pendingMapped = rawData.map((h) => ({
@@ -120,12 +120,11 @@
120120
data: h.metrics.filter(
121121
(m) => m?.name == selectedMetric && m.scope == "node",
122122
),
123-
// TODO: Move To New Func Variant With Disabled Check on WHole Cluster Level: This never Triggers!
124123
disabled: checkMetricDisabled(globalMetrics, selectedMetric, cluster, h.subCluster),
125124
}))
126125
.sort((a, b) => a.host.localeCompare(b.host))
127126
}
128-
127+
129128
return pendingMapped;
130129
}
131130
</script>
@@ -162,35 +161,32 @@
162161
</Badge>
163162
</span>
164163
</div>
165-
{#if item?.data}
166-
{#if item.disabled === true}
167-
<!-- TODO: Will never be Shown: Overview Single Metric Return Will be Null, see Else Case-->
168-
<Card body class="mx-3" color="info"
169-
>Metric disabled for subcluster <code
170-
>{selectedMetric}:{item.subCluster}</code
171-
></Card
172-
>
173-
{:else if item.disabled === false}
174-
<!-- "No Data"-Warning included in MetricPlot-Component -->
175-
<!-- #key: X-axis keeps last selected timerange otherwise -->
176-
{#key item.data[0].metric.series[0].data.length}
177-
<MetricPlot
178-
timestep={item.data[0].metric.timestep}
179-
series={item.data[0].metric.series}
180-
metric={item.data[0].name}
181-
{cluster}
182-
subCluster={item.subCluster}
183-
forNode
184-
enableFlip
185-
/>
186-
{/key}
187-
{:else}
188-
<Card body class="mx-3" color="info">
189-
Global Metric List Not Initialized
190-
Can not determine {selectedMetric} availability: Please Reload Page
191-
</Card>
192-
{/if}
164+
{#if item?.disabled}
165+
<Card color="info">
166+
<CardHeader class="mb-0">
167+
<b>Disabled Metric</b>
168+
</CardHeader>
169+
<CardBody>
170+
<p>No dataset(s) returned for <b>{selectedMetric}</b></p>
171+
<p class="mb-1">Metric has been disabled for subcluster <b>{item.subCluster}</b>.</p>
172+
</CardBody>
173+
</Card>
174+
{:else if item?.data}
175+
<!-- "Empty Series"-Warning included in MetricPlot-Component -->
176+
<!-- #key: X-axis keeps last selected timerange otherwise -->
177+
{#key item.data[0].metric.series[0].data.length}
178+
<MetricPlot
179+
timestep={item.data[0].metric.timestep}
180+
series={item.data[0].metric.series}
181+
metric={item.data[0].name}
182+
{cluster}
183+
subCluster={item.subCluster}
184+
forNode
185+
enableFlip
186+
/>
187+
{/key}
193188
{:else}
189+
<!-- Should Not Appear -->
194190
<Card color="warning">
195191
<CardHeader class="mb-0">
196192
<b>Missing Metric</b>
@@ -205,10 +201,22 @@
205201
{/each}
206202
{/key}
207203
</Row>
204+
{:else if hostnameFilter || hoststateFilter != 'all'}
205+
<Row class="mx-1">
206+
<Card class="px-0">
207+
<CardHeader>
208+
<b>Empty Filter Return</b>
209+
</CardHeader>
210+
<CardBody>
211+
<p>No datasets returned for <b>{selectedMetric}</b>.</p>
212+
<p class="mb-1">Hostname filter and/or host state filter returned no matches.</p>
213+
</CardBody>
214+
</Card>
215+
</Row>
208216
{:else}
209-
<Row>
210-
<Card color="warning">
211-
<CardHeader class="mb-0">
217+
<Row class="mx-1">
218+
<Card class="px-0" color="warning">
219+
<CardHeader>
212220
<b>Missing Metric</b>
213221
</CardHeader>
214222
<CardBody>

0 commit comments

Comments
 (0)