RHOAIENG-96353: Implement job reads, logs, and terminal cleanup #8
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 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.388
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #8"
general
weight: 0.35
Sridhar1030
Summary
Implements RHOAIENG-96353:
project-scoped training-job reads, driver logs, and safe terminal deletion.
Aligned with merged submission PR #7; this update consolidates the handlers
and backend code used by the deployed service and addresses review findings.
Implemented behavior
GET /api/v1/projects/{project}/training-jobs: compact summaries,total_count, pagination, and optional status/queue filters. No statusfilter returns jobs across all statuses.
GET /api/v1/projects/{project}/training-jobs/{job_id}: available jobdetails, accepted submission, original submitter, node resources,
created/started/finished timestamps, and failure information.
GET /api/v1/projects/{project}/training-jobs/{job_id}/logs:driver-log snapshot by default;
follow=truestreams SSE events throughCodeFlare SDK. Streams are bounded to five minutes and require reconnecting
to reauthenticate. Logs are neither persisted nor aggregated across workers.
DELETE /api/v1/projects/{project}/training-jobs/{job_id}: terminal-onlyforeground deletion of the RayJob resource and its exclusively owned
dependents.
204accepts asynchronous cleanup; GPUs become available afterthe owned pods terminate.
Structure and submission alignment
api_impl/training_jobs.pyhandler owns create/list/detail/delete;removed the separate job-operations handler and per-operation dispatcher.
jobs.pybehind an injectableJobsBackendinterface. API handlers do not interpret Ray resource formats.observability.pyowns the logs endpoint;logs.pyprovides backend-neutralresponses and the hardened CodeFlare/Ray log transport. Shared caller-scoped
Kubernetes access is in
kubernetes_client.py.host, CA, verified TLS, and caller credentials, including the existing
TRAINING_SERVICE_KUBERNETES_API_URLandTRAINING_SERVICE_KUBERNETES_CA_FILEoverrides. Each client remains isolated;no global configuration changes or service-account token refresh hooks.
group and derive job authorization resources from the configured backend.
202/Location,metadata, resource mapping, and validation behavior.
documentation to match the consolidated implementation.
Security and cleanup
access. Workload operations use the verified caller's credentials, not
elevated service-account workload privileges.
401; unknown ormixed authentication infrastructure failures remain
503.workload clients or attaching caller credentials. Reject embedded credentials,
query parameters, and fragments with sanitized
503 backend_unavailable.401responses includeWWW-Authenticate: Bearer. The pinned RaySDK transport uses an HTTP response hook to preserve the original
401/403distinction before the SDK normalizes authentication errors.
actionable. Missing-job reads, deletion (including concurrent disappearance),
and initial log lookups identify the requested job and project. Project
lookups and missing submission PVC/Secret references identify the actual
resource; duplicate submissions identify the job and project. Missing Ray
submissions remain distinct from missing RayJob resources. Messages use
known request context, not raw backend response bodies or credentials, and
do not use privileged existence probes after permission failures.
RayJobClientwith verified TLS, bounded requests,redirect rejection, trusted gateway routing, and verified cluster ownership;
they do not use Kubernetes
pods/log.infrastructure failures: before Ray registration, return
409 logs_not_readyeven if KubeRay has already allocated IDs. If Ray reports an absent submission,
return JSON
404 not_foundwithout indefinite retry guidance, for both snapshotand follow requests. A removed registered cluster remains
410 ray_cluster_gone;version/gateway endpoint failures remain
503 logs_unavailable. Error responsesdo not expose gateway URLs, backend response bodies, or caller credentials.
SUCCEEDED,FAILED, andSTOPPED.Active, retrying, shared, or unowned workloads are rejected with
409.UID/resource-version preconditions protect against concurrent changes.
finalizers or directly delete user PVCs, Secrets, or outputs.
Scope boundaries
implement Kubeflow Trainer support.
lora_sftparameters from PR #7:learning_rate,num_epochs,effective_batch_size, andmax_seq_len.Generic algorithm/runtime-schema support is not part of this PR.
501 Not Implemented.README/Makefile hooks are intentionally excluded and remain local for a
separate PR. Relevant unit and transport regression tests are included.
Validation
make check: 209 unit tests passed; Ruff lint/format and mypy passed.includes invalid Kubernetes URLs rejected before client creation, caller/token
isolation, Bearer challenges for Kubernetes failures, real loopback HTTP tests
through the pinned Ray SDK for
401/403, and missing-submission versusprovisioning errors for both snapshot and follow requests. Startup does not
misreport a not-yet-created RayCluster as gone.
Coverage includes missing jobs across GET/DELETE and both log follow modes,
deletion races, missing projects, PVCs and HF/S3 Secret references, duplicate
names, and sanitization. An absent job API is not mislabeled as a missing
project after successful namespace lookup.
uv sync --locked --offlineanduv build --offline: passed.make generate-server CONTAINER_RUNTIME=podman; unchanged by these fixes.git diff --cached --check: passed.resource-context assertions and missing PVC/HF/S3 reference submissions.
30 passed, 6 skipped against commit
97cc31a, deployed as Helm revision8 of
training-service-pr8-integrationintest-efazal. Verified ingressTLS, image digest, and deployed source hashes. Missing-job, missing-project,
and missing PVC/HF/S3 reference checks passed; rejected submissions created
no job. A real Qwen 0.5B LoRA training run without Kueue succeeded,
including duplicate-name errors, details/listing, snapshot logs, and terminal
deletion. An additional live check verified non-empty SSE log events.
Other Helm releases were unchanged. Six fixture-dependent checks were skipped:
two absent-Ray-submission cases, three deliberately invalid Kubernetes URL
cases, and one caller-inaccessible-project check. Kueue-enabled submission
was not exercised in this live run.
follow-up PR. Timestamp assertions honor the documented optional execution
timestamps and validate timezone/order whenever those values are supplied.
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
<!-- coderabbit-ai-generated:v1 -->
Summary by CodeRabbit
New Features
Added training-job listing with status and queue filters, pagination, job details, driver-log snapshots and live streaming, and deletion of eligible terminal jobs.
Job deletion cleans up associated resources; shared resources and concurrent changes can prevent deletion.
Bug Fixes
Improved invalid-token handling and parsing of integer and boolean query parameters.
Expanded error responses for conflicts, unavailable services and logs, and invalid pagination.
Documentation
Added guidance on job operations, authorization, logs, pagination, deletion, and errors.
* Clarified that algorithm and queue discovery and job estimation remain unavailable.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
[RHOAIENG-96353]: https://redhat.atlassian.net/browse/RHOAIENG-96353?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ