18 ยท Capstone: the end-to-end path
Every piece of this track was one link. The capstone snaps them into a single chain: train โ track with MLflow โ version with DVC โ wrap in FastAPI + Docker โ gate with CI/CD โ push to ECR โ deploy to the cloud โ monitor for drift โ retrain. That loop, not any single stage, is MLOps.
MLOps is not any single tool โ it's the **loop** that connects them. The end-to-end path is: **train** the model โ **track** the run with MLflow โ **version** data and the artifact with DVC โ wrap it in a **FastAPI** service and **Docker** image โ gate every change through **GitHub Actions CI/CD** โ push the image to **ECR** โ **deploy** to the cloud (Beanstalk / EC2 / a managed endpoint) โ **monitor** for drift โ when drift fires, **retrain** and send the new model right back through the same pipeline. Each stage of this track was one link; the capstone is the whole chain โ and the loop closing back to retraining is what makes it MLOps rather than a one-shot deploy.
Without this:
Without the connecting loop, you have isolated capabilities โ a model in a notebook here, a Dockerfile there, a CI file somewhere else โ but no reliable, repeatable path from a code change to a monitored production model that retrains when the world shifts. The pieces don't add up to MLOps until they're chained.
You've built every link. Now snap them into one chain. This capstone walks the complete end-to-end path that takes the scikit-learn pipeline from bc-py-59 โ a model in a notebook โ all the way to a monitored, retrainable production service. Read it as the story of one prediction request's whole supporting infrastructure.
1. Train (Ch 1โ2). It starts with the model. A reproducible project โ pinned dependencies, a fixed seed, a src/ layout โ trains the pipeline and serializes it to a single artifact (model.joblib). Reproducibility first, because everything downstream assumes you can rebuild this exact model.
2. Track with MLflow (Ch 4). Every training run logs its params, metrics, and the artifact to MLflow, so "which run was best?" is a query, not a memory. The registry promotes a chosen run None โ Staging โ Production.
3. Version with DVC (Ch 5). Git versions the code; DVC versions the data and the model. A dvc.yaml pipeline makes the path from raw data โ trained artifact reproducible: dvc repro re-runs only what changed.
4. Serve with FastAPI + Docker (Ch 2โ3). The model is wrapped in a FastAPI /predict endpoint (a Pydantic request schema validates inputs before predicting) with a /healthz check, then containerized into a Docker image โ the same image everywhere.
5. Gate with CI/CD (Ch 6). GitHub Actions runs the tests and linter on every PR (CI), and on merge to main builds the image, pushes it, and deploys (CD) โ with secrets and a production approval gate. A broken change never reaches production.
6. Push to ECR (Ch 7). The built image is tagged with the git SHA and pushed to a registry (ECR on AWS): login โ tag โ push. The cloud pulls this exact artifact โ no rebuild, no drift between tested and deployed.
7. Deploy to the cloud (Ch 7). The image runs on the right rung of the managed-vs-control spectrum: Beanstalk for a managed container, EC2 for full control, a SageMaker/Azure ML endpoint for autoscaling ML-native serving. The model is now live behind an HTTPS endpoint.
8. Monitor for drift (Ch 8). Every prediction is logged; PSI/KS watch the live input distribution against the training reference. Operational metrics (latency, errors) ride alongside.
9. Retrain โ and loop back. When drift crosses the threshold, an alert fires and triggers retraining: pull fresh labeled data, retrain (step 1), track (2), version (3) โ and the new model flows right back through serve โ CI/CD โ push โ deploy โ monitor. That return arrow is the point. A one-shot deploy is a project; the loop โ deploy โ monitor โ detect โ retrain โ deploy โ is MLOps.
The consolidated CI/CD workflow below ties build + push + deploy into one file, and the animated pipeline traces the full chain. This is the whole track in one breath: from a model in a notebook to a production model that watches itself and renews itself.
A consolidated `mlops.yml` workflow: a `ci` job (tests + lint on every PR) and a `deploy` job that, only on merge to main and after CI is green, builds the image, pushes it to ECR (login โ tag โ push by git SHA), and deploys โ build + push + deploy tied into one file.
CI/CD pipeline: each stage must pass before the next runs โ a failure halts the deploy.
Which sequence correctly orders the core stages of the end-to-end ML lifecycle that this track built?
- The end-to-end path is one chain: train โ track (MLflow) โ version (DVC) โ serve (FastAPI + Docker) โ CI/CD โ push (ECR) โ deploy (cloud) โ monitor โ retrain.
- A consolidated CI/CD workflow ties build + push + deploy together: tests gate every PR, and a merge to main builds the image, pushes it to ECR by git SHA, and deploys behind an approval gate.
- MLOps is the connecting loop, not any single tool โ the return arrow from monitor โ retrain โ deploy is what turns a one-shot deploy into a model that endures and renews itself.
A mature ML team runs exactly this loop in production: every model change flows train โ track โ version โ serve โ CI/CD โ registry โ deploy โ monitor, and a drift alert reopens the loop at retraining โ the pipeline that lets them ship and operate models continuously.
If you remove it: You'd have isolated capabilities โ a notebook model, a stray Dockerfile, a lone CI file โ but no reliable, repeatable path from a code change to a monitored, self-retraining production model.