Learning from Error

An old-school blog by Adarsh Mathew

A Guide for VSCode & RCC Harmony

Last Modified at — Apr 8, 2021

I’m writing this as I debug and iterate over some code, and shitposting on the group about the religion of VS Code. At Regina’s suggestion, I decided to catalogue what my set up looks like, especially to work on the RCC midway cluster. I’ll keep adding to this document as I learn new quirks about the UChicago RCC system.

I have become extremely reliant on VS Code for my programming needs. So much so that I had 12 hours of zero productivity before a deadline when I thought I was having VSCode-related issues1. It’s neat and has excellent extensions, allows me to dive in and out of GUI and CLI mode when writing Python code, and lets me do multiple things in the same window: writing Markdown files for my blog, running Noetbooks without opening a browser tab, compiling LaTeX files, and even testing SQL queries. So I thought I’d note down what my setup to access the RCC cluster looks like.

Setting up VS Code for Remote Development

Step 1: Install VS Code on your local machine.

Step 2: Since the prime objective here is to enable remote development on a server, install the ‘Remote - SSH’ and ‘Remote Development’ extensions.

Step 3: Set up your ssh credentials to log into RCC2 with VS Code. Follow the instructions here. You just need to complete the ‘Getting Started’ section. The broad steps are: set up an SSH key-id pair, add your RCC credentials, and connect.

Step 4: To connect to RCC host any time after this: Ctrl+Shift+P, ‘Remote-SSH Connect to Host’

Step 5: Done.

You can now install the extensions you want on the RCC server side. I installed:

Running Notebooks without the hassle of a VPN

Figuring this out was the thing that made me a full VSCode convert. It’s pretty nifty, even if the downside is you don’t get checkpoint files.

For this section, I’m assuming you’ve been able to log into RCC using the steps above.

Update: While helping Nak Won set this up, we discovered this is broken. Because Midway or VSCode doesn’t preserve the terminal in Step 4, which is a pain. So now I add a Step 0.

Step 0: Create a tmux session.

If you’re on Midway2, you need to load the tmux module.

1
2
$ module load tmux
$ tmux -t myrccsession

Step 1: Requisition a compute node.

1
$ sinteractive -p broadwl --mem=16G --time=2:00:00

Step 2: Load the Anaconda module or your custom env

1
$ module load python

Step 3: Get your hostname for the compute node. Copy the address.

1
$ hostname -I

Step 4: Launch your Jupyter kernel. Use the address from the previous step for your ip address. Copy the address of the Jupyter kernel created.

1
$ jupyter-notebook --no-browser --ip=xxx.xxx.xxx

Step 5: Either open an existing notebook in VS Code using the navigation bar on the side, or create a blank notebook.

Step 6: At the top right corner, click on ‘Jupyter Server’. You should get a drop down asking if you want the default kernel or an existing one. Select existing, and paste the address of the Jupyter kernel from the previous step. You’ll get a prompt to reload, which should be painless.

To retrieve the terminal where you initialized the notebook, attach the tmux session from before.

1
2
$ module load tmux
$ tmux a -t myrccsession

Step 7: Done.


Next: Getting it to run R via the notebook on the cluster.


  1. Spoiler: They were SSH-related issues, not VS Code ones. I managed to get my IP blacklisted, somehow. ↩︎

  2. RCC instructions to connect via SSH: https://rcc.uchicago.edu/docs/connecting/index.html#connecting-with-ssh ↩︎

comments powered by Disqus