Skip to main content

Slurm job submission in Python

Project description

This package provides a thin Python layer on top of the Slurm workload manager for submitting Slurm batch scripts into a Slurm queue. Its core features are:

  • Python classes representing a Slurm batch script,

  • simple file transfer mechanism between shared file system and node,

  • macro support based Python’s format specification mini-language,

  • JSON-encoding and decoding of Slurm batch scripts,

  • new submission command ssub,

  • successive submission of Slurm batch scripts, and

  • rescue of failed jobs.

The example shows how to submit a JSON-encoded Slurm batch script into a Slurm queue via ssub:

ssub submit --in pyssub_example.json --out pyssub_example.out

The JSON-encoded Slurm batch script pyssub_example.json has the following content:

{
   "pyssub_example": {
      "executable": "echo",
      "arguments": "'Hello World!'"
   }
}

A more detailed introduction is given in the Getting started guide.

Note that I have written this package because I was working with a small Slurm cluster during my PhD. This cluster was configured in a way that the easiest approach was to submit multiple single-task Slurm batch scripts instead of a single multi-task Slurm batch script containing multiple srun commands. The package reflects this approach and therefore does not have to be the best solution for your cluster.

Installation

This package is pure Python 3 package (it requires at least Python 3.6) and does not depend on any third-party package. All releases are uploaded to PyPI and the newest release can be installed via

pip install pyssub

I would recommend to create a dedicated virtual Python 3 environment for the installation (e.g. via virtualenvwrapper):

source /usr/share/virtualenvwrapper/virtualenvwrapper.sh
mkvirtualenv -p /usr/bin/python3.6 -i pyssub py3-slurm

If you prefer to work with the newest revision, you can also install the package directly from GitHub:

pip install 'git+https://github.com/kkrings/pyssub#egg=pyssub'

Contributing

I welcome input from your side, either by creating issues or via pull reqests. For the latter, please make sure that all unit tests pass. The unit tests can be executed via

python setup.py test

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

pyssub-0.1-py3-none-any.whl (21.3 kB view details)

Uploaded Python 3

File details

Details for the file pyssub-0.1-py3-none-any.whl.

File metadata

  • Download URL: pyssub-0.1-py3-none-any.whl
  • Upload date:
  • Size: 21.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.6.8

File hashes

Hashes for pyssub-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5b64cb8a459784c0d7e47ff4344148458d61c8df8d5a9b6081f9af0a447ab0cf
MD5 0b287fe36c218ce1230fe8422c6963b7
BLAKE2b-256 e86b75457d9e5b4c0b2c5faf1352445f0574da3bb50913658e239e28523e69f4

See more details on using hashes here.

Supported by

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