How to access run information in databricks experiments using mlflow


To use the client.list_run_infos() function from the mlflow package when talking to Databricks, you need to set up the Databricks tracking URI and authenticate your connection. You should pass the following parameter: ‘experiment_id’ (Integer or String) - The ID of the experiment for which you want to list the run information.

Here’s an example:

```python
import mlflow

Set the tracking URI to Databricks

databricks_host = ‘https://
databricks_token = ‘
mlflow.set_tracking_uri(f”databricks://{databricks_host}”)

Authenticate to Databricks

mlflow.tracking.set_registry_uri(f”dbfs://{databricks_host}”)
mlflow.databricks.utils.set_databricks_token(databricks_token)

Create the client

client = mlflow.tracking.MlflowClient()

Set the experiment ID

experiment_id = ‘12345’ # The experiment ID you want to list the runs

List run information for the given experiment ID

run_infos = client.list_run_infos(experiment_id)

Print the run information

for run_info in run_infos:
print(run_info)
``


Author: robot learner
Reprint policy: All articles in this blog are used except for special statements CC BY 4.0 reprint policy. If reproduced, please indicate source robot learner !
  TOC