emiliew
emiliew

Reputation: 81

How to run the mlflow web-based user interface from Amazon SageMaker?

I want to use the mlflow web-based user interface from a notebook on Amazon SageMaker. But the given address http://127.0.0.1:5000 doesn't seeem to work.

I have installed mlflow on a SageMaker notebook.

This code runs nicely:

import mlflow
mlflow.start_run()
mlflow.log_param("my", "param")
mlflow.log_metric("score", 100)
mlflow.end_run()

And then if I run

! mlflow ui

I get the expected result:

[2019-04-09 11:15:52 +0000] [17980] [INFO] Starting gunicorn 19.9.0
[2019-04-09 11:15:52 +0000] [17980] [INFO] Listening at: http://127.0.0.1:5000 (17980)
[2019-04-09 11:15:52 +0000] [17980] [INFO] Using worker: sync
[2019-04-09 11:15:52 +0000] [17983] [INFO] Booting worker with pid: 17983

However, after that when going to http://127.0.0.1:5000 in my browser, nothing loads.

My guess it that 127.0.0.1 is not the right address, but how can I know which address to use instead?

Upvotes: 8

Views: 2353

Answers (2)

I could resolve the issue by port-forwarding instead of using the proxy link.

In the local terminal, run the following command:

ssh -N -L 5000:127.0.0.1:5000 ec2-user@your_sagemaker_instance_ip_address 

And then just go to http://127.0.0.1:5000

Upvotes: 0

Kevin McCormick
Kevin McCormick

Reputation: 2398

Hi and thank you for using SageMaker!

Unfortunately, it appears that mlflow isn't compatible with SageMaker at this time. We do provide a feature that can support these scenarios. SageMaker includes a plugin called jupyter-server-proxy which allows other web applications to be hosted on your SageMaker Notebook Instance, such as TensorBoard.

In the case of mlflow, I was almost able to get your example working by visiting https://mynotebookinstance.notebook.us-east-1.sagemaker.aws/proxy/5000/ (notice how the port number is moved to the end), but unfortunately mlflow displays an error since it currently assumes that it is not running at the root URL path.

I've created an issue in the mlflow GitHub repo: https://github.com/mlflow/mlflow/issues/1120 Please "Star" this issue to keep up-to-date on its status.

Best, Kevin

Upvotes: 5

Related Questions