VSCode on Compute Node

We have found that some of the VSCode extensions available are not well-behaved on our login nodes. In some instances, VSCode extensions have launched thousands of processes on the login node, severely impacting other users. We recommend that if you are using VSCode to do development work, you allocate an interactive compute node for this.

 

The following process requires either a GitHub or Microsoft account.

 

Initial Set-up

  1. First, you will need to install the VSCode server into your home directory:

    1. SSH into LCC/MCC and go to your home directory.

      ssh linkblue@mcc.uky.edu cd ~
    2. Download and extract the VSCode server

      curl -Lk 'https://code.visualstudio.com/sha/download?build=stable&os=cli-alpine-x64' --output vscode_cli.tar.gz tar -xf vscode_cli.tar.gz
  2. Now, you will need to request an interactive compute node via SLURM.

    srun --nodes=1 --cpus-per-task=4 --time=8:00:00 --partition=normal --account=coa_PIlinkblue_uksr --pty bash -i
  3. After the node has been allocated, your prompt will change to reflect you are working on the compute node (for example, it will change from [linkblue@mcc-login001] to [linkblue@romeXXX] for MCC).

    Start the VSCode server and initiate a tunnel.

  4. You will see the following prompt. Using up/down arrows, highlight which account you would like to use and press enter.

    image-20240719-164621.png
  5. Go to the provided web address and enter the authentication code generated by VSCode. You will be asked to log into the service that you select. You can use your linkblue@uky.edu address for the Microsoft account. Confirm that you are logging in to VSCode.

  6. In your SSH session, you will now be prompted to provide a name for the machine. The default value is the hostname of the node you are connected to (in this example rome115 on MCC). I have entered ‘MCC’ as this tunnel will work for all MCC nodes.

    image-20240719-170205.png
  7. Go to the provided link. At the top of the page, you will be prompted to select which account you used to start the tunnel.

  1. Once the account is selected, a new window will pop up requesting that you log in again. Once logged in, VSCode will initialize in the browser. It may take some time, as the server must be downloaded to MCC and you will see the following notification in the lower-right corner.

  1. When completed, your SSH session will show “Server started”.

  1. Now, you can add this tunnel to your VSCode application. Select “Remote Explorer” from the left-hand icons, then click the icon beside Tunnels. Select the account you used to set up the tunnel in the top action bar. You may be required to log in again. The tunnel will populate in the drop-down from the action bar, select it and a new VSCode window will appear. This window is connected to the interactive compute node.

Establishing a new connection after initial set-up.

You must do this whenever you want to connect to an interactive node.

  1. SSH into LCC/MCC.

  2. Request an interactive node (be sure to set time accordingly, this example is for 8 hours):

  3. Once the job as been allocated a resource, start the VSCode server from your home directory:

  4. Select the account you would like to use. Go to the provided website and enter the authentication code. You can now connect to the tunnel from VSCode > Remote Explorer > Tunnels

Center for Computational Sciences