Repository navigation
feat(rod): show per-user dominant resource allocation on /resources - #1599
janzak-dev wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces the QueueUserAllocationBar component, which displays a stacked bar showing the running and pending resource allocations per user for the dominant resource in a queue. It integrates this component into the queue jobs table, adds comprehensive unit tests, and updates the documentation. The review feedback suggests three improvements: using an epsilon threshold when sorting user allocations to prevent floating-point precision issues, handling tiny positive allocations (< 0.01) explicitly to avoid rounding them to zero, and conditionally rendering allocation segments only when they have a positive percentage to prevent DOM clutter.
There was a problem hiding this comment.
Thanks for the review. I checked each suggestion against the code in this stack; replies with the reasoning are inline. No code changes were needed in this round.
25e2411 to
2bb212a
Compare
2bb212a to
2dc4259
Compare
2dc4259 to
813c88a
Compare
Add QueueUserAllocationBar above the queue jobs table: a stacked bar plus one display-only chip per user with running and pending units of the first resource picked in "I need", read from GetRunningAndPendingJobs.user_allocations. A generic parent such as nvidia.com/gpu sums every matching model via matchesResourceFilter; an empty picker shows a hint and a resource no active job requests shows an empty message. Bug: 582253355 TAG=agy CONV=4ed50232-a6f2-4c76-aa6f-ef1c3833a550
…location bar Unit labels now come from the queue jobs table's resource classifier (exported as classifyResourceType, which reports unknown types instead of defaulting to GPU) mapped through a ResourceType table, and unit values use the existing formatRate instead of a second formatter. Bug: 582253355 TAG=agy CONV=4ed50232-a6f2-4c76-aa6f-ef1c3833a550
- Inline the one-line unit label lookup into summarizeUserAllocations. - Aggregate straight into UserTotals instead of rebuilding objects. - Drop component tests that only re-check summary output already covered by user_allocation_summary_test.ts, and their unused fixture rows. Bug: 582253355 TAG=agy CONV=4ed50232-a6f2-4c76-aa6f-ef1c3833a550
813c88a to
351ce03
Compare
Note
Stacked PR (part of #1515): per-user "dominant resource" allocation on
/resources. Every layer has a production caller and tests. Unfinished backend pieces return empty data, never placeholder values.Backend: endpoint and RPC presenting correct information
user_allocations+ handler mapping from the per-author storage contract. The handler is the producer; storage returns no rows yet, so the field is empty.Frontend: UI presents correct data
4. #1599 Per-user allocation bar on
/resources(the consumer ofuserAllocations).Summary
Shows how much of the dominant resource each user holds in the selected queue on
/resources. The dominant resource is the first resource picked in the Smart Resource Finder's "I need" picker. A stacked bar with one chip per user sits above the jobs table, using the realuser_allocationsfromGetRunningAndPendingJobs.Motivation & Context
Part of #1515 (the "Who holds the used GPUs?" bar in the mockups). The jobs table is paginated, so answering "who is using this queue?" meant paging through jobs. The backend PRs below compute the breakdown across all active jobs; this PR presents it.
Key Changes
QueueUserAllocationBar(signals,OnPush,@if/@for): a stacked bar plus one display-only chip per user with running and pending units and a unit label (GPUs / chips / cores / GiB). It filters with the existingmatchesResourceFilter, so a generic parent such asnvidia.com/gpusums every matching model. With no resource picked it shows a hint, and when nothing matches it shows an empty message.user_allocation_summary.ts: pure aggregation, percentage and label helpers. Unit labels reuse the jobs table classifier (exported asclassifyResourceType) and values use the existingformatRate.QueueJobsTablegets adominantResourceinput and renders the bar fromjobsResponse().userAllocations.ResourceDashboardpassesdominantResource().QueueUserAllocationBarHarness, plusgetUserAllocationBar()onQueueJobsTableHarness./resources.Assumptions
unknown.Verification & Testing
bazel test //cmd/ui:ui_unit_tests: all pass. Summary tests cover generic-parent summing of two GPU models, ordering, percentages andcpu(cores) /memory(GiB) labels. Harness tests cover rendering: a specific model (title, totals, chips, segment widths), the empty-picker hint, the no-match message and the loading state. A dashboard test checks that changing the picker updates the bar from the service response.npx playwright test screenshot_tests/resource_dashboard: existing baselines pass../.githooks/pre-commit: passes.cpu: 0.5, 10 atcpu: 100).Related Issues / Bugs
Part of #1515
TAG=agy
CONV=4ed50232-a6f2-4c76-aa6f-ef1c3833a550