You have a question? We are sure somebody had this question already. Here are the answers you are looking for:

Organisation


Coding & Software

Git

Yet Another Git Cheatsheet https://dev.to/hengnee/yet-another-git-cheatsheet-4gjk

Oh Shit, Git!?! https://ohshitgit.com

Python

Setup Virtual Environments

Jupyter Notebooks

Make sure you have activated a virtual pyhton envirounemt if you want to install packages later.

Install Jupyter Lab or Jupyter Notebook

1) Check if you have installed the packages jupyterlab or notebook. You can check this via the following command

pip list
pip list


2) If you have not installed it you can run:

juypterlab
pip install jupyterlab

or

notebook
pip install notebook

for further information refer to: https://jupyter.org/install.html


Computation & Hosts

Storage Space

Where to find the shares


Remote Access

How can I access the computation hardware remotely?

1) Make sure screen is installed. https://wiki.ubuntuusers.de/Screen/

screen
screen --version


2) Activate port forwarding. If you have logged in via ssh you have to exit this connection and start it again using an additional argument

ssh -L
ssh -L 8888:localhost:8888 <TUM-ID>@your-desired-host@clients.ldv.ei.tum.de

Now the local port 8888 will be forwarded to the machine where your jupyter notebook will be running.


3) Start a screen session

notebook
screen -S my-session-name

You will notice that the terminal session was renewed. This is your screen session.


4) Starting the jupyter notebook. Navigate in the folder where your jupyter notebooks are stored and type the following command for Jupyter Lab

notebook
jupyter lab

or for a simple Jupyter Notebook

notebook
jupyter notebook


5) Open the notebook session. During startup jupyter will provide you with a link to your notebook server. 

http://localhost:8888/?token=?...?

You can enter this link in your browser as long as our SSH session is active. You need the token to verify that you are the right user. Otherwise any person could user your notebook. 

6) Detach the screen session. When you are done developing and want to close your session you go to your terminal where your screen session is running and press Ctrl + A on your keyboard. Now screen waits for a command. Since we do not want to kill the session and just detach it you can now press the key D. You will see that the session is detached but still runs in the background with your jupyter notebook. (Refer to https://wiki.ubuntuusers.de/Screen/ for more details)

Resume Remote Access

How can I resume a running remote session?

1) Login via SSH and port forwarding

ssh -L
ssh -L 8888:localhost:8888 <TUM-ID>@your-desired-host.clients.ldv.ei.tum.de


2) Since your screen session is still running you can now enter again the Link to your Jupyter Notebook in your browser.

http://localhost:8888/?token=?...?


3) If you do not remember your token you can resume the screen session via. Here you should see the old outputs.

screen -r my-session-name


4) If you want to see the output your python script produce in your absence, you can add this Built-in magic command in your cell of interest.

%%capture output

def my_python_code():
	what = 0
	so = 1
	ever = 2
	this_functions_takes_for_ever(10000)

In another cell you can access the stdout and stderr via:

output()

or

output.stdout

or

output.stderr

(Info) Alternatively you can print every important information into a log file and read this when you return. https://docs.python.org/3/howto/logging.html

Shutdown Jupyter Notebook

5) If you want to shutdown your notebook and your screen session you can press Ctrl + C to shut down your notebook. If you now type exit your screen session will be closed.

(Warnung) Please remember to close your screen sessions if you do not need them any more, since you are blocking unattended updates of the host you are working on.



  • Keine Stichwörter