Difference between revisions of "JupyterHub"
Line 31: | Line 31: | ||
It is important that before you log out you terminate your job. In order to do so, go to the top page menu "'''File''' -> '''Hub Control Panel'''" and you will see the following screen. | It is important that before you log out you terminate your job. In order to do so, go to the top page menu "'''File''' -> '''Hub Control Panel'''" and you will see the following screen. | ||
− | [[File:screen04.png| | + | [[File:screen04.png|600px]] |
Here click on the '''Stop My Server''' button. After that you can log out by clicking the '''logout''' button in the right upper corner. | Here click on the '''Stop My Server''' button. After that you can log out by clicking the '''logout''' button in the right upper corner. |
Revision as of 19:28, 17 March 2020
Introduction
PIC offers a service for running Jupyter notebooks on CPU or GPU resources. This service is primarily thought for code developing rather than massive data processing. The usage is similar to running notebooks on your personal computer but offers the advantage of developing and testing your code on different hardware configurations.
Since the service is strictly thought for development and small scale testing tasks, there is a shutdown policy in place: 1) Your session will be closed and removed after 2 hours of idle keyboard. 2) The maximum duration for a session (idle or active) is limited to 48h. In practice that means that you should estimate the test data volume that you work with during a session to be able to be processed in less than 48 hours.
How to connect to the service
Got to jupyter01.pic.es to see your login screen.
Sign in with your PIC user credentials. This will prompt you to the following screen.
Here you can choose the hardware configuration for your job that will be running the Jupyter notebook. After choosing a configuration and pressing start the next screen will show you the progress of the notebook initialisation. Keep in mind that your job is sent to the HTCondor queuing system and waiting for available resources before being started. This can take up to a minute.
In the next screen you can choose a Python notebook, a Python console or a terminal for your work.
Your environments should appear under Notebook and Console. In a later section we will show you how to create a new environment and to remove an existing one.
Terminate your session and logout
It is important that before you log out you terminate your job. In order to do so, go to the top page menu "File -> Hub Control Panel" and you will see the following screen.
Here click on the Stop My Server button. After that you can log out by clicking the logout button in the right upper corner.
Create a new virtual environment with conda
In your jupyter session, click on the terminal button on the right board to open a terminal. Then create your environment:
[neissner@td110 ~]$ <path_to_anaconda>/bin/conda create -n <your_env> python=3 anaconda
Activate the base environment:
[neissner@td110 ~]$ eval "$(<path_to_anaconda>/bin/conda shell.bash hook)"
Initialize conda:
(base) [neissner@td110 ~]$ conda init
This actually changes the .bashrc file in your home directory in order to activate the base environment on login. To avoid that the conda base environment is activated everytime you log on to a node, run:
(base) [neissner@td110 ~]$ conda config --set auto_activate_base false
Activate your environment:
(base) [neissner@td110 ~]$ conda activate <your_env> (<your_env>) [neissner@td110 ~]$
Install the ipykernel package and link it to the environment (it might already be installed):
(<your_env>) [neissner@td110 ~]$ conda install -n <your_env> ipykernel Collecting package metadata (current_repodata.json): done Solving environment: done # All requested packages already installed. (<your_env>) [neissner@td110 ~]$ ipython kernel install --user --name=<your_env> Installed kernelspec <your_env> in /nfs/pic.es/user/n/neissner/.local/share/jupyter/kernels/<your_env>
Deactivate your environment:
(<your_env>) [neissner@td110 ~]$ conda deactivate
Now you can exit the terminal. After refreshing the Jupyter page your new environments/kernels appear in the board.