From 3014f59cc2cfa92ffaef1f02088dc0bb7636b0e3 Mon Sep 17 00:00:00 2001 From: Christoph Kluge Date: Tue, 29 Aug 2023 14:02:23 +0200 Subject: [PATCH] feat: add new distribution plots to status view - numCores and numAccs --- internal/graph/schema.resolvers.go | 2 +- internal/repository/stats.go | 12 ++++++++++++ web/frontend/src/Status.root.svelte | 30 +++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 1 deletion(-) diff --git a/internal/graph/schema.resolvers.go b/internal/graph/schema.resolvers.go index 684783a..e3cc1ea 100644 --- a/internal/graph/schema.resolvers.go +++ b/internal/graph/schema.resolvers.go @@ -280,7 +280,7 @@ func (r *queryResolver) JobsStatistics(ctx context.Context, filter []*model.JobF return nil, err } - if requireField(ctx, "histDuration") || requireField(ctx, "histNumNodes") { + if requireField(ctx, "histDuration") || requireField(ctx, "histNumNodes") || requireField(ctx, "histNumCores") || requireField(ctx, "histNumAccs") { if groupBy == nil { stats[0], err = r.Repo.AddHistograms(ctx, filter, stats[0]) if err != nil { diff --git a/internal/repository/stats.go b/internal/repository/stats.go index 4585f44..485a5cd 100644 --- a/internal/repository/stats.go +++ b/internal/repository/stats.go @@ -442,6 +442,18 @@ func (r *JobRepository) AddHistograms( return nil, err } + stat.HistNumCores, err = r.jobsStatisticsHistogram(ctx, "job.num_hwthreads as value", filter) + if err != nil { + log.Warn("Error while loading job statistics histogram: num hwthreads") + return nil, err + } + + stat.HistNumAccs, err = r.jobsStatisticsHistogram(ctx, "job.num_acc as value", filter) + if err != nil { + log.Warn("Error while loading job statistics histogram: num acc") + return nil, err + } + log.Debugf("Timer AddHistograms %s", time.Since(start)) return stat, nil } diff --git a/web/frontend/src/Status.root.svelte b/web/frontend/src/Status.root.svelte index 4c9e8d5..3192dbf 100644 --- a/web/frontend/src/Status.root.svelte +++ b/web/frontend/src/Status.root.svelte @@ -44,6 +44,8 @@ stats: jobsStatistics(filter: $filter) { histDuration { count, value } histNumNodes { count, value } + histNumCores { count, value } + histNumAccs { count, value } } allocatedNodes(cluster: $cluster) { name, count } @@ -324,4 +326,32 @@ {/key} + + +
+ {#key $mainQuery.data.stats} + + {/key} +
+ + + {#key $mainQuery.data.stats} + + {/key} + +
{/if} \ No newline at end of file