Using Jupyter Notebook¶
About Jupyter Notebook¶
Jupyter is a popular open source web application by Project Jupyter for interactive computing across dozens of languages, including Python, Julia, and R. It comes in two flavors, the classic Jupyter Notebook and the next generation JupyterLab. ARC currently provides both applications via a graphical interface using software called Open OnDemand. Uses include data cleaning and transformation, numerical simulation, statistical modeling, data visualization, machine learning, and much more.
Jupyter Notebook is a web application that allows you to create and share documents that contain live code, equations, visualizations and narrative text. These documents, called notebooks, contain both computer code and rich text elements (paragraphs, equations, figures, widgets, links). They are human-readable documents containing analysis descriptions and results but are also executable data analytics artifacts. Notebooks are associated with kernels, processes that execute the code. Notebooks can be shared or converted into static HTML documents. The Jupyter Notebook app is powerful tool for code development, creating reproducible research, and teaching.
Accessing Jupyter Notebook¶
Jupyter Notebook is available to ARC users as an application via Open OnDemand. This service is a way for users to access to their HPC resources via a web interface. For detailed information about using Open OnDemand please see Using Open OnDemand.
After logging into Open OnDemand, select Jupyter Notebook from the Interactive Apps menu at the top. Complete the form fields. If you have previously installed additional kernels (see below) or libraries that you wish to use, be sure that you select the same version of Python Anaconda that you used during installation. After completing the form, click the Launch button at the bottom. When your job is ready, click the "Connect to Jupyter" button.
You should now find Python available as a Notebook in the dropdown menu (at the top-right). If you have installed other kernels (e.g. R), they will show up along with Python.
The kernel¶
A kernel executes the code contained in a Notebook document. The ipython kernel executes python code. Kernels for many other languages exist. When you open a Notebook document, the associated kernel is automatically launched. When the notebook is executed (either cell-by-cell or with menu Cell -> Run All), the kernel performs the computation and produces the results.
The Jupyter apps available via ARC's web interface only provide the iPython kernel. However, you may install additional kernels for your personal use. Please see, Installing the R kernel for instructions.
Ending your Jupyter Notebook Open OnDemand session¶
To ensure you do not incur unnecessary charges on your slurm account,
there are specific steps to follow in order to end your slurm job when
you are finished using Jupyter Notebook. Otherwise, the job will
remain active, and you will contine to accrue charges until the amount
of time you specified when initiating the job has expired. As with
all sessions of the Open OnDemand web interface, the surefire way to
avoid incurring charges for unused resources when you are finished
with a session is to kill that job by using the red Delete
button on
the "My Interactive Sessions" tab. A pop-up window will appear; press
Confirm
to delete the session.
Delete Jupyter Notebook from the "My Interactive Sessions" tab to stop charges when you are done using the app.
If you wish to end your job from within the Jupyter Notebook app, use
the Quit
button in the top right-hand corner of the tab holding your
Jupyter Notebook session. This will shut down Jupyter Notebook and
kill the interactive session running on the compute nodes.
Alternatively, select Quit
from within Jupyter Notebook to stop charges when you are done using the app.
After selecting Quit
, if you return to the "My Interactive Sessions"
page, you will see that the box for the Jupyter Notebook session now
says "Completed" in the top right corner and a message at the bottom
of the box states "Batch Connect Sessions Status Completed." Note,
there may be a brief delay after ending the session via the Quit
button before the status is updated in the panel of the "My
Interactive Sessions" tab. Your slurm job has ended and you are no
longer being charged for that job. You may click the red Delete
button if you wish to clear it from the "My Interactive Sessions"
page. It is important to note that even if you log out of OnDemand or
close all tabs, unless you delete or end those sessions as indicated
they will continue to run (incurring cost) until the hours you have
allocated for the session have run out.
The job will show as Completed
in the "My Interactive Sessions" tab when you have successfully ended the slurm job. You are no longer being charged for that job.