OpenMetadata
Search…
MLflow
In this section, we provide the guides and reference to use the MLflow connector.
  1. 1.
    ​Requirements​
  2. 4.
  3. 5.
    ​Troubleshooting​

1. Requirements

Please ensure that your host system meets the requirements listed below.

OpenMetadata (version 0.9.0 or later)

To deploy OpenMetadata, follow the procedure Try OpenMetadata in Docker.

Python (version 3.8.0 or later)

Use the following command to check your Python version.
1
python3 --version
Copied!

2. Install MLflow Connector

2.1 Prepare a Python virtual environment

In this step, we’ll create a Python virtual environment. Using a virtual environment enables us to avoid conflicts with other Python installations and packages on your host system.
In a later step, you will install the Python module for this connector and its dependencies in this virtual environment.

1 Create a directory for openmetadata

Throughout the docs, we use a consistent directory structure for OpenMetadata services and connector installation. If you have not already done so by following another guide, please create an openmetadata directory now and change into that directory in your command line environment.
1
mkdir openmetadata; cd openmetadata
Copied!

2 Create a virtual environment

Run the following command to create a Python virtual environment called, env. You can try multiple connectors in the same virtual environment.
1
python3 -m venv env
Copied!

3 Activate the virtual environment

Run the following command to activate the virtual environment.
1
source env/bin/activate
Copied!
Once activated, you should see your command prompt change to indicate that your commands will now be executed in the environment named env.

4 Upgrade pip and setuptools to the latest versions

Ensure that you have the latest version of pip by running the following command. If you have followed the steps above, this will upgrade pip in your virtual environment.
1
pip3 install --upgrade pip setuptools
Copied!

2.2 Install the Python module for this connector

Once the virtual environment is set up and activated as described in Step 1, run the following command to install the Python module for the MLflow connector.
1
pip3 install 'openmetadata-ingestion[mlflow]'
Copied!

3. Configure MLflow Connector

Please follow the steps relevant to your use case.

3.1 Create a configuration file using template JSON

Create a new file called mlflow.json in the current directory. Note that the current directory should be the openmetadata directory.
Copy and paste the configuration template below into the mlflow.json file you created.
Note: The source.config field in the configuration JSON will include the majority of the settings for your connector. In the steps below we describe how to customize the key-value pairs in the source.config field to meet your needs.
mlflow.json
1
{
2
"source": {
3
"type": "mlflow",
4
"config": {
5
"tracking_uri": "http://localhost:5000",
6
"registry_uri": "mysql+pymysql://mlflow:[email protected]:3307/experiments"
7
}
8
},
9
"sink": {
10
"type": "metadata-rest",
11
"config": {}
12
},
13
"metadata_server": {
14
"type": "metadata-server",
15
"config": {
16
"api_endpoint": "http://localhost:8585/api",
17
"auth_provider_type": "no-auth"
18
}
19
}
20
}
Copied!

3.2 Configure service settings

In this step we will configure the MLflow service settings required for this connector. Please follow the instructions below to ensure that you’ve configured the connector to read from your MLflow service as desired.

tracking_uri

MLflow server containing the tracking information of runs and experiments (docs).
1
"tracking_uri": "http://localhost:5000"
Copied!
registry_uri
Backend store where the Tracking Server stores experiment and run metadata (docs).
1
"registry_uri": "mysql+pymysql://mlflow:[email protected]:3307/experiments"
Copied!

3.3 Confirm sink settings

You need not make any changes to the fields defined for sink in the template code you copied into bigquery.json in Step 3. This part of your configuration file should be as follows.
1
"sink": {
2
"type": "metadata-rest",
3
"config": {}
4
},
Copied!

3.4 Confirm metadata_server settings

You need not make any changes to the fields defined for metadata_server in the template code you copied into bigquery.json in Step 3. This part of your configuration file should be as follows.
1
"workflowConfig": {
2
"openMetadataServerConfig": {
3
"hostPort": "http://localhost:8585/api",
4
"authProvider": "no-auth"
5
}
6
}
Copied!

4. Run MLflow Connector

Your mlflow.json configuration file should now be fully configured and ready to use in an ingestion workflow.
To run an ingestion workflow, execute the following command from the openmetadata directory you created in Step 1.
1
metadata ingest -c ./mlflow.json
Copied!

Setup MLflow connector in production (optional)

If you already have a production Airflow instance on which you would like to schedule OpenMetadata ingestion workflows, follow the procedure Ingest Metadata in Production.

Next Steps

To view the metadata ingested from MLflow, visit http://localhost:8585/explore/tables. Select the MLflow service to filter for the data you’ve ingested using the workflow you configured and ran following this guide.

5. Troubleshooting

ERROR: Failed building wheel for cryptography

When attempting to install the openmetadata-ingestion[mlfow] Python package in Step 2, you might encounter the following error. The error might include a mention of a Rust compiler.
1
Failed to build cryptography
2
ERROR: Could not build wheels for cryptography which use PEP 517 and cannot be installed directly
Copied!
1
pip3 install --upgrade pip setuptools
Copied!
Then re-run the install command in Step 2.

requests.exceptions.ConnectionError

If you encounter the following error when attempting to run the ingestion workflow, this is probably because there is no OpenMetadata server running at http://localhost:8585.
1
requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8585):
2
Max retries exceeded with url: /api/v1/services/databaseServices/name/mlflow
3
(Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x1031fa310>:
4
Failed to establish a new connection: [Errno 61] Connection refused'))
Copied!
To correct this problem, follow the procedure Try OpenMetadata in Docker to deploy OpenMetadata.
Then re-run the metadata ingestion workflow in Run MLflow Connector.