Repository navigation
Attach vscode-R to compute node and not head node #1506
Description
Activity
I'm not going to use the right lingo here, but I also have a problem related showing plots under a similar situation that you are in, but I wonder if what I'm doing in order to get VS Code to connect to a private compute node through a public head node so I can do some R work on the private server can work for you, too?
My setup was inpsired by this stackexchange post.
My Setup
I currently ssh into a head (public) node and have to hop over to a node on an internal/private compute cluster. One difference between our setups is that I don't go through something like slurm to get a compute node, but I can rather specify which compute node (by IP) to then tunnel in to from the head node.
I've setup my
~/.ssh/configfile in such a way that allows me to simply ssh into the head node, or hope in to an internal compute node easily. It looks something like this:Host head-node HostName XXX.XXX.XXX.XXX IdentityFile ~/.ssh/id_rsa User steve Host compute01 HostName <internal IP address or computer name> IdentityFile ~/.ssh/id_rsa User steve ProxyJump head-node Host compute02 HostName <internal IP address or computer name> IdentityFile ~/.ssh/id_rsa User steve ProxyJump head-nodeThe same private
~/.ssh/id_rsakey is on all three of the nodes listed above.With that setup, I can use the terminal to ssh into any of those nodes with a one liner
$ ssh head-node # connects me direct to the public/head n ode $ ssh compute01 # hops through the head node and connects me to the compute nodeIn VS Code, I can then invoke the
Remote SSH: Connect to Host...command and also connect tocompute01in the same way. The R terminal that then gets fired up within VS Code is running on thecompute01server.Your Use Case
It's more of a PITA for you, since you need to modify your
~/.ssh/configfile each time to update with the IP of the new compute node you've been assigned, but if you can manually ssh into the compute node you've been provisioned from the head node, perhaps this can also work for you?Hi lianos,
I appreciate the suggestion. I have attempted something similar before but was quick to find out that connecting directly to compute nodes was generally not possible and otherwise heavily discouraged as it bypassed the slurm resource allocation step. I have since spoken to the people operating the server, and was told that increasing capacity would be their preferred solution. For future people having a similar problem, I have also encountered this stack overflow thread which may prove helpful for someone else
Reacted by Steve Lianoglou
One issue I often run in to is wanting to attach vscode-R to the compute node I am currently working on. The setup is that I first have to SSH onto the head node before using
srunto move onto a compute node. The problem, however, is that when I open R whilst on the compute node, vscode-R does not attach to the R session. Instead, if I manually try to attach vscode-R, it opens a new R session that is connected to the head node and successfully attaches to that session. Would it be possible to create some solution for this? I am currently unaware if there is one, as it seems to be conditioned on which SSH host one is connected to.Any solution in any capacity - additional custom scripting, a simple button to press or function to run - would be greatly appreciated. I am currently relegated to using a different SSH host to work with vscode-R on our HPC system, which may run at capacity soon