Both sides previous revision Previous revision Next revision | Previous revision |
habrok:connecting_to_the_system:connecting_via_vsc [2024/08/22 07:59] – Add instructions for VS Code with web portal pedro | habrok:connecting_to_the_system:connecting_via_vsc [2025/05/27 09:18] (current) – [Advanced: Connecting to Hábrók with Visual Studio Code] fokke |
---|
[[https://code.visualstudio.com/|Microsoft Visual Studio Code]] (VS Code) is a popular source code editor and IDE that is available for free and which can run on Linux, Windows and macOS systems. It allows connecting to remote environments and working from them and the installation of extensions to support different programming languages and make use of additional development tools. Because of this, it is suitable for connecting to Hábrók to perform software development tasks. There are two main ways to use VS Code from Hábrók, either by connecting your local VS Code installation client via SSH to a VS Code server running in one of the access nodes, or by running it directly on your browser through our [[https://portal.hb.hpc.rug.nl/|web portal]]. | [[https://code.visualstudio.com/|Microsoft Visual Studio Code]] (VS Code) is a popular source code editor and IDE that is available for free and which can run on Linux, Windows and macOS systems. It allows connecting to remote environments and working from them and the installation of extensions to support different programming languages and make use of additional development tools. Because of this, it is suitable for connecting to Hábrók to perform software development tasks. There are two main ways to use VS Code from Hábrók, either by connecting your local VS Code installation client via SSH to a VS Code server running in one of the access nodes, or by running it directly on your browser through our [[https://portal.hb.hpc.rug.nl/|web portal]]. |
| |
| There is a separate section on using Python virtual environments: [[../examples/vscode_python]] |
| |
===== Using the web portal ===== | ===== Using the web portal ===== |
The simplest and most straightforward way of using VS Code on Hábrók is by using our [[https://portal.hb.hpc.rug.nl/|web portal]]. Simply login with your university account and open the VS Code Server Interactive App by navigating in the top bar to Interactive Apps -> VS Code Server. From the VS Code Server page, you can queue a job with the necessary memory and CPU requirements for your use case and the root directory for your VS Code session. After that, simply launch the job and wait for a while until your job begins, often this takes only just a moment. As soon as the job has started and is ready, you should see a blue button to Connect to VS Code. This will automatically start up your VS Code session in the compute node your job is running. | The simplest and most straightforward way of using VS Code on Hábrók is by using our [[https://portal.hb.hpc.rug.nl/|web portal]]. Simply login with your university account and open the VS Code Server Interactive App by navigating in the top bar to Interactive Apps -> VS Code Server or by clicking the shortcut in the main page after logging in. From the VS Code Server page, you can queue a job with the necessary memory and CPU requirements for your use case and the root directory for your VS Code session. After that, simply launch the job and wait for a while until your job begins, often this takes only just a moment. As soon as the job has started and is ready, you should see a blue button to Connect to VS Code. This will automatically start up your VS Code session in the compute node your job is running. |
| |
===== Connecting with VS Code via SSH ===== | ===== Connecting with VS Code via SSH ===== |
* Connect to Hábrók to any of the login nodes as normal (via a terminal, MobaXterm, or the web portal) and submit a job to the desired node type and with the desired settings. This job should not do anything, so you can use the ''sleep'' command to ensure it stays open. Here is an example: | * Connect to Hábrók to any of the login nodes as normal (via a terminal, MobaXterm, or the web portal) and submit a job to the desired node type and with the desired settings. This job should not do anything, so you can use the ''sleep'' command to ensure it stays open. Here is an example: |
| |
#!/bin/bash | #!/bin/bash |
#SBATCH --time=00:30:00 | #SBATCH --time=00:30:00 |
#SBATCH --partition=regular | #SBATCH --partition=regular |
#SBATCH --nodes=1 | #SBATCH --nodes=1 |
#SBATCH --cpus-per-task=4 | #SBATCH --cpus-per-task=4 |
#SBATCH --mem=8GB | #SBATCH --mem=8GB |
| |
sleep 1800 | sleep 1800 |
| |
* Once the job is running, you can find out what node has been assigned to it with ''squeue''. You will need this information later. | * Once the job is running, you can find out what node has been assigned to it with ''squeue''. You will need this information later. |
* Press ''Ctrl+P'' or ''Command+P'' once more and enter "Connect to Host". | * Press ''Ctrl+P'' or ''Command+P'' once more and enter "Connect to Host". |
* From the drop-down menu, select "+ Add New SSH Host...". | * From the drop-down menu, select "+ Add New SSH Host...". |
* Input the ''ssh'' command to connect, but this time with the information to connect to the relevant compute node. Assuming your job is running on ''node2'', you would write: ''ssh -J pNUMBER@login1.hb.hpc.rug.nl node2''. | * Input the ''ssh'' command to connect, but this time with the information to connect to the relevant compute node. Assuming your job is running on ''node2'', you would write: ''ssh -J pNUMBER@login1.hb.hpc.rug.nl pNUMBER@node2''. |
* You will then be asked what configuration file to save the information at. Any of the suggested options should work, the ''.ssh/config/'' you presumably have on your home directory is a good option. | * You will then be asked what configuration file to save the information at. Any of the suggested options should work, the ''.ssh/config/'' you presumably have on your home directory is a good option. |
* Again press ''Ctrl+P'' or ''Command+P'' and write "Connect to Host". Then, choose the appropriate connection, in this case ''node2''. | * Again press ''Ctrl+P'' or ''Command+P'' and write "Connect to Host". Then, choose the appropriate connection, in this case ''node2''. |