11# PyBS
22
3-
43## Installation
54
5+ #### 1. Install ` pybs `
66` pip install pythonpbs `
77
8- ## SSH Configuration
8+ #### 2. SSH Configuration
99
10- OpenSSH
10+ You will need to add the following to your ` ~/.ssh/config ` file:
1111
12+ ```
13+ # the host details of your login node:
14+ Host YOUR_LOGIN_SERVER_ALIAS
15+ Hostname YOUR_LOGIN_SERVER_HOSTNAME
16+ User YOUR_USERNAME
17+ ```
18+
19+
20+ For better ssh performance, you can optionally add the following:
1221```
1322Host *
1423 ControlMaster auto
1524 ControlPath ~/.ssh/controlmasters/%r@%h:%p
1625 ControlPersist yes
1726
1827```
19- Create directory
28+ Then, create directory:
2029``` bash
2130mkdir -p ~ /.ssh/controlmasters
2231```
32+ To prevent disconnecting from timeouts, you can also add:
33+ ```
34+ # Send keepalive packets to prevent SSH disconnecting...
35+ Host *
36+ ServerAliveInterval 60
37+ ```
38+
2339
24- ## VScode
40+ #### 3. VS code setup
2541
26- To use the ` launch ` command, you will need to have ` VS code ` added to your ` $PATH ` .
27- #### Using command palette
42+ To use the ` code ` command, you will need to have ` VS code ` added to your ` $PATH ` .
43+ ##### Using command palette
2844
2945In VS code, open the ** command palette** (` Cmd+Shift+P ` ), type "shell command",
3046and run the ` Shell Command: Install 'code' command in PATH ` command.
31- #### Manually configure the path
47+ ##### Manually configure the path
3248
33- ##### Zsh
49+ ###### Zsh
3450
3551``` zsh
3652cat << EOF >> ~/.zprofile
3753# Add Visual Studio Code (code)
3854export PATH="\$ PATH:/Applications/Visual Studio Code.app/Contents/Resources/app/bin"
3955EOF
4056```
41- ##### Bash
57+ ###### Bash
4258``` bash
4359cat << EOF >> ~/.bash_profile
4460# Add Visual Studio Code (code)
4561export PATH="\$ PATH:/Applications/Visual Studio Code.app/Contents/Resources/app/bin"
4662EOF
4763```
4864Restart your shell to register your changes. You can check with ` which code ` .
49- ### Enable tab completion for Bash, Fish, or Zsh
65+
66+
67+ #### 4. Enable tab completions
68+
69+ You can enable CLI tab completion for Bash, Fish, or Zsh.
5070
5171
5272> After modifying ` .rc ` files for your shell, you may have to restart the shell to enable completions.
53- #### Zsh
73+ ##### Zsh
5474
5575``` zsh
5676_PYBS_COMPLETE=zsh_source pybs > ~ /.zsh/pybs-complete.zsh
5777```
5878> NOTE: you may have to add ` source ` to your ` ~/.zshrc ` if this does not work.
5979
6080
61- #### Oh My Zsh
81+ ##### Oh My Zsh
6282
6383``` zsh
6484mkdir $ZSH_CUSTOM /plugins/pybs
@@ -72,7 +92,7 @@ plugins(
7292 ...
7393)
7494```
75- #### Bash
95+ ##### Bash
7696``` bash
7797_PYBS_COMPLETE=bash_source pybs > ~ /.pybs-complete.bash
7898```
@@ -84,3 +104,31 @@ Add the following to your `~/.bashrc`:
84104``` fish
85105_PYBS_COMPLETE=fish_source pybs > ~/.config/fish/completions/pybs.fish
86106```
107+ #### 5. Create job script
108+
109+ To use the ` code ` command to launch a VS code instance on a compute node, you will need to create a
110+ PBS-compatible job script with a ` sleep infinity ` command or similar to prevent early exiting of the
111+ job script.
112+
113+ ##### Example job script
114+
115+ ``` bash
116+ #! /usr/bin/env bash
117+
118+ # PBS -I
119+ # PBS -l select=1:ncpus=6:ngpus=1:mem=46gb
120+ # PBS -l walltime=4:00:00
121+ # PBS -M YOUR_EMAIL_ADDRESS
122+ # PBS -m ae
123+ # PBS -j oe
124+
125+ sleep infinity
126+ ```
127+
128+
129+ Then, you can run ` code ` as follows:
130+
131+ ``` bash
132+ pybs code YOUR_SERVER_NAME ' $HOME/path/to/notebook.ipynb' path/to/job_script.pbs
133+ ```
134+
0 commit comments