Slurm Connect (VS Code extension)
This extension helps users allocate Slurm resources on a cluster and connect VS Code Remote-SSH through a compute node. It discovers partitions (and optionally QoS/accounts), builds the RemoteCommand for a proxy script, creates a temporary SSH host entry, and optionally connects right away.
Requirements
- VS Code with Remote - SSH installed.
- SSH keys configured for the cluster (agent forwarding recommended).
- Python 3.9+ available on the login nodes.
vscode-shell-proxy.py available on the login nodes (via module load or PATH).
- ssh-agent running with your key added (recommended for encrypted keys).
Quick start (users)
- Install the extension.
- Open the Slurm Connect view from the activity bar.
- Enter login host, username, and identity file.
- Click Get cluster info, choose resources, then Connect.
The extension will query the login host, create a temporary SSH config entry, connect, and then restore your previous Remote-SSH config setting. Your main SSH config is not modified.
Usage details
Get cluster info
The Get cluster info button queries your login host to discover available Slurm partitions and their limits
(nodes, CPUs, memory, GPUs). It also tries to read the available modules list. The results are used to populate
the dropdowns and suggestions in the UI so you can pick valid values quickly. You can still type values manually,
and the fetched data is cached per login host to speed up the next load.
Profiles
Profiles let you save and switch between sets of Slurm Connect inputs (login host, identity file, partitions,
resource defaults, module selections, etc.). Use Save profile to store the current form values, Load to
apply a saved profile, and Delete to remove one you no longer need. Profiles are stored in the extension
state and do not change your VS Code settings.
SSH authentication for cluster info
Cluster info queries use non-interactive SSH (BatchMode=yes). If your key is encrypted, you can either use ssh-agent or enter the passphrase in a terminal when prompted.
What is ssh-agent?
ssh-agent is a background service that securely stores your SSH keys in memory after you unlock them once.
It avoids repeated passphrase prompts and enables non-interactive SSH commands (like cluster info queries).
It is especially useful when the extension runs multiple SSH calls (connect + resource discovery).
If the key is not in your agent, the extension will prompt you to either enter a passphrase in the terminal or add it.
When you choose to add it, the extension opens a terminal, runs ssh-add, and waits for the key to appear in your agent.
If the SSH agent is unavailable, you will be prompted to enter your passphrase in a terminal for cluster info and connect.
If you prefer to do this manually:
ssh-add /path/to/your/key
ssh-add -l
Windows note:
- If you do not have an ssh-agent available, you can enable the OpenSSH Authentication Agent service (requires admin).
- Instructions:
https://learn.microsoft.com/en-us/windows-server/administration/openssh/openssh_keymanagement#user-key-generation
- Otherwise you will be prompted for your passphrase when getting cluster info or connecting.
Proxy command (cluster-specific)
This extension expects a proxy script on your cluster's login nodes. The default is:
python /usr/bin/vscode-shell-proxy.py
Remote-SSH needs the proxy to attach to the compute allocation. If your cluster uses a different path or script name, update slurmConnect.proxyCommand accordingly.
If you're installing/using this on a different cluster, make sure the proxy script is accessible and the login nodes have Python 3.9+:
https://github.com/xangma/vscode-shell-proxy/blob/main/vscode-shell-proxy.py
The "slurmConnect.proxyCommand" setting must execute it, e.g.:
"slurmConnect.proxyCommand": "python /usr/bin/vscode-shell-proxy.py"
Remote folder (recommended)
If you forget to set a remote folder, VS Code may reconnect and create a new Slurm job when you later open a folder. To avoid that, you should set a remote folder up front in the side panel, set Remote folder (recommended).
Notes
- Ensure Remote.SSH: Enable Remote Command is enabled (the extension will prompt to enable it).
- Remote.SSH: Lockfiles In Tmp is recommended on shared filesystems (the extension will prompt to enable it).
- The extension will also prompt to put
"remote.SSH.useLocalServer": true in your vscode settings file if you're on Windows due to a bug with the Remote-SSH extension not respecting the default value from the GUI.
- This extension uses a temporary SSH config for each connection and does not modify your main SSH config.
- Use
slurmConnect.openInNewWindow to control whether the connection opens in a new window (default: false).
slurmConnect.partitionInfoCommand controls how cluster info is fetched (default: sinfo -h -N -o "%P|%n|%c|%m|%G").
- To add GPUs or other flags, use
slurmConnect.extraSallocArgs (e.g. ["--gres=gpu:1"]).
Issues
Please report bugs and feature requests on the GitHub repository:
https://github.com/xangma/slurm-connect
Development
- Install dependencies:
npm install
- Build the extension:
npm run compile
- Press F5 to launch the Extension Development Host.