Maxwell : Standalone jupyter-notebooks

Access to Maxwell or any other advance compute resource is actually not needed at all to run a jupyter notebook. As an example, we use the pal cluster to launch a notebook:

First you might one to configure a notebook-server to use a specific port, and possibly protect it by a password.  Below is a simple scriplet which generates a configuration:

configure.local-jupyter.sh
#!/bin/bash
source /etc/profile.d/modules.sh
module load maxwell conda

if [[ -f $HOME/.jupyter/jupyter_notebook_standalone.py ]]; then
  echo "Config exists: $HOME/.jupyter/jupyter_notebook_standalone.py"
  echo "Remove first to generate a config"
else

mypass=$(python -c 'from notebook.auth import passwd; x=passwd(); print(x)') 
myid=$(id -u)

cat<<EOF >> $HOME/.jupyter/jupyter_notebook_standalone.py
c.NotebookApp.ip = '*'
c.NotebookApp.open_browser = True
c.NotebookApp.password = '$mypass'
c.NotebookApp.port = $myid
c.NotebookApp.port_retries = 50

EOF

fi

Since the notebook is acting as a web-service, it needs to allocate a port. In the example above we used the Unique ID of the users account, which provides a unique port. So chances to get in conflict with other users are rather small.

First you need to connect to a machine like max-wgs.desy or pal.desy.de or .... Use putty or your ssh-client of choice:

# 
# sample session to run the notebook on a maxwell-worker node. works pretty much the same way on pal...
#
%[max-wgs] salloc -N 1 --time=1-00:00:00 --partition=maxcpu
salloc: Granted job allocation 5643260
salloc: Waiting for resource configuration
salloc: Nodes max-wn001 are ready for job

# start the notebook. 
%[max-wgs] ssh max-wn001 # the allocated node!
%[max-wn001] module load maxwell conda
%[max-wn001] jupyter notebook --no-browser --config=$HOME/.jupyter/jupyter_notebook_standalone.py
[W 15:02:50.584 NotebookApp] WARNING: The notebook server is listening on all IP addresses and not using encryption. This is not recommended.
[I 15:02:50.667 NotebookApp] JupyterLab beta preview extension loaded from /opt/anaconda3/5.2/lib/python3.6/site-packages/jupyterlab
[I 15:02:50.667 NotebookApp] JupyterLab application directory is /afs/desy.de/SL/7/x86_64/opt/anaconda3/5.2/share/jupyter/lab
[I 15:02:50.686 NotebookApp] Serving notebooks from local directory: /afs/desy.de/user/./......
[I 15:02:50.686 NotebookApp] 0 active kernels
[I 15:02:50.686 NotebookApp] The Jupyter Notebook is running at:
[I 15:02:50.686 NotebookApp] http://max-wn001.desy.de:XXXXXX/
[I 15:02:50.687 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).

# copy the line above http://max-wn001.desy.de:XXXXXX/ (yours will have a number instead of XXXXX!!) and paste into the browser of your local machine, type the password used above (not the desy password) and your are ready to go ... 



Attachments:

configure.local-jupyter.sh (application/x-sh)