Package: mlflow-export-import
MLflow Export ImportThe MLflow Export Import package provides tools to copy MLflow objects (runs, experiments or registered models) from one MLflow tracking server (Databricks workspace) to another.
Using the MLflow REST API, the tools export MLflow objects to an intermediate directory and then import them into the target tracking server.For more details:JSON export file format.MLflow Object Relationshipsslide deck.ArchitectureOverviewWhy use MLflow Export Import?MLOps CI/CD. Migrate runs (or registered models) to another tracking server.Promote a run from the development to the test tracking server.After it passes tests, then promote it to the production tracking server.Share and collaborate with other data scientists in the same or other tracking server (Databricks workspace).For example, copy an experiment from one user to another.Backup your MLflow objects to external storage so they can be restored if needed.Disaster recovery. Save your MLflow objects to external storage so they can be replicated to another tracking server.MLflow Export Import scenariosSource tracking serverDestination tracking serverNoteOpen sourceOpen sourcecommonOpen sourceDatabricksless commonDatabricksDatabrickscommonDatabricksOpen sourcerareMLflow ObjectsThese are the MLflow objects and their attributes that can be exported.ObjectRESTPythonSQLRunlinklinklinkExperimentlinklinklinkRegistered ModellinklinklinkRegistered Model VersionlinklinklinkMLflow provides rudimentary capabilities for tracking lineage regarding the original source objects.
SeeREADME_governance.Tools OverviewThere are two dimensions to the MLflow Export Import tools:Export of MLflow objects in single or bulk mode.Regular Python scripts or Databricks notebooks.Single and Bulk ToolsThe two export modes are:Single tools. Copy a single MLflow object between tracking servers.
These tools allow you to specify a different destination object name.
For example, if you want to clone the experiment/Mary/Experiments/Irisunder a new name, you can specify the target experiment name as/John/Experiments/Iris.Bulk tools. High-level tools to copy an entire tracking server or a collection of MLflow objects.
There is no option to change destination object names.
Full object referential integrity is maintained (e.g. an imported registered model version will point to the imported run that it refers to.Databricks notebookssimply invoke the corresponding Python classes.LimitationsSeeREADME_limitations.md.Quick StartSetuppip install mlflow-export-importExport experimentexport MLFLOW_TRACKING_URI=http://localhost:5000

export-experiment \
  --experiment sklearn-wine \
  --output-dir /tmp/exportImport experimentexport MLFLOW_TRACKING_URI=http://localhost:5001

import-experiment \
  --experiment-name sklearn-wine \
  --input-dir /tmp/exportSetupSupports python 3.8.Local setupFirst create a virtual environment.python -m venv mlflow-export-import
source mlflow-export-import/bin/activateThere are several different ways to install the package.1. Install from PyPI - recommendedpip install mlflow-export-import2. Install from github directlypip install git+https:///github.com/mlflow/mlflow-export-import/#egg=mlflow-export-import3. Install from github clonegit clone https://github.com/mlflow/mlflow-export-import
cd mlflow-export-import
pip install -e .Databricks notebook setupThere are two different ways to install the package in a Databricks notebook.1. Install package in notebookSee documentation:Install notebook-scoped libraries with %pip.%pip install mlflow-export-import2. Install package as a wheel on clusterBuild the wheel artifact, upload it to DBFS and theninstall it on your cluster.git clone https://github.com/mlflow/mlflow-export-import
cd mlflow-export-import
python setup.py bdist_wheel
databricks fs cp dist/mlflow_export_import-1.0.0-py3-none-any.whl {MY_DBFS_PATH}Laptop to Databricks usageTo run the tools externally (from your laptop) against a Databricks tracking server (workspace) set the following environment variables:export MLFLOW_TRACKING_URI=databricks
export DATABRICKS_HOST=https://mycompany.cloud.databricks.com
export DATABRICKS_TOKEN=MY_TOKENFor full details seeAccess the MLflow tracking server from outside Databricks.Running toolsThe main tool scripts can be executed either as a standard Python script or console script.Pythonconsole scripts(such as export-run, import-run, etc.) are provided as a convenience. For a list of scripts seesetup.py.This allows you to use:export-experiment --helpinstead of:python -u -m mlflow_export_import.experiment.export_experiment --helpOtherREADME_options.mdadvanced options.Miscellanous tools.TestingThere are two types of tests : open source and Databricks tests.
Seetests/READMEfor details.README filesREADME.mdREADME_single.mdREADME_bulk.mdREADME_tools.mdREADME_limitations.mdREADME_options.mdREADME_export_format.mdREADME_governance.mdtests/README.mdtests/open_source/README.mdtests/databricks/README.mdmlflow_export_import/workflow_api/README.mddatabricks_notebooks/README.md