Azure Databricks MLOps sample for Python based source code using MLflow without using MLflow Project.
page_type: sample ms.custom:
This is a template or sample for MLOps for Python based source code in Azure Databricks using MLflow without using MLflow Project.
This template provides the following features:
git clone https://github.com/Azure-Samples/azure-databricks-mlops-mlflow.git
cd azure-databricks-mlops-mlflow
make install
to install sample packages (taxi_fares
and taxi_fares_mlops
) locallymake test
to Unit Test the code locallymake dist
to build wheel Ml and MLOps packages (taxi_fares
and taxi_fares_mlops
) locallymake databricks-deploy-code
to deploy Databricks Orchestrator Notebooks, ML and MLOps Python wheel packages. If any code changes.make databricks-deploy-jobs
to deploy Databricks Jobs. If any changes in job specs.make run-taxi-fares-model-training
make run-taxi-fares-batch-scoring
NOTE: for deployment and running the Databricks environment should be created first, for creating a demo environment the Demo chapter can be followed.
Check Logs, create alerts. etc. in Application Insights. Following are the few sample Kusto Query to check logs, traces, exception, etc.
Check for Error, Info, Debug Logs
Kusto Query for checking general logs for a specific MLflow experiment, filtered by mlflow_experiment_id
traces
| extend mlflow_experiment_id = customDimensions.mlflow_experiment_id
| where timestamp > ago(30m)
| where mlflow_experiment_id == <mlflow experiment id>
| limit 1000
Kusto Query for checking general logs for a specific Databricks job execution filtered by mlflow_experiment_id
and mlflow_run_id
traces
| extend mlflow_run_id = customDimensions.mlflow_run_id
| extend mlflow_experiment_id = customDimensions.mlflow_experiment_id
| where timestamp > ago(30m)
| where mlflow_experiment_id == <mlflow experiment id>
| where mlflow_run_id == "<mlflow run id>"
| limit 1000
Check for Exceptions
Kusto Query for checking exception log if any
exceptions
| where timestamp > ago(30m)
| limit 1000
Check for duration of different stages in MLOps
Sample Kusto Query for checking duration of different stages in MLOps
dependencies
| where timestamp > ago(30m)
| where cloud_RoleName == 'TaxiFares_Training'
| limit 1000
To correlate dependencies, exceptions and traces, operation_Id
can be used a filter to above Kusto Queries.
make databricks-authenticate
make databricks-init
taxifares
taxifares
make databricks-secrets-put
to put secret in Databricks secret scopemake databricks-add-app-insights-key
to put secret in Databricks secret scopemake deploy
make run-taxifares-model-training
make run-taxifares-batch-scoring