This article describes how to use Anaconda Enterprise to interact with and develop web applications from within a notebook session. This approach can be used to evaluate real-time accuracy metrics when training models, monitor the progress of parallel computing tasks via dashboards, or interactively develop web applications.
How It Works
Anaconda Enterprise 5.2.x includes a Jupyter Notebook extension called nbserverproxy. This extension forwards network traffic from web services running within a notebook session and allows data scientists to interact directly with web interfaces without the need to deploy their projects each time a change is made. The notebook extension is included in the Python-based project templates in AE 5.2 and does not require any additional configuration by the end user.
To view and interact with a web application, a data scientist can run a web server in their notebook session, construct a URL that refers to the web server, and view the web interface in a web browser tab. The following examples demonstrate how data scientists can run various web applications and frameworks and access them from their browser.
Example: Simple Web Server
1. From within a running notebook session, open a terminal and start a local web server using Python:
python -m http.server
2. Locate the URL of your notebook session.
Using Jupyter Notebook: Right click on the Jupyter icon on the top left of the notebook to obtain the notebook URL:
5. Add “/proxy/” to the right side of the URL as well as the port that corresponds to the running web server (port 8000 in this case):
Example: Dask Dashboard for Parallel Tasks
Dask provides advanced parallelism for analytics, enabling performance at scale for the tools you love. Dask includes an interactive dashboard that allows users to view the progress of computations, memory usage, and task completion. Users can launch a web interface from Dask when performing computations.
When using Dask on your local machine, the Dask dashboard is typically available at a URL such as http://localhost:8787/status. Similar to the steps outlined in the previous example, users can modify the URL of their running notebook session in a new tab to access the Dask dashboard from AE.
1. From within a running notebook session, open a terminal and start a Dask Distributed client:
from dask.distributed import Client, progress
client = Client(processes=False, threads_per_worker=4, n_workers=1, memory_limit='2GB')
2. Determine the port number from the Dask Dashboard URL
4. Modify the URL to only include the full hostname that includes the random hash, then add “/proxy/8787/status” to the right side of the URL, which should result in a URL similar to the following:
Example: Interactive Model Training Dashboard With Tensorboard
Tensorboard is a suite of visualization tools that makes it easy for data scientists to understand, debug, and tune Tensorflow models.
Tensorboard is especially useful when training long-running models by providing valuable feedback to the data scientist in real-time while the model is training.
1. From within a running notebook session, open a terminal and start Tensorboard:
tensorboard --logdir ./mnist_tutorial --reload_interval 1
2. Determine the port number from the Tensorboard URL
3. Locate the URL of your notebook session using the steps described in the first example:
4. Modify the URL to only include the full hostname and first URL path (that includes the random hash), then add “/proxy/6006/” to the right side of the URL, which should result in a URL similar to the following:
5. View and interact with Tensorboard in your browser.
Note: Be sure to include the trailing slash (“/”) after the port number or Tensorboard will return an error that it “Failed to load the set of active dashboards.”