Connecting to MLflow
Quick tutorial on connecting to MLflow from jupyterhub in CloudSense.
Last updated
Quick tutorial on connecting to MLflow from jupyterhub in CloudSense.
Last updated
In CloudSense, the node that serves MLflow and database that houses the artifacts are preconfigured after deployment. However, if you are attempting to access MLflow from a jupyter notebook, authentication is required. This is accomplished by passing a security token to the MLfLow node and setting your cloud database credentials as environmental variables.
In this guide you will learn how to authenticate from within jupyter so you may interact with the MLflow tracking server and artifact database - enabling you to start logging metrics, models and artifacts for training runs.
Before continuing with this tutorial please make sure to complete steps in .
To make the authentication process as seamless as possible the CloudSense team created a public gitlab repo containing example notebooks and modules that you can use get authenticated in any of your jupyter notebooks.
First, open a new terminal window in your jupyterhub application. Once opened, navigate to your working directory and clone the gitlab repo.
Open your jupyter notebook within the same working directory and execute the following cells to import the necessary packages and display the authentication widget.
Enter your credentials in the widget and then execute the following cells. This code will instantiate the CloudSense API object, log into the API using the credentials provided in the widget and fetch your cluster information.
From the cluster list printed, identify the cluster_id belonging to the cluster in which your MLflow app is running. Then enter the cluster_id as an argument in the get_mlflow_token method and set your mlflow_uri variable using the following commands.
Set environmental variables for cloud credentials.