← Back to Pull requests

feat(metrics): retain training runs in MLflow #22

Closed
unknown closed this pull request without merging on Nov 27, 2026 10:03 UTC
View on GitHub
unknown unknown commented on Nov 19, 2026 16:03 UTC
Author

Training jobs need durable metrics and execution history after their RayJobs are deleted. This change records tracked submissions in a project-scoped MLflow run and exposes a link to that run in the job API.

  • Add optional mlflow_experiment_name to submissions, defaulting to Default; return mlflow_url and mlflow_run_id in job responses.

  • Capture execution lifecycle, available Training Hub callback metrics, checkpoint metadata, final numeric results, and sampled pod/GPU/process resource usage. Uploads run asynchronously with bounded queues and delivery status.

  • Discover the ready managed MLflow server, authenticate submissions as the caller, and authenticate runtime writes using rotating pod service-account tokens. Keep TLS verification enabled and carry the trust bundle in bounded environment entries to avoid Linux's launch-argument limit.

  • Add Helm discovery/preflight RBAC, project-scoped access for service accounts created by Ray, and optional development-server provisioning. Add setup/coverage documentation and an opt-in E2E check for actual loss history and persistence after job deletion.

  • Coordinate API cancellation and driver completion through an immutable terminal result. Request Kubernetes deletion before contacting MLflow, retaining UID-scoped finalization work for retry. Tracked deletion requires RayJob patch permission; recovery remains available when automatic tracking is disabled.

  • Persist each tracked attempt in a caller-scoped training-metrics- ConfigMap. Reconcile lost MLflow/Kubernetes create responses using that unique reservation and the original create UID. Callers need ConfigMap get/create/patch/delete in the training project. Restrict GPU queries to explicit device allocations and checkpoint scans to the approved output tree, and preserve producer delivery summaries through shutdown.
  • MLflow uses the configured CA independently of Ray log-gateway readiness. Metrics retain distinct backend names, omit values outside the float range, and respect encoded batch-size limits; verification checks the requested run and paginates full loss history.

    Validation

  • make check passed: Ruff lint/format, mypy, and 1,630 unit tests, including concurrency, real SIGTERM subprocess, filesystem boundary, GPU selection, and persistence regressions.

  • make helm-lint helm-template: passed.

  • Built and pushed quay.io/efazal/training-service:metrics-mlflow-20261119-3; deployed on OpenShift and verified pod readiness, image digest, API health/schema, authenticated API requests, and runtime MLflow access.

  • A real CPU-only RayJob emitted synthetic Training Hub callback events: RayJob SUCCEEDED, MLflow run FINISHED, loss 0.5, and zero reported undelivered events. The metrics remained readable after RayJob deletion. This probe did not perform model training.
  • Coverage limits

    Detailed unified callbacks depend on runtime support; the verified interface covers sft, osft, and lora_sft. Embedding SFT and GRPO do not expose equivalent hooks. Exact checkpoint pause/restore measurements require additional Training Hub hooks, and resource samples cover instrumented pods/processes rather than cluster totals. GRPO worker GPU utilization is not collected; a GPU-less head omits node-wide GPU samples. Full GPU model-training verification remains pending, and the latest review fixes have not been redeployed to the cluster.

    <!-- This is an auto-generated comment: release notes by coderabbit.ai -->
    <!-- coderabbit-ai-generated:v1 -->

    Summary by CodeRabbit

    New Features
    Training jobs can record lifecycle, training, evaluation, checkpoint, and resource metrics in MLflow, with run history retained after job deletion.
    Select an MLflow experiment when submitting a job. Job details include a run link and ID when tracking is available.
    Configure MLflow access and optional server provisioning through the training service chart. Training metrics are available for algorithms that support callbacks.
    Documentation
    Added guidance on setup, recorded metrics, tracking availability, and instrumentation limitations.
    Expanded API documentation with MLflow fields and metrics-related error codes.
    * README now describes MLflow metrics retention and links to setup, coverage, and API details.
    <!-- end of auto-generated comment: release notes by coderabbit.ai -->

    Diff: 548 lines (+411 / -137) across 6 files Reviewer: Sridhar1030 Review duration: 11159m
    All Vouch review confidence checks passed
    Residual risk 0.19 = Change Risk (0.48) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.48 · 548 lines diff across 6 files
    0.48
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    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.377
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #22"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 48.1% (MEDIUM) · Higher = larger blast radius
    48.1%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 19.0% · Safe to merge
    19.0%