Skip to content

Latest commit

 

History

History
68 lines (51 loc) · 3.22 KB

README.md

File metadata and controls

68 lines (51 loc) · 3.22 KB

Jupyter on OpenPAI

This guide introduces how to run Jupyter Notebook on OpenPAI. The following contents show some basic examples, other customized examples can be run similarly.

Jupyter Notebook example

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:

Job configuration file

{
    "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.

Access Jupyter Notebook

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. avatar 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