This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
institute_lorentz:institutelorentz_maris_slurm_jupyterhub [2017/03/07 09:51] – [Access] lenocil | institute_lorentz:institutelorentz_maris_slurm_jupyterhub [2020/01/15 13:34] (current) – removed lenocil | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== JupyterHub with Slurm on Maris ====== | ||
- | |||
- | : | ||
- | |||
- | **As of February 2017 the maris' jupyterhub python environment is located at / | ||
- | commands such as ipcontroller or ipyengine to work within the maris jupyterhub setup you must include it in your paths. See the examples below. | ||
- | |||
- | For instance in bash: | ||
- | |||
- | < | ||
- | export PATH=/ | ||
- | </ | ||
- | : | ||
- | |||
- | |||
- | |||
- | JupyterHub is a multi-user server for Jupyter (AKA IPython) notebooks. Though JupyterHub you can create and share documents that contain live code, equations, visualizations and text notes (comments). | ||
- | |||
- | Maris cluster provides a JupyterHub service which uses dedicated '' | ||
- | authorized users. Users should submit access requests via email or preferably in person to '' | ||
- | |||
- | JupyterHub spawns single-user notebooks by requesting consumable resources to '' | ||
- | |||
- | ===== Access ===== | ||
- | Maris' JupyterHub facilities can be reached (N.B.: **not** from home) via a web browser at | ||
- | |||
- | https:// | ||
- | |||
- | {{ : | ||
- | |||
- | :!: Please note that maris' jupyterhub has **admin_access enabled**. Admin users have the ability to take actions on users' behalf, such as stopping and restarting their servers. | ||
- | ===== Launching Notebooks ===== | ||
- | |||
- | Currently all users that have access to maris will also be able to use JupyterHub provided they have been allowed to use slurm. Upon a successful login, a dropdown menu lets users choose what type of notebook profile to spawn among a few predefined ones: | ||
- | |||
- | |||
- | {{ : | ||
- | |||
- | If the requested | ||
- | |||
- | |||
- | {{ : | ||
- | |||
- | :!: '' | ||
- | |||
- | ===== Jupyter Enabled Extensions ===== | ||
- | |||
- | ==== JupyterHub `Files' | ||
- | The //Files// tab which is the default tab on which a successful login will be redirected allows users to create, modify and remove files from they home directories. Furthermore, | ||
- | ==== JupyterHub `Running' | ||
- | |||
- | This tab will show any running Jupyter processes, such as notebooks and terminals. | ||
- | |||
- | ==== JupyterHub `IPython Clusters' | ||
- | |||
- | JupyterHub users can distribute the load of their calculations to different maris' nodes using ipyparallel. It is highly suggested that users read http:// | ||
- | |||
- | In this section we will only describe how to configure an IPython parallel computing cluster given the current '' | ||
- | |||
- | :!: If you are non familiar with slurm, please consult [[: | ||
- | |||
- | :!: IPython parallel clusters configured without '' | ||
- | |||
- | < | ||
- | scancel <job ID> | ||
- | </ | ||
- | where job ID is the job number relative to the single notebook application. | ||
- | |||
- | |||
- | === Examples: IPython parallel cluster profile === | ||
- | |||
- | All IPython profiles are stored in ${HOME}/ | ||
- | |||
- | First of all, create a new parallel profile. Open a terminal and type | ||
- | ipython profile create dummy --parallel | ||
- | This will create a new directory in your .ipython directory called `profile_dummy' | ||
- | | ||
- | ls .ipython | ||
- | profile_dummy | ||
- | |||
- | This directory (profile) will contain several files that can be customized to your needs. More important, you must customize its files in order to let '' | ||
- | |||
- | Firstly, modify the file `ipcontroller_config.py' | ||
- | | ||
- | | ||
- | |||
- | Secondly, edit the file `ipcluster_config.py' | ||
- | |||
- | < | ||
- | |||
- | c.IPClusterEngines.engine_launcher_class = ' | ||
- | c.IPClusterEngines.n = 2 | ||
- | c.IPClusterStart.controller_launcher_class = ' | ||
- | c.SlurmLauncher.queue = u' | ||
- | |||
- | c.SlurmEngineSetLauncher.batch_template ='''# | ||
- | #SBATCH -A your-account-name | ||
- | #SBATCH -p {queue} | ||
- | #SBATCH -n {n} | ||
- | #SBATCH -D / | ||
- | #SBATCH -o slurm_%u_%N_%j.out # stdout | ||
- | #SBATCH -e slurm_%u_%N_%j.err # stderr | ||
- | |||
- | export PATH=/ | ||
- | |||
- | srun ipengine --profile-dir={profile_dir} | ||
- | |||
- | ''' | ||
- | |||
- | c.SlurmControllerLauncher.batch_template ='''# | ||
- | #SBATCH -A your-account-name | ||
- | #SBATCH -p {queue} | ||
- | #SBATCH -c 1 | ||
- | #SBATCH -N 1 | ||
- | #SBATCH -D / | ||
- | #SBATCH -o slurm_%u_%N_%j.out # stdout | ||
- | #SBATCH -e slurm_%u_%N_%j.err # stderr | ||
- | |||
- | export PATH=/ | ||
- | |||
- | ipcontroller --profile-dir={profile_dir} | ||
- | |||
- | ''' | ||
- | |||
- | </ | ||
- | |||
- | :!: Read the slurm manuals and choose the $SBATCH options appropriately for your needs. | ||
- | |||
- | In this example we note: | ||
- | * We must modify the variable PATH to include **/ | ||
- | * The number of engines can be set using either the web interface via the `Tab Ipython Clusters' | ||
- | * An appropriate slurm account must be charged for things to work. | ||
- | * The slurm partition to which to submit your calculations can be set using `c.SlurmLauncher.queue' | ||
- | |||
- | |||
- | == Start the Profile == | ||
- | |||
- | Navigate to the `IPython Cluster' | ||
- | |||
- | {{ : | ||
- | |||
- | ==== JupyterHub `Conda' | ||
- | This tab allows users to list and manage conda environments using jupyter' | ||
- | |||
- | |||
- | |||
- | < | ||
- | export CONDA_ENVS_PATH=/ | ||
- | </ | ||
- | |||
- | {{ : | ||
- | |||
- | :!: The jupyterhub environment uses nb_conda v2.0.0. This version is known to have several bugs/ | ||
- | < | ||
- | c.NotebookApp.disable_check_xsrf = True | ||
- | </ | ||
- | |||
- | ===== Custom Jupyter Kernels ===== | ||
- | To install a custom python kernel you can use ipython. | ||
- | |||
- | < | ||
- | ipython kernel install --name=my-python-kernel --user | ||
- | </ | ||
- | |||
- | Note that in the command above the python version of the kernel will be the same as the python version that ipython uses. Also, the option `--user' | ||
- | < | ||
- | ${HOME}/ | ||
- | |||
- | ${HOME}/ | ||
- | </ | ||
- | |||
- | In any cases, to see where your local installation of ipython would look for installed | ||
- | |||
- | < | ||
- | python kernelspec list | ||
- | [TerminalIPythonApp] WARNING | Subcommand `ipython kernelspec` is deprecated and will be removed in future versions. | ||
- | [TerminalIPythonApp] WARNING | You likely want to use `jupyter kernelspec` in the future | ||
- | Available kernels: | ||
- | py2 / | ||
- | py2 test1 / | ||
- | python3.6-2017-02-01 | ||
- | python3 | ||
- | |||
- | </ | ||
- | |||
- | Jupyter will display all conda kernels and all installed kernels you might have in the `new notebook' | ||
- | {{ : | ||