How abdelkaderbenhmida/mlops-spec-detailed works
Anvil is an air-gapped predictive-maintenance platform: model data is preprocessed, trained, evaluated and registered, then loaded by an inference API that returns equipment-failure risk. The repository also includes infrastructure provisioning, configuration, orchestration and monitoring. The README describes OPC-UA ingestion and a TimescaleDB telemetry store, but those components are absent from the supplied tree; they are therefore not represented as implemented nodes. Deployment and monitoring links rely on README documentation where source wiring was not sampled.
Main entry points: main.py API application · predict.py Prediction endpoint · preprocess.py Preprocessing · train.py Model training
Components 23
Infrastructure and deployment
- VM provisioning
terraform/main.tf - Host configuration
ansible/site.yml - Kubernetes cluster
kubernetes/namespace.yml - Training image
docker/training/Dockerfile
Model lifecycle
- Maintenance data
ml/data/raw/maintenance.csv - Preprocessing
ml/training/preprocess.py - Model training
ml/training/train.py - Model evaluation
ml/evaluation/evaluate.py - MLflow registry
ansible/roles/mlflow/tasks/main.yml - Drift detection
ml/monitoring/drift_detector.py - Retraining trigger
ml/monitoring/retraining_trigger.py
Inference service
- API application
api/main.py - Prediction endpoint
api/app/routers/predict.py - Health endpoints
api/app/routers/health.py - Model loader
api/app/model_loader.py - Request schemas
api/app/schemas.py - Prediction log store
api/app/db.py
Operations and monitoring
- Prometheus metrics
api/app/metrics.py - Prometheus
monitoring/prometheus/prometheus.yml - Grafana dashboards
monitoring/grafana/dashboards/model-performance.json - Offline CI/CD
cicd/Jenkinsfile
Other components
- Plant operators
- Plant telemetry
Connections 30
- Plant operators → API application: requests predictions
README.md - Plant telemetry → Maintenance data: supplies training data
- VM provisioning → Host configuration: provisions hosts for
- Host configuration → Kubernetes cluster: configures cluster
README.md - Training image → Model training: packages training
README.md - Maintenance data → Preprocessing: loads data
ml/training/preprocess.py - Preprocessing → Model training: prepares splits
ml/training/train.py - Model training → MLflow registry: registers model
ml/training/train.py - Model training → Model evaluation: evaluates candidate
README.md - Model evaluation → MLflow registry: checks registered model
ml/evaluation/evaluate.py - Preprocessing → Model evaluation: prepares evaluation data
ml/evaluation/evaluate.py - Drift detection → Preprocessing: loads feature config
ml/monitoring/drift_detector.py - Drift detection → Retraining trigger: writes drift report for
ml/monitoring/drift_detector.py - API application → Prediction log store: initializes database
api/main.py - API application → Model loader: loads model at startup
api/main.py - API application → Prediction endpoint: registers router
api/main.py - API application → Health endpoints: registers router
api/main.py - API application → Prometheus metrics: exposes metrics
- Model loader → MLflow registry: loads registry model
api/app/model_loader.py - Prediction endpoint → Model loader: gets loaded model
api/app/routers/predict.py - Prediction endpoint → Request schemas: validates request
api/app/routers/predict.py - Prediction endpoint → Prediction log store: logs prediction
api/app/routers/predict.py - Prediction endpoint → Preprocessing: transforms input
api/app/routers/predict.py - Health endpoints → Prediction log store: checks connectivity
api/app/routers/health.py - Health endpoints → Model loader: checks model status
api/app/routers/health.py - Kubernetes cluster → API application: hosts inference API
README.md - Prometheus → API application: scrapes API metrics
README.md - Grafana dashboards → Prometheus: visualizes metrics
README.md - Offline CI/CD → Model training: runs training pipeline
README.md - Offline CI/CD → Kubernetes cluster: deploys application
README.md