RStudio on O2

Opening RSudio Notebook

Open a new LOCAL terminal on your laptop/desktop (called my_computer in the example below). The following instructions assume you will be connecting from OS X or some other native *nix terminal (e.g. via Debian/CentOS, etc.). If on Windows, use some sort of terminal emulator such as MobaXterm ( use the local MobaXterm bash terminal).  Make sure you have X11 forwarding active (e.g. XQuartz is running if on a Mac, available by default with MobaXterm). Pick a port on your local machine that is empty using whatever methods you like (e.g. netstat). Generally, somewhere in the 50000 range is safe if you just want to guess. SSH to O2 with that port (to be mentioned below as PORT):


me@my_computer:~$ ssh -Y -L PORT:127.0.0.1:PORT ecommons@o2.hms.harvard.edu


Next step is to load the RStudio launcher and the desired R module


ecommons@login01:~$ module load rstudio_launcher/1.0
ecommons@login01:~$ module load gcc/6.2.0
ecommons@login01:~$ module load R/4.0.1


Now, start the RStudio server with an interactive O2 jobs from the login node (for illustrative purposes, we've landed at login01 as our login node) 


ecommons@login01:~$ srun -t 0-6:00 --pty -p interactive -c 1 --mem=2G --x11 --tunnel PORT:PORT RStudio_launcher.sh PORT


where PORT is the numerical value you have used from the initial ssh above.

If you require multiple cores and more than 2GB of memory for your notebook you can modify the parameters -c 1 and --mem=2G as needed

See Using Slurm Basic  for more information about Slurm flags.


Once the job is dispatched you should see a message like:


ecommons@login01:~$ srun -t 0-6:00 --pty -p interactive -c 1 --mem=2G --x11 --tunnel PORT:PORT RStudio_launcher.sh PORT

srun: job 21817189 queued and waiting for resources
srun: job 21817189 has been allocated resources
You can now access RStudio on your local web brower at http://localhost:PORT
Login username = ecommons
Password = tgDS7rOgnD3P+X3ardkS


You can now open a web browser on your local machine and in the address bar enter localhost:PORT, you should be presented with a login window, where user is your O2 username and the password is a temporary password created for the job and printed on screen ( tgDS7rOgnD3P+X3ardkS in this example).  After entering these credentials you should be able to start using RStudio from your web browser. 

Note: The terminal and the job will hang as the RStudio server is running on the background, this is normal;  do not close the job and terminal until you are done working with the RStudio notebook.