feat(kueue): map queue selection to CodeFlare local_queue #20
All Vouch review confidence checks passed
Residual risk 0.20 = Change Risk (0.50) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.50 · 607 lines diff across 7 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.384
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #20"
general
weight: 0.35
efazal
Summary
Makes the API queue selection to CodeFlare
local_queuemapping one reusable function and adds live E2E coverage for queue discovery and selection.Queue checks on submission already landed with Kueue discovery (#16). This PR does not change what a valid request does. It gathers the mapping in one place, closes two gaps found next to it, and adds tests.
Where to look first
The mapping itself is small. Start here:
src/training_service/kueue_preflight.py: newresolve_local_queue(api, project, queue_name). A selected queue is returned only after its name, Kueue readiness, project eligibility and caller-visible existence in that project are established. With no selection, the project default applies.Nonemeans a confirmed unqueued submission.src/training_service/jobs.py: submission calls the resolver instead of inlining the steps.tests/unit/test_kueue_preflight.py,tests/unit/test_submission.py: successful and rejected mappings.Everything under
tests/e2e/plustests/unit/test_e2e_tooling.pyis live test coverage and can be read separately.Behaviour changes
Two, both small:
1.
POST /projects/{project}/training-jobsnow validates the project name like the other endpoints and returns400 bad_request. Previously a value such as%2e%2ereached the queue lookup.2. A LocalQueue lookup answered with an unexpected status (for example 400, 409, 429, 500) now returns
503 backend_unavailable, asdocs/kueue-preflight.mddescribes. Previously it surfaced assubmission_unavailable,already_existsorvalidation_errordepending on the status. 401, 403 and 404 are unchanged. This is scoped to the LocalQueue lookup; the namespace read is not changed here.The queue name is now validated once, inside the resolver. The result for a malformed name is still
422 validation_error.Contract and docs
docs/api/openapi.yaml:queue_namedescription states the name rule and its 422. Bindings regenerated (make generate-server); description text only.docs/kueue-preflight.md: lists the 422 and 400 outcomes and the lookup case for 503.docs/architecture.md: default-queue submissions share the preflight too.E2E additions
tests/e2e/test_queues.py: discovery response and outcomes; malformed names (422); missing LocalQueue (404, or 409 where Kueue is unusable); a prepared queue is listed and accepted;--other-project-queue PROJECT/QUEUEproves a queue from another project cannot be selected.default-queueprofile: lifecycle withqueue_nameomitted must run on the project's annotated default LocalQueue.queue_namein the job detail and the queue-filtered list.tests/e2e/README.mdandcoverage.mdupdated.Validation
make check(ruff, format, mypy, 1175 unit tests),make helm-check,make generate-serverwith no drift.- Full E2E with
--queue-profile with-kueue --algorithm-matrix --check-active-delete: 157 passed, 1 failed, 8 skipped.sft,osftandlora_sfteach reachedSUCCEEDEDthrough the selected queue with an admitted Workload, logs, artifacts and GPU cleanup. Pending and running deletion passed.- The one failure is
test_algorithm_lifecycle[lora_grpo]: the fixture sendsreward_type, which the stock runtime catalog does not expose, so the API returns 422 before queue selection. This is the limitation already described intests/e2e/README.md.-
default-queuelifecycle: passed.- The matrix ran before the final contract-description edit. On the final build the HTTP suite, the queue tests and a queued
lora_sftlifecycle were rerun and passed.- Manual checks: non-enrolled project returns
409 kueue_project_excludedeven with a retained LocalQueue; a queue from another project is rejected with 404; two default queues return 503; no rejection created a job.Not in this PR
queue_namewhen the project default is applied; the job detail does.v1beta1.<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
<!-- coderabbit-ai-generated:v1 -->
Summary by CodeRabbit
New Features
Submissions can use the project’s default queue when no queue is specified. Selected queues are resolved within the requested project.
Bug Fixes
Invalid queue names now return a 422 validation error before queue lookup. Invalid project names return 400, and unexpected queue lookup failures return 503.
Documentation
Updated API and architecture guidance to clarify queue name requirements, default queue behavior, and queue-related responses.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->