VS Code#

Remote-SSH extension#

link: https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-ssh

This extension not only allows you to ssh to Sunbird but also gives you a file explorer using sftp. Install this extension.

Press F1 or View-> Command Palette. For the first time, type remote-ssh and you will see Remote-SSH: Connect to Host.... Just type regular ssh command (ssh s.1915438@swansea.ac.uk) as usual and you will get connected to the Sunbird. If you have your ssh-keys saved in $HOME/.ssh/ it would retrieve it for you and won’t ask you the password.

Next when you, ssh from VS-Code using this extension, then you don’t need to type anything. You will see the Remote-SSH: Connect to Host... on the top in recently used. Also, you get an option to connect to Sunbird just by clicking in the drop-down menu.

image.png

Once you are connected.#

You will see a seperate window of VS-Code will open with a green sign of SSH: sunbird in the bottom left end as follows;

image.png

Accessing the terminal#

Go to View->Terminal or simply ctrl + `.

You can use the terminal as usual.

image.png

Accessing the file explorer#

Go to View-> Explorer or simply click here. image.png

You will see something like this.

image.png

Click on Open Folder, you get a drop-down menu like this one.

image.png

It is best to mount the $HOME directory.

So, simply click ok.

Bingo, the file explorer will load with all the files in home/s.1915438/. You can open the files edit them. But you can’t run them using a debugger.

You have to use the commands that you use in Sunbird CLI (command line interface).

  • python <filename> will run the file on login node.

  • sbatch or srun should be used to run the file on compute/GPU node.

You can’t run specific lines of a file.

That is why I use remote Jupyter-lab server using port forwarding to access the GUI on my local PC. I can run a section of file. I still have the terminal and file browser (doesn’t support drag-drop folders, filezilla does). But you can run individual section of a IronPython file (.ipynb), you can plot. You have kernels, so just click run or ctrl + Enter to run a cell.

Terminating the ssh session#

File-> Close remote connection.