|
|
# How to start an IPython Notebook session
|
|
|
|
|
|
We now have a number of compute nodes in the Shark cluster which also have a connection to the LUMC internal network (EAS384, helicos01, ...). This means we can start an [IPython Notebook](http://ipython.org/notebook.html) session on one of these nodes and connect to it from our desktop machine. We created special `notebook.q` queue for this.
|
|
|
|
|
|
|
|
|
## Starting a session
|
|
|
|
|
|
To start a notebook, just type this from a terminal on Shark:
|
|
|
|
|
|
notebook
|
|
|
|
|
|
|
|
|
You can do this from the head node since a job will be started for you on one of the compute nodes in the `notebook.q` queue. (It might take a while before your job is scheduled.)
|
|
|
|
|
|
The notebook session will be started from the current directory. For example:
|
|
|
|
|
|
mvermaat1@shark:~/test44$ notebook
|
|
|
2013-08-26 15:29:07.032 [NotebookApp] Using existing profile dir: u'/home/mvermaat1/.config/ipython/profile_default'
|
|
|
2013-08-26 15:29:07.269 [NotebookApp] Using MathJax from CDN: https://cdn.mathjax.org/mathjax/latest/MathJax.js
|
|
|
2013-08-26 15:29:07.302 [NotebookApp] Serving notebooks from local directory: /home/mvermaat1/test44
|
|
|
2013-08-26 15:29:07.302 [NotebookApp] The IPython Notebook is running at: https://helicos01.lumcnet.prod.intern:8888/
|
|
|
2013-08-26 15:29:07.302 [NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
|
|
|
|
|
|
|
|
|
Open the link shown after *The IPython Notebook is running at:* (in this example `https://helicos01.lumcnet.prod.intern:8888/`) in your desktop browser and have fun. When you're done, press *Ctrl-C* to end the session.
|
|
|
|
|
|
|
|
|
## Password protection
|
|
|
|
|
|
To prevent anyone on our network from connecting to your session and run arbitrary commands on Shark as your user, the session is protected with a password. The first time you start a notebook session you will be asked to type a password (twice). You can choose any password you like. To reset it, remove the `~/.notebook.password` file.
|
|
|
|
|
|
|
|
|
## Inline plots
|
|
|
|
|
|
You can use IPython's [matplotlib](http://matplotlib.org/) integration to have inline plots in your notebook. Actually, you can only have them inline since there is no X server on Shark to open a plot window.
|
|
|
|
|
|
For now, it's necessary to define a matplotlib backend for this to work in your matplotlibrc file. For me, the Agg backend works:
|
|
|
|
|
|
|
|
|
mvermaat1@shark:~$ cat ~/.config/matplotlib/matplotlibrc
|
|
|
backend: Agg
|
|
|
|
|
|
|
|
|
To enable inline plots, run the following in your notebook:
|
|
|
|
|
|
|
|
|
%matplotlib inline
|
|
|
|
|
|
|
|
|
After that, you can plot away:
|
|
|
|
|
|
|
|
|
import matplotlib.pyplot as plt
|
|
|
plt.plot([2,5,2,8,9,5,3]) |