mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2025-07-01 11:13:50 +02:00
Optimize jobview gql query load
This commit is contained in:
parent
c3a6126799
commit
47843b2087
@ -69,15 +69,14 @@
|
|||||||
`);
|
`);
|
||||||
const client = getContextClient();
|
const client = getContextClient();
|
||||||
const ccconfig = getContext("cc-config");
|
const ccconfig = getContext("cc-config");
|
||||||
|
/* Note: Actual metric data queried in <Metric> Component, only require base infos here -> reduce backend load by requesting just stats */
|
||||||
const query = gql`
|
const query = gql`
|
||||||
query ($dbid: ID!, $selectedMetrics: [String!]!, $selectedScopes: [MetricScope!]!) {
|
query ($dbid: ID!, $selectedMetrics: [String!]!, $selectedScopes: [MetricScope!]!) {
|
||||||
jobMetrics(id: $dbid, metrics: $selectedMetrics, scopes: $selectedScopes) {
|
scopedJobStats(id: $dbid, metrics: $selectedMetrics, scopes: $selectedScopes) {
|
||||||
name
|
name
|
||||||
scope
|
scope
|
||||||
metric {
|
stats {
|
||||||
series {
|
hostname
|
||||||
hostname
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -101,7 +100,7 @@
|
|||||||
const missingMetrics = $derived.by(() => {
|
const missingMetrics = $derived.by(() => {
|
||||||
if ($initq?.data && $jobMetrics?.data) {
|
if ($initq?.data && $jobMetrics?.data) {
|
||||||
let job = $initq.data.job;
|
let job = $initq.data.job;
|
||||||
let metrics = $jobMetrics.data.jobMetrics;
|
let metrics = $jobMetrics.data.scopedJobStats;
|
||||||
let metricNames = $initq.data.globalMetrics.reduce((names, gm) => {
|
let metricNames = $initq.data.globalMetrics.reduce((names, gm) => {
|
||||||
if (gm.availability.find((av) => av.cluster === job.cluster)) {
|
if (gm.availability.find((av) => av.cluster === job.cluster)) {
|
||||||
names.push(gm.name);
|
names.push(gm.name);
|
||||||
@ -127,7 +126,7 @@
|
|||||||
const missingHosts = $derived.by(() => {
|
const missingHosts = $derived.by(() => {
|
||||||
if ($initq?.data && $jobMetrics?.data) {
|
if ($initq?.data && $jobMetrics?.data) {
|
||||||
let job = $initq.data.job;
|
let job = $initq.data.job;
|
||||||
let metrics = $jobMetrics.data.jobMetrics;
|
let metrics = $jobMetrics.data.scopedJobStats;
|
||||||
let metricNames = $initq.data.globalMetrics.reduce((names, gm) => {
|
let metricNames = $initq.data.globalMetrics.reduce((names, gm) => {
|
||||||
if (gm.availability.find((av) => av.cluster === job.cluster)) {
|
if (gm.availability.find((av) => av.cluster === job.cluster)) {
|
||||||
names.push(gm.name);
|
names.push(gm.name);
|
||||||
@ -143,7 +142,7 @@
|
|||||||
!metrics.some(
|
!metrics.some(
|
||||||
(jm) =>
|
(jm) =>
|
||||||
jm.scope == "node" &&
|
jm.scope == "node" &&
|
||||||
jm.metric.series.some((series) => series.hostname == hostname),
|
jm.stats.some((s) => s.hostname == hostname),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
}))
|
}))
|
||||||
@ -315,7 +314,7 @@
|
|||||||
<Spinner secondary />
|
<Spinner secondary />
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
{:else if $initq?.data && $jobMetrics?.data?.jobMetrics}
|
{:else if $initq?.data && $jobMetrics?.data?.scopedJobStats}
|
||||||
<!-- Note: Ignore 'Expected If ...' Error in IDE -->
|
<!-- Note: Ignore 'Expected If ...' Error in IDE -->
|
||||||
{#snippet gridContent(item)}
|
{#snippet gridContent(item)}
|
||||||
{#if item.data}
|
{#if item.data}
|
||||||
@ -352,7 +351,7 @@
|
|||||||
|
|
||||||
<PlotGrid
|
<PlotGrid
|
||||||
items={orderAndMap(
|
items={orderAndMap(
|
||||||
groupByScope($jobMetrics.data.jobMetrics),
|
groupByScope($jobMetrics.data.scopedJobStats),
|
||||||
selectedMetrics,
|
selectedMetrics,
|
||||||
)}
|
)}
|
||||||
itemsPerRow={ccconfig.plot_view_plotsPerRow}
|
itemsPerRow={ccconfig.plot_view_plotsPerRow}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user