This guide introduces how to run Jupyter Notebook on OpenPAI. The following contents show some basic examples, other customized examples can be run similarly.
To run Jupyter Notebook in OpenPAI, you need to prepare a job configuration file and submit it through webportal.
OpenPAI packaged the docker env required by the job for user to use. User could refer to DOCKER.md to customize this example docker env. If user have built a customized image and pushed it to Docker Hub, replace our pre-built image openpai/pai.example.caffe
with your own.
Here's one configuration file example to use Jupyter Notebook as a tutorial to run a tensorflow mnist example:
{
"jobName": "jupyter_example",
"image": "openpai/pai.example.tensorflow",
"taskRoles": [
{
"name": "jupyter",
"taskNumber": 1,
"cpuNumber": 4,
"memoryMB": 8192,
"gpuNumber": 1,
"portList": [
{
"label": "jupyter",
"beginAt": 0,
"portNumber": 1
}
],
"command": "python3 -m pip install -q jupyter matplotlib && wget -O mnist.ipynb https://raw.githubusercontent.com/ianlewis/tensorflow-examples/master/notebooks/TensorFlow%20MNIST%20tutorial.ipynb && jupyter notebook --allow-root --no-browser --ip 0.0.0.0 --port=$PAI_CONTAINER_HOST_jupyter_PORT_LIST --NotebookApp.token=\"\" --NotebookApp.allow_origin=\"*\" --NotebookApp.base_url=\"/jupyter\""
}
]
}
For more details on how to write a job configuration file, please refer to job tutorial.
Once the job is successfully submitted to PAI, you can view job info in webportal, and access your Jupyter Notebook via http://${container_ip}:${container_port}/jupyter/notebooks/mnist.ipynb. for example, from the above job info page, you can access your Jupyter Notebook via http://10.151.40.202:4836/jupyter/notebooks/mnist.ipynb