Skip to content

Commit

Permalink
fix: change analysis top users to core hours
Browse files Browse the repository at this point in the history
  • Loading branch information
spacehamster87 committed Aug 24, 2023
1 parent 6a1e351 commit 4eceab4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions internal/repository/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,12 @@ func (r *JobRepository) CountGroupedJobs(
now := time.Now().Unix()
count = fmt.Sprintf(`sum(job.num_nodes * (CASE WHEN job.job_state = "running" THEN %d - job.start_time ELSE job.duration END)) as count`, now)
runner = r.DB
case model.WeightsCoreCount:
count = "sum(job.num_hwthreads) as count"
case model.WeightsCoreHours:
now := time.Now().Unix()
count = fmt.Sprintf(`sum(job.num_hwthreads * (CASE WHEN job.job_state = "running" THEN %d - job.start_time ELSE job.duration END)) as count`, now)
runner = r.DB
default:
log.Debugf("CountGroupedJobs() Weight %v unknown.", *weight)
}
Expand Down
4 changes: 2 additions & 2 deletions web/frontend/src/Analysis.root.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
histNumNodes { count, value }
}
topUsers: jobsCount(filter: $jobFilters, groupBy: USER, weight: NODE_HOURS, limit: 5) { name, count }
topUsers: jobsCount(filter: $jobFilters, groupBy: USER, weight: CORE_HOURS, limit: 5) { name, count }
}
`,
variables: { jobFilters }
Expand Down Expand Up @@ -172,7 +172,7 @@
</Col>
<Col>
<Table>
<tr class="mb-2"><th>Legend</th><th>User Name</th><th>Node Hours</th></tr>
<tr class="mb-2"><th>Legend</th><th>User Name</th><th>Core Hours</th></tr>
{#each $statsQuery.data.topUsers.sort((a, b) => b.count - a.count) as { name, count }, i}
<tr>
<td><Icon name="circle-fill" style="color: {colors[i]};"/></td>
Expand Down

0 comments on commit 4eceab4

Please sign in to comment.