diff --git a/api/schema.graphqls b/api/schema.graphqls
index 729c712..69e32e2 100644
--- a/api/schema.graphqls
+++ b/api/schema.graphqls
@@ -167,7 +167,7 @@ type TimeWeights {
}
enum Aggregate { USER, PROJECT, CLUSTER }
-enum SortByAggregate { WALLTIME, TOTALJOBS, TOTALNODES, NODEHOURS, TOTALCORES, COREHOURS, TOTALACCS, ACCHOURS }
+enum SortByAggregate { TOTALWALLTIME, TOTALJOBS, TOTALNODES, TOTALNODEHOURS, TOTALCORES, TOTALCOREHOURS, TOTALACCS, TOTALACCHOURS }
type NodeMetrics {
host: String!
diff --git a/internal/graph/generated/generated.go b/internal/graph/generated/generated.go
index efbfae9..f29e2a0 100644
--- a/internal/graph/generated/generated.go
+++ b/internal/graph/generated/generated.go
@@ -1767,7 +1767,7 @@ type TimeWeights {
}
enum Aggregate { USER, PROJECT, CLUSTER }
-enum SortByAggregate { WALLTIME, TOTALJOBS, TOTALNODES, NODEHOURS, TOTALCORES, COREHOURS, TOTALACCS, ACCHOURS }
+enum SortByAggregate { TOTALWALLTIME, TOTALJOBS, TOTALNODES, TOTALNODEHOURS, TOTALCORES, TOTALCOREHOURS, TOTALACCS, TOTALACCHOURS }
type NodeMetrics {
host: String!
diff --git a/internal/graph/model/models_gen.go b/internal/graph/model/models_gen.go
index 99fc96f..050784b 100644
--- a/internal/graph/model/models_gen.go
+++ b/internal/graph/model/models_gen.go
@@ -196,30 +196,30 @@ func (e Aggregate) MarshalGQL(w io.Writer) {
type SortByAggregate string
const (
- SortByAggregateWalltime SortByAggregate = "WALLTIME"
- SortByAggregateTotaljobs SortByAggregate = "TOTALJOBS"
- SortByAggregateTotalnodes SortByAggregate = "TOTALNODES"
- SortByAggregateNodehours SortByAggregate = "NODEHOURS"
- SortByAggregateTotalcores SortByAggregate = "TOTALCORES"
- SortByAggregateCorehours SortByAggregate = "COREHOURS"
- SortByAggregateTotalaccs SortByAggregate = "TOTALACCS"
- SortByAggregateAcchours SortByAggregate = "ACCHOURS"
+ SortByAggregateTotalwalltime SortByAggregate = "TOTALWALLTIME"
+ SortByAggregateTotaljobs SortByAggregate = "TOTALJOBS"
+ SortByAggregateTotalnodes SortByAggregate = "TOTALNODES"
+ SortByAggregateTotalnodehours SortByAggregate = "TOTALNODEHOURS"
+ SortByAggregateTotalcores SortByAggregate = "TOTALCORES"
+ SortByAggregateTotalcorehours SortByAggregate = "TOTALCOREHOURS"
+ SortByAggregateTotalaccs SortByAggregate = "TOTALACCS"
+ SortByAggregateTotalacchours SortByAggregate = "TOTALACCHOURS"
)
var AllSortByAggregate = []SortByAggregate{
- SortByAggregateWalltime,
+ SortByAggregateTotalwalltime,
SortByAggregateTotaljobs,
SortByAggregateTotalnodes,
- SortByAggregateNodehours,
+ SortByAggregateTotalnodehours,
SortByAggregateTotalcores,
- SortByAggregateCorehours,
+ SortByAggregateTotalcorehours,
SortByAggregateTotalaccs,
- SortByAggregateAcchours,
+ SortByAggregateTotalacchours,
}
func (e SortByAggregate) IsValid() bool {
switch e {
- case SortByAggregateWalltime, SortByAggregateTotaljobs, SortByAggregateTotalnodes, SortByAggregateNodehours, SortByAggregateTotalcores, SortByAggregateCorehours, SortByAggregateTotalaccs, SortByAggregateAcchours:
+ case SortByAggregateTotalwalltime, SortByAggregateTotaljobs, SortByAggregateTotalnodes, SortByAggregateTotalnodehours, SortByAggregateTotalcores, SortByAggregateTotalcorehours, SortByAggregateTotalaccs, SortByAggregateTotalacchours:
return true
}
return false
diff --git a/internal/graph/schema.resolvers.go b/internal/graph/schema.resolvers.go
index e3cc1ea..9e5e111 100644
--- a/internal/graph/schema.resolvers.go
+++ b/internal/graph/schema.resolvers.go
@@ -248,8 +248,8 @@ func (r *queryResolver) JobsStatistics(ctx context.Context, filter []*model.JobF
var err error
var stats []*model.JobsStatistics
- if requireField(ctx, "totalJobs") || requireField(ctx, "totalNodes") || requireField(ctx, "totalCores") || requireField(ctx, "totalAccs") ||
- requireField(ctx, "totalNodeHours") || requireField(ctx, "totalCoreHours") || requireField(ctx, "totalAccHours") {
+ if requireField(ctx, "totalJobs") || requireField(ctx, "totalWalltime") || requireField(ctx, "totalNodes") || requireField(ctx, "totalCores") ||
+ requireField(ctx, "totalAccs") || requireField(ctx, "totalNodeHours") || requireField(ctx, "totalCoreHours") || requireField(ctx, "totalAccHours") {
if groupBy == nil {
stats, err = r.Repo.JobsStats(ctx, filter)
} else {
diff --git a/internal/repository/stats.go b/internal/repository/stats.go
index 485a5cd..193eb06 100644
--- a/internal/repository/stats.go
+++ b/internal/repository/stats.go
@@ -24,14 +24,14 @@ var groupBy2column = map[model.Aggregate]string{
}
var sortBy2column = map[model.SortByAggregate]string{
- model.SortByAggregateTotaljobs: "totalJobs",
- model.SortByAggregateWalltime: "totalWalltime",
- model.SortByAggregateTotalnodes: "totalNodes",
- model.SortByAggregateNodehours: "totalNodeHours",
- model.SortByAggregateTotalcores: "totalCores",
- model.SortByAggregateCorehours: "totalCoreHours",
- model.SortByAggregateTotalaccs: "totalAccs",
- model.SortByAggregateAcchours: "totalAccHours",
+ model.SortByAggregateTotaljobs: "totalJobs",
+ model.SortByAggregateTotalwalltime: "totalWalltime",
+ model.SortByAggregateTotalnodes: "totalNodes",
+ model.SortByAggregateTotalnodehours: "totalNodeHours",
+ model.SortByAggregateTotalcores: "totalCores",
+ model.SortByAggregateTotalcorehours: "totalCoreHours",
+ model.SortByAggregateTotalaccs: "totalAccs",
+ model.SortByAggregateTotalacchours: "totalAccHours",
}
func (r *JobRepository) buildCountQuery(
@@ -169,12 +169,16 @@ func (r *JobRepository) JobsStatsGrouped(
}
if id.Valid {
- var totalJobs, totalNodes, totalNodeHours, totalCores, totalCoreHours, totalAccs, totalAccHours int
+ var totalJobs, totalWalltime, totalNodes, totalNodeHours, totalCores, totalCoreHours, totalAccs, totalAccHours int
if jobs.Valid {
totalJobs = int(jobs.Int64)
}
+ if walltime.Valid {
+ totalWalltime = int(walltime.Int64)
+ }
+
if nodes.Valid {
totalNodes = int(nodes.Int64)
}
@@ -202,7 +206,7 @@ func (r *JobRepository) JobsStatsGrouped(
ID: id.String,
Name: name,
TotalJobs: totalJobs,
- TotalWalltime: int(walltime.Int64),
+ TotalWalltime: totalWalltime,
TotalNodes: totalNodes,
TotalNodeHours: totalNodeHours,
TotalCores: totalCores,
diff --git a/web/frontend/src/Analysis.root.svelte b/web/frontend/src/Analysis.root.svelte
index 88c3a32..57ebfc5 100644
--- a/web/frontend/src/Analysis.root.svelte
+++ b/web/frontend/src/Analysis.root.svelte
@@ -42,6 +42,19 @@
$: metrics = [...new Set([...metricsInHistograms, ...metricsInScatterplots.flat()])]
+ const sortOptions = [
+ {key: 'totalWalltime', label: 'Walltime'},
+ {key: 'totalNodeHours', label: 'Node Hours'},
+ {key: 'totalCoreHours', label: 'Core Hours'},
+ {key: 'totalAccHours', label: 'Accelerator Hours'}
+ ]
+ const groupOptions = [
+ {key: 'User', label: 'User Name'},
+ {key: 'Project', label: 'Project ID'}
+ ]
+ let sortSelection = sortOptions[0] // Default: Walltime
+ let groupSelection = groupOptions[0] // Default: Users
+
getContext('on-init')(({ data }) => {
if (data != null) {
cluster = data.clusters.find(c => c.name == filterPresets.cluster)
@@ -62,28 +75,31 @@
totalJobs
shortJobs
totalWalltime
+ totalNodeHours
totalCoreHours
+ totalAccHours
histDuration { count, value }
- histNumNodes { count, value }
+ histNumCores { count, value }
}
}
`,
variables: { jobFilters }
})
- const paging = { itemsPerPage: 5, page: 1 }; // Top 5
- // const sorting = { field: "totalCoreHours", order: "DESC" };
$: topQuery = queryStore({
client: client,
query: gql`
- query($jobFilters: [JobFilter!]!, $paging: PageRequest!) {
- topUser: jobsStatistics(filter: $jobFilters, page: $paging, sortBy: COREHOURS, groupBy: USER) {
+ query($jobFilters: [JobFilter!]!, $paging: PageRequest!, $sortBy: SortByAggregate!, $groupBy: Aggregate!) {
+ topList: jobsStatistics(filter: $jobFilters, page: $paging, sortBy: $sortBy, groupBy: $groupBy) {
id
+ totalWalltime
+ totalNodeHours
totalCoreHours
+ totalAccHours
}
}
`,
- variables: { jobFilters, paging }
+ variables: { jobFilters, paging: { itemsPerPage: 10, page: 1 }, sortBy: sortSelection.key.toUpperCase(), groupBy: groupSelection.key.toUpperCase() }
})
$: footprintsQuery = queryStore({
@@ -164,36 +180,82 @@
Total Walltime |
{$statsQuery.data.stats[0].totalWalltime} |
+
+ Total Node Hours |
+ {$statsQuery.data.stats[0].totalNodeHours} |
+
Total Core Hours |
{$statsQuery.data.stats[0].totalCoreHours} |
+
+ Total Accelerator Hours |
+ {$statsQuery.data.stats[0].totalAccHours} |
+
-
Top Users
- {#key $statsQuery.data.topUsers}
-
tu.totalCoreHours)}
- entities={$topQuery.data.topUser.map((tu) => tu.id)}
- />
+ Top
+
+
+ {#key $topQuery.data}
+ {#if $topQuery.fetching}
+
+ {:else if $topQuery.error}
+ {$topQuery.error.message}
+ {:else}
+ t[sortSelection.key])}
+ entities={$topQuery.data.topList.map((t) => t.id)}
+ />
+ {/if}
{/key}
-
- Legend | User Name | Core Hours |
- {#each $topQuery.data.topUser as { id, totalCoreHours }, i}
-
- |
- {id} |
- {totalCoreHours} |
-
- {/each}
-
+ {#key $topQuery.data}
+ {#if $topQuery.fetching}
+
+ {:else if $topQuery.error}
+ {$topQuery.error.message}
+ {:else}
+
+
+ Legend |
+ {groupSelection.label} |
+
+
+ |
+
+ {#each $topQuery.data.topList as te, i}
+
+ |
+ {#if groupSelection.key == 'User'}
+ {te.id} |
+ {:else}
+ {te.id} |
+ {/if}
+ {te[sortSelection.key]} |
+
+ {/each}
+
+ {/if}
+ {/key}
@@ -230,13 +292,13 @@
- {#key $statsQuery.data.stats[0].histNumNodes}
+ {#key $statsQuery.data.stats[0].histNumCores}
{/key}