8000 feat(rod): show per-user dominant resource allocation on /resources by janzak-dev · Pull Request #1599 · google/xmc · GitHub
[go: up one dir, main page]

Skip to content

feat(rod): show per-user dominant resource allocation on /resources - #1599

Draft
janzak-dev wants to merge 3 commits into
feat/rod-user-alloc-backend-snapshotfrom
feat/rod-user-alloc-ui
Draft

janzak-dev wants to merge 3 commits into
feat/rod-user-alloc-backend-snapshotfrom
feat/rod-user-alloc-ui

Conversation

@janzak-dev
@janzak-dev janzak-dev commented Nov 6, 2026 •
Copy link
Copy Markdown
Collaborator

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

  1. feat(rod): add per-user allocations to GetRunningAndPendingJobs #1595 Proto 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.
  2. feat(storage): aggregate active resources per author in Spanner and Postgres #1597 Spanner + Postgres aggregation. The field is populated from here on.
  3. feat(rod): read jobs and allocations from one read-only snapshot #1598 Jobs page and aggregation read from one read-only snapshot.

Frontend: UI presents correct data
4. #1599 Per-user allocation bar on /resources (the consumer of userAllocations).

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 real user_allocations from GetRunningAndPendingJobs.

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

  • New standalone 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 existing matchesResourceFilter, so a generic parent such as nvidia.com/gpu sums 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 as classifyResourceType) and values use the existing formatRate.
  • QueueJobsTable gets a dominantResource input and renders the bar from jobsResponse().userAllocations. ResourceDashboard passes dominantResource().
  • Harnesses: QueueUserAllocationBarHarness, plus getUserAllocationBar() on QueueJobsTableHarness.
  • Docs: section 5 mentions the bar on /resources.

Assumptions

  • The bar shows requested units, not measured utilization; utilization in chips is out of scope.
  • An empty creator is shown as unknown.
  • Out of scope: click-to-filter on chips, sort/filter (Filter and sort queue jobs before pagination #1516), per-GPU or borrowed quota.

Verification & Testing

  • bazel test //cmd/ui:ui_unit_tests: all pass. Summary tests cover generic-parent summing of two GPU models, ordering, percentages and cpu (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.
  • Live GKE development environment (manual UI check, user identity redacted): with cpu picked in "I need" on a 14-job CPU queue, the bar reads "Who holds cpu?" — 0 running + 1002 pending cores with a single user chip, matching the jobs table (4 jobs at cpu: 0.5, 10 at cpu: 100).

Related Issues / Bugs

Part of #1515

TAG=agy
CONV=4ed50232-a6f2-4c76-aa6f-ef1c3833a550

@gemini-code-assist gemini-code-assist Bot left a comment
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@janzak-dev janzak-dev left a comment
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@janzak-dev
janzak-dev force-pushed the feat/rod-user-alloc-ui branch from 25e2411 to 2bb212a Compare November 6, 2026 13:10
@janzak-dev
janzak-dev removed this pull request from stack #1600 November 6, 2026 13:49
@janzak-dev
janzak-dev force-pushed the feat/rod-user-alloc-ui branch from 2bb212a to 2dc4259 Compare November 6, 2026 13:55
@janzak-dev
janzak-dev added this pull request to stack #1607 November 6, 2026 13:55
@janzak-dev
janzak-dev force-pushed the feat/rod-user-alloc-ui branch from 2dc4259 to 813c88a Compare November 6, 2026 14:36
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
@janzak-dev
janzak-dev force-pushed the feat/rod-user-alloc-ui branch from 813c88a to 351ce03 Compare November 6, 2026 15:17

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0