Skip to main content

Python-based PBS job submission

Project description

PyBS

Installation

1. Install pybs

pip install pythonpbs

2. SSH Configuration

You will need to add the following to your ~/.ssh/config file:

# the host details of your login node:
Host YOUR_LOGIN_SERVER_ALIAS
  Hostname YOUR_LOGIN_SERVER_HOSTNAME
  User YOUR_USERNAME

For better ssh performance, you can optionally add the following:

Host *
	ControlMaster auto
	ControlPath ~/.ssh/controlmasters/%r@%h:%p
	ControlPersist yes

Then, create directory:

mkdir -p ~/.ssh/controlmasters

To prevent disconnecting from timeouts, you can also add:

# Send keepalive packets to prevent SSH disconnecting...
Host *
  ServerAliveInterval 60

3. VS code setup

To use the code command, you will need to have VS code added to your $PATH.

Using command palette

In VS code, open the command palette (Cmd+Shift+P), type "shell command", and run the Shell Command: Install 'code' command in PATH command.

Manually configure the path
Zsh
cat << EOF >> ~/.zprofile
# Add Visual Studio Code (code)
export PATH="\$PATH:/Applications/Visual Studio Code.app/Contents/Resources/app/bin"
EOF
Bash
cat << EOF >> ~/.bash_profile
# Add Visual Studio Code (code)
export PATH="\$PATH:/Applications/Visual Studio Code.app/Contents/Resources/app/bin"
EOF

Restart your shell to register your changes. You can check with which code.

4. Enable tab completions

You can enable CLI tab completion for Bash, Fish, or Zsh.

After modifying .rc files for your shell, you may have to restart the shell to enable completions.

Zsh
_PYBS_COMPLETE=zsh_source pybs > ~/.zsh/pybs-complete.zsh

NOTE: you may have to add source to your ~/.zshrc if this does not work.

Oh My Zsh
mkdir $ZSH_CUSTOM/plugins/pybs
pybs completions zsh > $ZSH_CUSTOM/plugins/pybs/_pybs

You must then add pybs to your plugins array in ~/.zshrc:

plugins(
	pybs
	...
)
Bash
_PYBS_COMPLETE=bash_source pybs > ~/.pybs-complete.bash

Add the following to your ~/.bashrc:

. ~/.pybs-complete.bash

Fish

_PYBS_COMPLETE=fish_source pybs > ~/.config/fish/completions/pybs.fish

5. Create job script

To use the code command to launch a VS code instance on a compute node, you will need to create a PBS-compatible job script with a sleep infinity command or similar to prevent early exiting of the job script.

Example job script
#! /usr/bin/env bash

#PBS -I 
#PBS -l select=1:ncpus=6:ngpus=1:mem=46gb
#PBS -l walltime=4:00:00
#PBS -M YOUR_EMAIL_ADDRESS
#PBS -m ae
#PBS -j oe

sleep infinity

Then, you can run code as follows:

pybs code YOUR_SERVER_NAME '$HOME/path/to/notebook.ipynb' path/to/job_script.pbs 

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pythonpbs-0.1.5.tar.gz (17.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pythonpbs-0.1.5-py3-none-any.whl (21.0 kB view details)

Uploaded Python 3

File details

Details for the file pythonpbs-0.1.5.tar.gz.

File metadata

  • Download URL: pythonpbs-0.1.5.tar.gz
  • Upload date:
  • Size: 17.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.13.2 Darwin/24.4.0

File hashes

Hashes for pythonpbs-0.1.5.tar.gz
Algorithm Hash digest
SHA256 f74cc3f8131835cf1298946146001d6de27f0eb09e11b6de687a25e429c6f6e2
MD5 269769ee4b5daffdc2e61c97ba27b50f
BLAKE2b-256 a6efb951bfc0e671e46c614810c305f54d22c9fe736b20904c56440b7223ad21

See more details on using hashes here.

File details

Details for the file pythonpbs-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: pythonpbs-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 21.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.13.2 Darwin/24.4.0

File hashes

Hashes for pythonpbs-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 c3ae7380b9cc0b14dec72f60e3a298683f4c4c463c32a2bcc80fcf935d674114
MD5 72061c7318d2a3635cee9e4ab836cbec
BLAKE2b-256 248611ab38415affbd2e9a941c82bfdf35049b59cf2a91779368535eb2a1bda9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page