Skip to content

getstartednotebook_quickstart#3812

Closed
Gnanasundaramsampath-sys wants to merge 7 commits intomainfrom
v-sampath-notebook_quickstart
Closed

getstartednotebook_quickstart#3812
Gnanasundaramsampath-sys wants to merge 7 commits intomainfrom
v-sampath-notebook_quickstart

Conversation

@Gnanasundaramsampath-sys
Copy link
Copy Markdown

Description

Checklist

  • I have read the contribution guidelines.
  • I have coordinated with the docs team (mldocs@microsoft.com) if this PR deletes files or changes any file names or file extensions.
  • Pull request includes test coverage for the included changes.
  • This notebook or file is added to the CODEOWNERS file, pointing to the author or the author's team.

…r 502 error

- pip<=21.3.1 (2021) is incompatible with mlflow==2.17.0 (2024); updated to pip>=23.0
- pandas==1.5.3 is too old relative to scikit-learn==1.5.2 and mlflow==2.17.0; updated to pandas>=2.0.0
- These mismatched versions caused the serving container liveness probe to fail with HTTP 502
Use MLflow default inferred environment for registered sklearn model.
This avoids deployment-time container startup failures (liveness 502)
caused by custom environment resolution/loading issues.
Three root-cause fixes:
1. Restore correct mlflow.sklearn.log_model() call - previous edit had
   introduced a literal backslash-n (\\n) making main.py unparseable Python,
   causing every training job to fail silently.
2. Add minimal conda_env to log_model so the MLflow model artifact carries
   only the required serving packages (mlflow>=2.0, scikit-learn==1.5.2,
   cloudpickle, numpy, pandas, psutil) with pip as the installer - avoids the
   large Azure ML training env being baked into the serving container.
3. Make create_job cell wait for the training job to complete via
   ml_client.jobs.stream() before proceeding to deployment. Without this,
   deployment picked up models from previous runs that carried the broken
   original conda_env (pip<=21.3.1), causing persistent 502 liveness failures.
…racking server

The sklearn-1.5 curated environment ships MLflow 2.17 which introduced a new
'LoggedModel' entity requiring POST /api/2.0/mlflow/logged-models/create.
Azure ML's MLflow tracking server does not implement this endpoint, causing:
  'UserError: User process python exited with status code 1'
  'rest_store.create_logged_model -> HTTP 404/not-implemented'

Two fixes:
1. job environment_variables: MLFLOW_ENABLE_LOGGED_MODEL_CREATION=false
   Instructs MLflow 2.17 to skip the new LoggedModel creation path and use
   the legacy artifact-only log path compatible with Azure ML tracking.
2. mlflow.sklearn.autolog(log_models=False)
   Prevents autolog from also attempting to call _create_logged_model()
   during clf.fit(), which would fail the same way independently.
Training was still failing in cell 6 with:
  /api/2.0/mlflow/logged-models -> 404
from mlflow.sklearn.log_model in curated sklearn-1.5 env.

Switch notebook training script to the same working repo pattern used by
Responsible AI samples:
- save sklearn model to a temp local directory
- register using MlflowClient.create_registered_model/create_model_version
  with file:// source URI
- keep explicit conda_env in the saved model artifact for deployment runtime

This bypasses logged-models endpoint entirely while preserving model registry
and downstream endpoint deployment flow.
… using unique model names

Deployment was still failing with liveness 502 after training succeeded.
Two hardening changes:
1) Stop passing custom conda_env when saving the model artifact used for registry
   (let mlflow infer default env from training environment to avoid dependency drift).
2) Use a unique registered model name per run (credit_defaults_model_<uuid>)
   to guarantee deployment uses the model created in the current CI run and
   cannot accidentally select stale/broken versions from prior runs.

Also keeps prior logged-models workaround and job wait behavior.
@Gnanasundaramsampath-sys Gnanasundaramsampath-sys deleted the v-sampath-notebook_quickstart branch April 3, 2026 04:44
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