feat: MLflow + MinIO integration for example scripts and init-data workflow#212
Merged
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 exposerfeature_names_in_sur le modèle sklearntrain_iris_GradientBoosting.py: nouveau script (variante GradientBoostingClassifier) avec même intégration MLflowupload_iris_model.py: injecte les credentials MLflow/MinIO dans le subprocess, passe le modèle en production + tagExample+feature_baselineaprès upload ; ajouteencoding=utf-8pour éviter les erreurs cp1252 sur Windowsupload_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: fallbackAPI_TOKEN → ADMIN_TOKENdocker-compose.yml: volume mount./srcpour le live reload (api + prediction-writer) ; ajout deMLFLOW_FLASK_SERVER_SECRET_KEYrequis parmlflow[auth]≥ 2.20mlflow-entrypoint.sh: installemlflow[auth]pour satisfaire la dépendance Flask-WTF/CSRFsrc/api/models.py: ajout demlflowdans_ALLOWED_IMPORT_MODULESsrc/services/model_service.py: exposefeature_baselinedansget_available_models()(corrige l'affichage "No baseline" dans le dashboard)What a reviewer should know
MLFLOW_S3_ENDPOINT_URL/AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY→MINIO_PORT/MINIO_ROOT_USER/MINIO_ROOT_PASSWORD(variables du.env)--serve-artifactsa été testé mais est incompatible avec--app-name basic-authdans MLflow v2.20.2 — abandonné au profit de l'injection de credentials côté client./src:/app/srcpermet de modifier le code sans rebuild de l'image DockerTest plan
docker-compose up -dpuispython upload_iris_model.py→ modèle v1.0.0 en production avec tag Example et baselinepython upload_iris_model_GradientBoosting.py→ modèle v1.2.0 uploadé, non en production/Models→ baseline visible, pas de "No baseline"predictml/iris-classifieravec métriques et artifact🤖 Generated with Claude Code