Add usage status tabs for each subCluster

This commit is contained in:
Christoph Kluge
2026-02-04 18:02:21 +01:00
parent a7a95bb866
commit af73ce9c6d
2 changed files with 46 additions and 24 deletions

View File

@@ -34,6 +34,9 @@
/*Const Init */ /*Const Init */
const { query: initq } = init(); const { query: initq } = init();
const useCbColors = getContext("cc-config")?.plotConfiguration_colorblindMode || false const useCbColors = getContext("cc-config")?.plotConfiguration_colorblindMode || false
/* Derived */
const subClusters = $derived($initq?.data?.clusters?.find((c) => c.name == presetCluster)?.subClusters || []);
</script> </script>
<!-- Loading indicator & Refresh --> <!-- Loading indicator & Refresh -->
@@ -66,12 +69,22 @@
</CardBody> </CardBody>
</TabPane> </TabPane>
<TabPane tabId="usage-dash" tab="Usage"> <TabPane tabId="usage-dash" tab="Cluster Usage">
<CardBody> <CardBody>
<UsageDash {presetCluster} {useCbColors}></UsageDash> <UsageDash {presetCluster} {useCbColors}></UsageDash>
</CardBody> </CardBody>
</TabPane> </TabPane>
{#if subClusters?.length > 1}
{#each subClusters.map(sc => sc.name) as scn}
<TabPane tabId="{scn}-usage-dash" tab="{scn.charAt(0).toUpperCase() + scn.slice(1)} Usage">
<CardBody>
<UsageDash {presetCluster} presetSubCluster={scn} {useCbColors}></UsageDash>
</CardBody>
</TabPane>
{/each}
{/if}
<TabPane tabId="metric-dash" tab="Statistics"> <TabPane tabId="metric-dash" tab="Statistics">
<CardBody> <CardBody>
<StatisticsDash {presetCluster} {useCbColors}></StatisticsDash> <StatisticsDash {presetCluster} {useCbColors}></StatisticsDash>

View File

@@ -3,6 +3,9 @@
Properties: Properties:
- `presetCluster String`: The cluster to show status information for - `presetCluster String`: The cluster to show status information for
- `presetSubCluster String?`: The subCluster to show status information for [Default: null]
- `useCbColors Bool?`: Use colorblind friendly colors [Default: false]
- `useAltColors Bool?`: Use alternative color set [Default: false]
--> -->
<script> <script>
@@ -35,6 +38,7 @@
/* Svelte 5 Props */ /* Svelte 5 Props */
let { let {
presetCluster, presetCluster,
presetSubCluster = null,
useCbColors = false, useCbColors = false,
useAltColors = false useAltColors = false
} = $props(); } = $props();
@@ -52,7 +56,12 @@
let numDurationBins = $state("1h"); let numDurationBins = $state("1h");
/* Derived */ /* Derived */
let cluster = $derived(presetCluster) const canvasPrefix = $derived(`${presetCluster}-${presetSubCluster ? presetSubCluster : ''}`)
const statusFilter = $derived(presetSubCluster
? [{ state: ["running"] }, { cluster: { eq: presetCluster} }, { partition: { eq: presetSubCluster } }]
: [{ state: ["running"] }, { cluster: { eq: presetCluster} }]
);
const topJobsQuery = $derived(queryStore({ const topJobsQuery = $derived(queryStore({
client: client, client: client,
query: gql` query: gql`
@@ -82,7 +91,7 @@
} }
`, `,
variables: { variables: {
filter: [{ state: ["running"] }, { cluster: { eq: cluster} }], filter: statusFilter,
paging: pagingState // Top 10 paging: pagingState // Top 10
}, },
requestPolicy: "network-only" requestPolicy: "network-only"
@@ -117,7 +126,7 @@
} }
`, `,
variables: { variables: {
filter: [{ state: ["running"] }, { cluster: { eq: cluster } }], filter: statusFilter,
paging: pagingState paging: pagingState
}, },
requestPolicy: "network-only" requestPolicy: "network-only"
@@ -152,7 +161,7 @@
} }
`, `,
variables: { variables: {
filter: [{ state: ["running"] }, { cluster: { eq: cluster } }], filter: statusFilter,
paging: pagingState paging: pagingState
}, },
requestPolicy: "network-only" requestPolicy: "network-only"
@@ -184,7 +193,7 @@
} }
`, `,
variables: { variables: {
filter: [{ state: ["running"] }, { cluster: { eq: cluster } }], filter: statusFilter,
selectedHistograms: selectedHistograms, // No Metrics requested for node hardware stats selectedHistograms: selectedHistograms, // No Metrics requested for node hardware stats
numDurationBins: numDurationBins, numDurationBins: numDurationBins,
}, },
@@ -264,7 +273,7 @@
</h4> </h4>
<Pie <Pie
{useAltColors} {useAltColors}
canvasId="hpcpie-jobs-users" canvasId="{canvasPrefix}-hpcpie-jobs-users"
size={colWidthJobs * 0.75} size={colWidthJobs * 0.75}
sliceLabel="Jobs" sliceLabel="Jobs"
quantities={$topJobsQuery.data.topUser.map( quantities={$topJobsQuery.data.topUser.map(
@@ -284,14 +293,14 @@
{#each $topJobsQuery.data.topUser as tu, i} {#each $topJobsQuery.data.topUser as tu, i}
<tr> <tr>
<td><Icon name="circle-fill" style="color: {legendColors(i)};" /></td> <td><Icon name="circle-fill" style="color: {legendColors(i)};" /></td>
<td id="topName-jobs-{tu.id}"> <td id="{canvasPrefix}-topName-jobs-{tu.id}">
<a target="_blank" href="/monitoring/user/{tu.id}?cluster={cluster}&state=running" <a target="_blank" href="/monitoring/user/{tu.id}?cluster={presetCluster}{presetSubCluster ? '&partition='+presetSubCluster : ''}&state=running"
>{scrambleNames ? scramble(tu.id) : tu.id} >{scrambleNames ? scramble(tu.id) : tu.id}
</a> </a>
</td> </td>
{#if tu?.name} {#if tu?.name}
<Tooltip <Tooltip
target={`topName-jobs-${tu.id}`} target={`${canvasPrefix}-topName-jobs-${tu.id}`}
placement="left" placement="left"
>{scrambleNames ? scramble(tu.name) : tu.name}</Tooltip >{scrambleNames ? scramble(tu.name) : tu.name}</Tooltip
> >
@@ -308,7 +317,7 @@
</h4> </h4>
<Pie <Pie
{useAltColors} {useAltColors}
canvasId="hpcpie-jobs-projects" canvasId="{canvasPrefix}-hpcpie-jobs-projects"
size={colWidthJobs * 0.75} size={colWidthJobs * 0.75}
sliceLabel={'Jobs'} sliceLabel={'Jobs'}
quantities={$topJobsQuery.data.topProjects.map( quantities={$topJobsQuery.data.topProjects.map(
@@ -328,7 +337,7 @@
<tr> <tr>
<td><Icon name="circle-fill" style="color: {legendColors(i)};" /></td> <td><Icon name="circle-fill" style="color: {legendColors(i)};" /></td>
<td> <td>
<a target="_blank" href="/monitoring/jobs/?cluster={cluster}&state=running&project={tp.id}&projectMatch=eq" <a target="_blank" href="/monitoring/jobs/?cluster={presetCluster}{presetSubCluster ? '&partition='+presetSubCluster : ''}&state=running&project={tp.id}&projectMatch=eq"
>{scrambleNames ? scramble(tp.id) : tp.id} >{scrambleNames ? scramble(tp.id) : tp.id}
</a> </a>
</td> </td>
@@ -368,7 +377,7 @@
</h4> </h4>
<Pie <Pie
{useAltColors} {useAltColors}
canvasId="hpcpie-nodes-users" canvasId="{canvasPrefix}-hpcpie-nodes-users"
size={colWidthNodes * 0.75} size={colWidthNodes * 0.75}
sliceLabel="Nodes" sliceLabel="Nodes"
quantities={$topNodesQuery.data.topUser.map( quantities={$topNodesQuery.data.topUser.map(
@@ -388,14 +397,14 @@
{#each $topNodesQuery.data.topUser as tu, i} {#each $topNodesQuery.data.topUser as tu, i}
<tr> <tr>
<td><Icon name="circle-fill" style="color: {legendColors(i)};" /></td> <td><Icon name="circle-fill" style="color: {legendColors(i)};" /></td>
<td id="topName-nodes-{tu.id}"> <td id="{canvasPrefix}-topName-nodes-{tu.id}">
<a target="_blank" href="/monitoring/user/{tu.id}?cluster={cluster}&state=running" <a target="_blank" href="/monitoring/user/{tu.id}?cluster={presetCluster}{presetSubCluster ? '&partition='+presetSubCluster : ''}&state=running"
>{scrambleNames ? scramble(tu.id) : tu.id} >{scrambleNames ? scramble(tu.id) : tu.id}
</a> </a>
</td> </td>
{#if tu?.name} {#if tu?.name}
<Tooltip <Tooltip
target={`topName-nodes-${tu.id}`} target={`${canvasPrefix}-topName-nodes-${tu.id}`}
placement="left" placement="left"
>{scrambleNames ? scramble(tu.name) : tu.name}</Tooltip >{scrambleNames ? scramble(tu.name) : tu.name}</Tooltip
> >
@@ -412,7 +421,7 @@
</h4> </h4>
<Pie <Pie
{useAltColors} {useAltColors}
canvasId="hpcpie-nodes-projects" canvasId="{canvasPrefix}-hpcpie-nodes-projects"
size={colWidthNodes * 0.75} size={colWidthNodes * 0.75}
sliceLabel={'Nodes'} sliceLabel={'Nodes'}
quantities={$topNodesQuery.data.topProjects.map( quantities={$topNodesQuery.data.topProjects.map(
@@ -432,7 +441,7 @@
<tr> <tr>
<td><Icon name="circle-fill" style="color: {legendColors(i)};" /></td> <td><Icon name="circle-fill" style="color: {legendColors(i)};" /></td>
<td> <td>
<a target="_blank" href="/monitoring/jobs/?cluster={cluster}&state=running&project={tp.id}&projectMatch=eq" <a target="_blank" href="/monitoring/jobs/?cluster={presetCluster}{presetSubCluster ? '&partition='+presetSubCluster : ''}&state=running&project={tp.id}&projectMatch=eq"
>{scrambleNames ? scramble(tp.id) : tp.id} >{scrambleNames ? scramble(tp.id) : tp.id}
</a> </a>
</td> </td>
@@ -472,7 +481,7 @@
</h4> </h4>
<Pie <Pie
{useAltColors} {useAltColors}
canvasId="hpcpie-accs-users" canvasId="{canvasPrefix}-hpcpie-accs-users"
size={colWidthAccs * 0.75} size={colWidthAccs * 0.75}
sliceLabel="GPUs" sliceLabel="GPUs"
quantities={$topAccsQuery.data.topUser.map( quantities={$topAccsQuery.data.topUser.map(
@@ -492,14 +501,14 @@
{#each $topAccsQuery.data.topUser as tu, i} {#each $topAccsQuery.data.topUser as tu, i}
<tr> <tr>
<td><Icon name="circle-fill" style="color: {legendColors(i)};" /></td> <td><Icon name="circle-fill" style="color: {legendColors(i)};" /></td>
<td id="topName-accs-{tu.id}"> <td id="{canvasPrefix}-topName-accs-{tu.id}">
<a target="_blank" href="/monitoring/user/{tu.id}?cluster={cluster}&state=running" <a target="_blank" href="/monitoring/user/{tu.id}?cluster={presetCluster}{presetSubCluster ? '&partition='+presetSubCluster : ''}&state=running"
>{scrambleNames ? scramble(tu.id) : tu.id} >{scrambleNames ? scramble(tu.id) : tu.id}
</a> </a>
</td> </td>
{#if tu?.name} {#if tu?.name}
<Tooltip <Tooltip
target={`topName-accs-${tu.id}`} target={`${canvasPrefix}-topName-accs-${tu.id}`}
placement="left" placement="left"
>{scrambleNames ? scramble(tu.name) : tu.name}</Tooltip >{scrambleNames ? scramble(tu.name) : tu.name}</Tooltip
> >
@@ -516,7 +525,7 @@
</h4> </h4>
<Pie <Pie
{useAltColors} {useAltColors}
canvasId="hpcpie-accs-projects" canvasId="{canvasPrefix}-hpcpie-accs-projects"
size={colWidthAccs * 0.75} size={colWidthAccs * 0.75}
sliceLabel={'GPUs'} sliceLabel={'GPUs'}
quantities={$topAccsQuery.data.topProjects.map( quantities={$topAccsQuery.data.topProjects.map(
@@ -536,7 +545,7 @@
<tr> <tr>
<td><Icon name="circle-fill" style="color: {legendColors(i)};" /></td> <td><Icon name="circle-fill" style="color: {legendColors(i)};" /></td>
<td> <td>
<a target="_blank" href="/monitoring/jobs/?cluster={cluster}&state=running&project={tp.id}&projectMatch=eq" <a target="_blank" href="/monitoring/jobs/?cluster={presetCluster}{presetSubCluster ? '&partition='+presetSubCluster : ''}&state=running&project={tp.id}&projectMatch=eq"
>{scrambleNames ? scramble(tp.id) : tp.id} >{scrambleNames ? scramble(tp.id) : tp.id}
</a> </a>
</td> </td>