Repository navigation
feat(rod-backend): resolve generic resources to specific accelerators - #605
Merged
Merged
Conversation
There was a problem hiding this comment.
Code Review
This pull request implements accelerator resource resolution and normalization, allowing generic GPU and TPU resource counts to be merged into specific accelerator types when present. The feedback highlights a critical concurrency issue where calling Normalize() inside getter methods mutates internal state, potentially causing data races under concurrent access. To resolve this, the reviewer suggests making the getters read-only and normalizing eagerly during mutating operations. Additionally, several optimization opportunities were identified to reduce memory allocations by moving local slices to package-level variables and avoiding slice allocations in normalization helpers.
…or normalization and concurrent read safety - Remove lazy Normalize() calls from read-only getter methods (Totals(), IntTotals(), Order()) to ensure thread safety during concurrent reads, and invoke Normalize() eagerly in Add(). - Move gpuKeywords, tpuKeywords, and acceleratorKeywords slice definitions to package level to avoid allocations. - Direct-check generic GPU and TPU keys in normalizeGenericGPU and normalizeGenericTPU without slice allocations. - Add unit test for concurrent getter calls and additional generic normalization test cases. TAG=agy
…alse positives, and generic exclusions
…ccelerators control flow, and nil receiver safety
…ants to constants.go
…and eliminate duplicate logic
…etes common constants and add classifier unit tests
…t via baseline fixture builders
… 8000 source_extractor_test
…d using strings.Split
…hout specific nodeLabels" This reverts commit faaff3f.
…ed domain prefixes
…se generic queue matches
…-specific normalization
…parameters to identifier and keyword
…rd with precompiled regex
janzak-dev
marked this pull request as ready for review
August 27, 2026 08:41
janzak-dev
requested review from
andrzejfudro
and removed request for
AntonTyb and
andrzejfudro
August 27, 2026 09:03
AntonTyb
approved these changes
Aug 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Resolves generic accelerator resources (
nvidia.com/gpu,google.com/tpu) in Resource Observability Dashboard (ROD) queue overviews to compound specific accelerator models (e.g.,nvidia.com/gpu: nvidia-tesla-a100,google.com/tpu: v5p-8) using multi-label GKE node metadata and ResourceFlavor naming fallbacks.Motivation & Root Cause
Previously, Kueue resource resolution relied solely on a single hardcoded node label key (
cloud.google.com/gke-accelerator) when attempting to resolve generic accelerator resources. ClusterQueues using other standard node labels (e.g.,cloud.google.com/gke-gpu-type,cloud.google.com/gke-tpu-accelerator,kueue.x-k8s.io/gpack-gpu,gpu.nvidia.com/class) or relying on theResourceFlavorname itself were not being resolved, resulting in genericnvidia.com/gpuorgoogle.com/tpuclassification in queue capacity overviews.Key Changes
Multi-Label Accelerator Resolution (
cmd/rod_data_provider/kueue_resource_extractor.go):cloud.google.com/gke-accelerator,cloud.google.com/gke-gpu-type,cloud.google.com/gke-tpu-accelerator,kueue.x-k8s.io/gpack-gpu,gpu.nvidia.com/class).cloud.google.com/gke-tpu-topology, e.g.2x2x1,2x4) from hardware model resolution.nvidia.com/gpu: <model>orgoogle.com/tpu: <model>).ResourceFlavor.NameifisSpecificAcceleratorName(flavorName)matches concrete hardware while excluding generic flavor names (spot,ondemand,default,standard,fallback,generic,shared,custom).Shared Accelerator Classifier (
internal/common/resourceaccumulator/classifier.go):MatchesShortAcceleratorKeywordto prevent false positive substring matches on short 2-character keywords (e.g.,pool4,level4,server6).IsSpecificAcceleratorName,IsSpecificGPUKey,IsSpecificTPUKey,IsAcceleratorResource).Unit Test Matrix & Test Deduplication:
kueue_resource_extractor_test.goandclassifier_test.go.Screenshots
We can have both generic and specific accelerators in the list
Selecting generic accelerator brings both specific and generic ones
Selecting specific accelerators brings only specific ones
Stacked Frontend Changes
Frontend hierarchical filtering and picker sorting are stacked in PR #643:
#643
TAG=agy
CONV=acf882de-1561-404c-ba2e-ae0940451165