Jupyter via VSCode remote-ssh with singularity on ifarm

From epsciwiki
Revision as of 13:18, 17 June 2023 by Davidl (talk | contribs)
Jump to navigation Jump to search


Here are instructions for configuring your local VSCode to connect to

 #-------------------------------------------------------
 # This comes from the JLab knowledge base article here:
 # https://jlab.servicenowservices.com/kb?id=kb_article_view&sysparm_article=KB0014918&sys_kb_id=862c54221bf0d510a552ed3ce54bcb1a&spa=1 
 #
 Host ifarm ifarm???? qcdi qcdi????
 Hostname %h.jlab.org.
 Host *.jlab.org
 Hostname %h.
 Match host scilogin.jlab.org.,scilogin?.jlab.org.,login.jlab.org.,login?.jlab.org.,acclogin.jlab.org.,acclogin?.jlab.org.,hallgw.jlab.org.,hallgw?.jlab.org.
 ProxyJump none
 Match host *.jlab.org.
 ProxyJump scilogin.jlab.org.
 User davidl
 
 Match host *.jlab.org.
 ControlMaster auto
 ControlPath ~/.ssh/cm/%C.sock
 ControlPersist 10m
 #-------------------------------------------------------


In VSCode

  1. Open the command palette using Cmd+shift+P or from the gear menu in the bottom left of the window
  2. Type "settings.json" and then select Preferences: Open User Settings (JSON)
  3. Add the following to your settings (if you have other settings already, you may need to add a comma to the line before this one!):
 "remote.SSH.enableRemoteCommand": true


 # https://github.com/microsoft/vscode-remote-release/issues/3066#issuecomment-1019500216
 #
 Host epsci-ubuntu-22.04~ifarm
   HostName ifarm.jlab.org
   ProxyJump scilogin.jlab.org
   RemoteCommand singularity shell /cvmfs/oasis.opensciencegrid.org/jlab/epsci/singularity/images/epsci-ubuntu-22.04.img
   RequestTTY yes

Test by logging in from command line first with the following. Note that you will need to enter your 2-factor PIN+OTP when prompted:

 ssh epsci-ubuntu-22.04~ifarm

Click on the "Remote Explorer" extension icon on the left side of the window (monitor with a circle in lower left) to open. You should see the "epsci-ubuntu-22.04~ifarm" item. Hover over it to see options to either connect the current window (arrow) or open a new window (box). Choose whichever you want to get a connected window. It will automatically install some extensions on the remote host under ~/.vscode-server.