Skip to main content

Python Slurm script interface

Project description

slurm_script Python Slurm command generator

This package is designed to generate slurm script to submit mpi jobs to a cluster.

Installation

You can install the package using pip.

python -m pip install slurm_script

Usage

$ sjob --h
slurm_script version: 0.1.7
usage: slurm_script/sjob [-h] [-n NPROC] [-j JOB_NAME] [-t TIME] [-m MEM_PER_CPU] [-c COMMAND [COMMAND ...]] [-mail MAIL_TYPE]
                         [-nt NTASKS] [-cnt CPUS_PER_TASK] [-a ADDITIONAL_CMD [ADDITIONAL_CMD ...]]

python interface to generate and run slurm command.

options:
  -h, --help            show this help message and exit
  -n NPROC, --nproc NPROC
                        Number of processors to run the job.
  -j JOB_NAME, --job_name JOB_NAME
                        Name of the job.
  -t TIME, --time TIME  Maximum runtime [hours:minutes:second].
  -m MEM_PER_CPU, --mem_per_cpu MEM_PER_CPU
                        Memory per core [MB].
  -c COMMAND [COMMAND ...], --command COMMAND [COMMAND ...]
                        Program command.
  -mail MAIL_TYPE, --mail_type MAIL_TYPE
                        Email notification at either BEGIN, END, or FAIL.
  -nt NTASKS, --ntasks NTASKS
                        Number of tasks.
  -cnt CPUS_PER_TASK, --cpus_per_task CPUS_PER_TASK
                        Number of cpus per task.
  -a ADDITIONAL_CMD [ADDITIONAL_CMD ...], --additional_cmd ADDITIONAL_CMD [ADDITIONAL_CMD ...]
                        Additional commands.

Note

It seems like due to a security reason, it is not possible to use sjob command directly from the cluster. Therefore, you can use the following command instead

python -m slurm_script --h

Example

$ sjob -n 10 -j test_run -t 10:00:00 -m 1024 -mail BEGIN,END,FAIL -nt 1 -cnt 10 -a module add python -c python test.py
slurm_script version: 0.1.6

Preview of the generated script:
--------------------------------
#!/bin/bash

#SBATCH -n 10
#SBATCH --job-name=test_run
#SBATCH --time=10:00:00
#SBATCH --mem-per-cpu=1024
#SBATCH --mail-type=BEGIN,END,FAIL
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=10

module add python

mpirun python test.py
--------------------------------
Do you want to run the script? [y/n] 

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

slurm-script-0.1.8.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

slurm_script-0.1.8-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file slurm-script-0.1.8.tar.gz.

File metadata

  • Download URL: slurm-script-0.1.8.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.1 CPython/3.10.10 Darwin/22.3.0

File hashes

Hashes for slurm-script-0.1.8.tar.gz
Algorithm Hash digest
SHA256 db804a57cbc0c7e312f4c0a693edb2989a463ac729d8c24617dc6e90660dc9ad
MD5 1163fb5ed219234b54c3463317198a68
BLAKE2b-256 283a5b345092d4b13506319f138e732b903cb596a34e33828dfb957a7ba2a2d2

See more details on using hashes here.

File details

Details for the file slurm_script-0.1.8-py3-none-any.whl.

File metadata

  • Download URL: slurm_script-0.1.8-py3-none-any.whl
  • Upload date:
  • Size: 3.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.1 CPython/3.10.10 Darwin/22.3.0

File hashes

Hashes for slurm_script-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 441fc2444d21a402b8937d70c87cd80b30d001a1eb550e2960a6b6ce7dd744e9
MD5 342768d3ab195dee6ccf4ab5ef5144d6
BLAKE2b-256 8d013f53d43e2fb2646fb8d6eac5f018a8ce44b77d65444d7c12a21cbe202975

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