RStudio on Esrum - Hansen-Group/HansenWiki GitHub Wiki

Tips and tricks for using RStudioServer on Esrum

This document was written by Malte Thodberg and last updated 2024-03-04.

Official cluster wiki: https://sites.google.com/site/cmbrgenetics/cluster

Access RStudioServer on Hulk.

When on the the KU VPN, you can access to the RStudioServer using:

http://esrumcont01fl:8787

If you are at CBMR and plugged in via an ethernet cable, you can connect without the VPN (see the cluster page for how to set this up)

Monitor usage

To see who is currently using RStudioServer, you can login onto the server directly via ssh:

ssh [email protected]

And use htop for all users or htop -u abc123 to only see your own user:

Trouble shooting being unable to connect to RStudioServer.

If you fail to connect, there are a couple of common things to try:

1) Test server connectivty

See if you can reach the server directly via ssh: ssh [email protected]

2) Remember to properly close down RStudioServer when you are done

If you can get pass the login but RStudioServer does not start, a common issue is that RStudioServer tries to load a huge object back into memory. This happens if you are working on RStudioServer with lots or big object, and then leave the browser window without closing the session (either via q() or via pressing the red button in the top right corner). The very long reload time can cause RStudioServer to think something is wrong.

To prevent this behaviour you should always:

  • Don't leave a session with a lot of large objects in memory suspended for long periods: Instead, save you work with saveRDS() or qs::qsave() and properly close RStudioServer with q().
  • RStudioServer is intended for interactive use: If you need to run something for several hours, you should use the proper quieng system on Esrum

3) Clear the cache

If an RStudioServer session is causing login problems, you can delete it manually by removing files from here:

~/.local/share/rstudio/sessions/active

This will force R and RStudioServer to restart, so any work in the session will be lost!

4) Clear the /tmp dir

All RStudioServer users share the same /tmp dir by default. If this fills up, it will freeze RStudioServer for all users.

It is hard to figure out if this is causing problems, but a way to check is to see how much space is being used in the /tmp. You might need help from the Data Analytics platform to get it cleared.

5) Ask on #cluster-support

If nothing seems to be working, ask on the channel #cluster-support if other people are also having issues!

Edit ~/.Renviron to control library and temporary locations.

Installed R-packages will by default be placed in your personal home directory. If you do not want this, you can put your R-packages in local folder instead, by adding this line to your ~/.Renviron file:

R_LIBS_USER="/emc/cbmr/users/abc123/R/%v"

You will need to manually create this folder with mkdir first. The %v specifies the version of R (e.g. 4.1). This allows you keep different collections of R-packages in your local folder.

Sometimes other users might freeze RStudioServer (and the terminal) by filling up the default temporary storage on hulk. To avoid this, you can instruct R to save temporary files to your own personal directory:

TMPDIR="/emc/cbmr/users/abc123/tools/R/tmp"

You will need to manually create this folder with mkdir first.