Skip to content

feat: MLflow + MinIO integration for example scripts and init-data workflow#212

Merged
alanconqrepo merged 1 commit into
mainfrom
feat/mlflow-minio-integration-scripts
May 14, 2026
Merged

feat: MLflow + MinIO integration for example scripts and init-data workflow#212
alanconqrepo merged 1 commit into
mainfrom
feat/mlflow-minio-integration-scripts

Conversation

@alanconqrepo
Copy link
Copy Markdown
Owner

Summary

  • train_iris.py : intégration MLflow complète (params, métriques, tags, artifact) avec dégradation gracieuse si MLflow ou MinIO indisponible ; utilise maintenant un DataFrame pandas pour exposer feature_names_in_ sur le modèle sklearn
  • train_iris_GradientBoosting.py : nouveau script (variante GradientBoostingClassifier) avec même intégration MLflow
  • upload_iris_model.py : injecte les credentials MLflow/MinIO dans le subprocess, passe le modèle en production + tag Example + feature_baseline après upload ; ajoute encoding=utf-8 pour éviter les erreurs cp1252 sur Windows
  • upload_iris_model_GradientBoosting.py : nouveau script d'upload pour la version 1.2.0 (non mis en production)
  • send_ground_truth.py / send_predictions_iris.py : fallback API_TOKEN → ADMIN_TOKEN
  • docker-compose.yml : volume mount ./src pour le live reload (api + prediction-writer) ; ajout de MLFLOW_FLASK_SERVER_SECRET_KEY requis par mlflow[auth] ≥ 2.20
  • mlflow-entrypoint.sh : installe mlflow[auth] pour satisfaire la dépendance Flask-WTF/CSRF
  • src/api/models.py : ajout de mlflow dans _ALLOWED_IMPORT_MODULES
  • src/services/model_service.py : expose feature_baseline dans get_available_models() (corrige l'affichage "No baseline" dans le dashboard)

What a reviewer should know

  • Les credentials MinIO dans les scripts upload sont résolus par priorité : MLFLOW_S3_ENDPOINT_URL / AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEYMINIO_PORT / MINIO_ROOT_USER / MINIO_ROOT_PASSWORD (variables du .env)
  • --serve-artifacts a été testé mais est incompatible avec --app-name basic-auth dans MLflow v2.20.2 — abandonné au profit de l'injection de credentials côté client
  • Le volume ./src:/app/src permet de modifier le code sans rebuild de l'image Docker

Test plan

  • docker-compose up -d puis python upload_iris_model.py → modèle v1.0.0 en production avec tag Example et baseline
  • python upload_iris_model_GradientBoosting.py → modèle v1.2.0 uploadé, non en production
  • Dashboard Streamlit /Models → baseline visible, pas de "No baseline"
  • MLflow UI → runs predictml/iris-classifier avec métriques et artifact

🤖 Generated with Claude Code

…rkflow

- train_iris.py: complete MLflow integration (params, metrics, tags, artifact)
  with graceful degradation if MLflow or MinIO unreachable
- train_iris_GradientBoosting.py: new script (GradientBoostingClassifier variant)
- upload_iris_model.py: inject MLflow/MinIO creds into subprocess, set production
  + tag Example + feature_baseline after upload; add encoding=utf-8
- upload_iris_model_GradientBoosting.py: new upload script for v1.2.0 (not production)
- send_ground_truth.py / send_predictions_iris.py: API_TOKEN fallback to ADMIN_TOKEN
- docker-compose.yml: volume mount ./src for live reload (api + prediction-writer);
  add MLFLOW_FLASK_SERVER_SECRET_KEY (required by mlflow[auth] >= 2.20)
- mlflow-entrypoint.sh: install mlflow[auth] to satisfy Flask-WTF CSRF requirement
- src/api/models.py: add mlflow to _ALLOWED_IMPORT_MODULES
- src/services/model_service.py: expose feature_baseline in get_available_models()

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@alanconqrepo alanconqrepo merged commit 1cc2e14 into main May 14, 2026
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant