fix: résoudre les timeouts MLflow/MinIO dans le script de ré-entraînement#213
Merged
Conversation
… les credentials Problèmes identifiés lors de l'exécution du script de ré-entraînement : - MLFLOW_HTTP_REQUEST_TIMEOUT non défini → timeout par défaut 120s - Credentials MinIO absents du container API → log_model pendait 15s (boto3 explore tous les providers) - Bucket 'mlflow' inexistant dans MinIO → NoSuchBucket à l'upload d'artifact - Crash charmap Windows sur l'emoji 🏃 dans les messages de fin de run MLflow - MINIO_SECRET_KEY généré comme clé séparée → SignatureDoesNotMatch hors Docker - Chaque appel log_metric() individuel → ~23 requêtes HTTP au lieu de 1 Corrections : - Ajout MLFLOW_HTTP_REQUEST_TIMEOUT=8 par défaut dans le script - Ajout AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY / MLFLOW_S3_ENDPOINT_URL dans le service API (docker-compose.yml) - Création automatique du bucket 'mlflow' dans mlflow-entrypoint.sh au démarrage - Wrapper UTF-8 sys.stdout/stderr pour neutraliser le crash charmap - MINIO_SECRET_KEY = MINIO_ROOT_PASSWORD dans init_env.sh (cohérent avec docker-compose) - log_metrics() batch au lieu de log_metric() en boucle - Signature MLflow explicite via predict_proba() (float) pour éviter le warning integer columns - Substitution automatique mlflow:/minio: → localhost: hors Docker (détection /.dockerenv) - load_dotenv(find_dotenv()) pour charger le .env quelle que soit le répertoire d'exécution - Nouvelles variables dans .env.example : MLFLOW_TRACKING_USERNAME, MLFLOW_TRACKING_PASSWORD, MLFLOW_FLASK_SERVER_SECRET_KEY, MLFLOW_S3_ENDPOINT_URL, AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY 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.
Problème
L'exécution de
train_iris.pyvia l'endpoint/retrainpartait systématiquement en timeout. L'investigation avec des timestamps[TIMING]a permis d'identifier plusieurs causes cumulatives.Causes identifiées
MLFLOW_HTTP_REQUEST_TIMEOUTnon définiAWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEYabsents du container APIlog_modelpendait 15s — boto3 parcourt tous les credential providers avant d'abandonnermlflowinexistant dans MinIONoSuchBucketà chaque tentative d'upload d'artifactMINIO_SECRET_KEYgénéré comme clé aléatoire séparée dansinit_env.shSignatureDoesNotMatchhors Docker (docker-compose injecteMINIO_ROOT_PASSWORDà la place)log_metric()appelé en boucle (~23 fois)log_metrics()batchcharmapWindows →mlflow_run_idperdu silencieusementCorrections
documentation/Scripts/train_iris.pyMLFLOW_HTTP_REQUEST_TIMEOUT=8par défaut viasetdefaultload_dotenv(find_dotenv())— charge le.envquelle que soit le répertoire d'exécutionsys.stdout/stderrpour neutraliser le crash charmap WindowsAWS_* > MINIO_ROOT_* > MINIO_*mlflow:/minio:→localhost:hors Docker (détection/.dockerenv)log_metrics()batch au lieu delog_metric()en bouclepredict_proba()(float) — supprime le warning integer columns[TIMING]sur chaque étape pour diagnostiquer les futures lenteursdocker-compose.ymlMLFLOW_S3_ENDPOINT_URL,AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEYdans le service APIdocker/mlflow-entrypoint.shmlflowdans MinIO au démarrage du service (boto3)scripts/init_env.shMINIO_SECRET_KEY=MINIO_ROOT_PASSWORD(plus de clé générée séparément)MLFLOW_TRACKING_USERNAME,MLFLOW_TRACKING_PASSWORD,MLFLOW_FLASK_SERVER_SECRET_KEY,MLFLOW_S3_ENDPOINT_URL,AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY.env.exampleTest
🤖 Generated with Claude Code