Unable to get mlflow central model registry to work with dbconnect.

sajith_appukutt
Databricks Employee
Databricks Employee

I'm working on setting up tooling to allow team members to easily register and load models from a central mlflow model registry via dbconnect.

However after following the instructions at the public docs , hitting this error

raise _NoDbutilsError
mlflow.utils.databricks_utils._NoDbutilsError 

Looks like _get_dbutils in mlflow expects a valid instance of  ip_shell. Any pointers or workarounds on how to get dbconnect to work with central model registry

sajith_appukutt
Databricks Employee
Databricks Employee

You could monkey patch MLFlow's _get_dbutils() with something similar to this to get this working while connecting from dbconnect

spark = SparkSession.builder.getOrCreate()
# monkey-patch MLFlow's _get_dbutils()
def _get_dbutils():
    return DBUtils(spark)
 
mlflow.utils.databricks_utils._get_dbutils = _get_dbutils

View solution in original post