Skip to main content

SLURM Helper Utils

Collection of Python scripts for SLURM related tasks.

The following exported scripts are available: - create-slurm-script - validate-slurm-script

These scripts expect that the configuration files are present in the current working directory. Recommended steps: 1. Create a directory conf e.g.: mkdir conf. 2. Copy the config.yaml from your virtual environment into that directory e.g.: cp venv/lib/python3.10/site-packages/slurm_helper_utils/conf/config*.yaml conf/.. 3. Edit the configuration files per your needs.

The following build configuration file content will provide the qualified options that the user will interactively select.

cat -n conf/config_builder.yaml
     1  ---
     2  required_directives:
     3    job-name:
     4      max_length: 20
     5      min_length: 5
     6    nodes:
     7      qualified_options:
     8        - 1
     9        - 2
    10        - 3
    11        - 4
    12    qos:
    13      qualified_options:
    14        - qos-A
    15        - qos-B
    16    gres:
    17      qualified_options:
    18        - gres-1
    19        - gres-2
    20    export:
    21      qualified_options:
    22        - NONE
    23    propagate:
    24      qualified_options:
    25        - ALL
    26        - NONE
    27        - AS
    28        - CORE
    29        - CPU
    30        - DATA
    31        - FSIZE
    32        - MEMLOCK
    33        - NOFILE
    34        - NPROC
    35        - RSS
    36        - STACK
    37    mail-user:
    38      qualified_options:
    39        - jay@gmail.com
    40        - sun@gmail.com
    41    mail-type:
    42      qualified_options:
    43        - NONE
    44        - BEGIN
    45        - END
    46        - FAIL
    47        - REQUEUE
    48        - ALL
    49        - INVALID_DEPEND
    50        - STAGE_OUT
    51        - TIME_LIMIT
    52        - TIME_LIMIT_90
    53        - TIME_LIMIT_80
    54        - TIME_LIMIT_50
    55        - ARRAY_TASKS
    56    output:
    57      desc: The STDOUT from the SLURM sbatch script
    58    error:
    59      desc: The STDERR from the SLURM sbatch script
    60    partition:
    61      qualified_options:
    62        - partition-1
    63        - partition-22
    64    ntasks-per-node:
    65      desc: TBD
    66    cpus-per-task:
    67      desc: TBD
    68    time:
    69      desc: TBD

Invoke the exported console script that will allow user to interactively create a SLURM sbatch script:

create-slurm-script --config_file conf/config_builder.yaml
--outdir was not specified and therefore was set to '/tmp/sundaram/slurm-helper-utils/create_slurm_script/2025-02-15-152404'
Created output directory '/tmp/sundaram/slurm-helper-utils/create_slurm_script/2025-02-15-152404'
--logfile was not specified and therefore was set to '/tmp/sundaram/slurm-helper-utils/create_slurm_script/2025-02-15-152404/create_slurm_script.log'
--outfile was not specified and therefore was set to '/tmp/sundaram/slurm-helper-utils/create_slurm_script/2025-02-15-152404/slurm_sbatch.sh'
There are '14' required directives
Please enter the option for directive 'nodes':
options: ['1', '2', '3', '4']
Enter nodes: 2
Please enter the option for directive 'qos':
options: ['qos-A', 'qos-B']
Enter qos: qos-A
Please enter the option for directive 'gres':
options: ['gres-1', 'gres-2']
Enter gres: gres-1
Please enter the option for directive 'export':
options: ['NONE']
Enter export: NONE
Please enter the option for directive 'propagate':
options: ['ALL', 'NONE', 'AS', 'CORE', 'CPU', 'DATA', 'FSIZE', 'MEMLOCK', 'NOFILE', 'NPROC', 'RSS', 'STACK']
Enter propagate: ALL
Please enter the option for directive 'mail-user':
options: ['jay@gmail.com', 'sun@gmail.com']
Enter mail-user: jay@gmail.com
Please enter the option for directive 'mail-type':
options: ['NONE', 'BEGIN', 'END', 'FAIL', 'REQUEUE', 'ALL', 'INVALID_DEPEND', 'STAGE_OUT', 'TIME_LIMIT', 'TIME_LIMIT_90', 'TIME_LIMIT_80', 'TIME_LIMIT_50', 'ARRAY_TASKS']
Enter mail-type: ALL
Please enter the option for directive 'partition':
options: ['partition-1', 'partition-22']
Enter partition: partition-22
Wrote SLURM sbatch script '/tmp/sundaram/slurm-helper-utils/create_slurm_script/2025-02-15-152404/slurm_sbatch.sh'

Contents of the generated SLURM sbatch script:

cat -n /tmp/sundaram/slurm-helper-utils/create_slurm_script/2025-02-15-152404/slurm_sbatch.sh
     1  #!/bin/bash
     2
     3  ## method-created: /tmp/test-slurm-helper-utils/venv/lib/python3.10/site-packages/slurm_helper_utils/create_slurm_script.py
     4  ## date-created: 2025-02-15-152508
     5  ## created-by: sundaram
     6  ## config-file: conf/config_builder.yaml
     7  ## logfile: /tmp/sundaram/slurm-helper-utils/create_slurm_script/2025-02-15-152404/create_slurm_script.log
     8
     9
    10  #SBATCH --nodes=2
    11  #SBATCH --qos=qos-A
    12  #SBATCH --gres=gres-1
    13  #SBATCH --export=NONE
    14  #SBATCH --propagate=ALL
    15  #SBATCH --mail-user=jay@gmail.com
    16  #SBATCH --mail-type=ALL
    17  #SBATCH --partition=partition-22

History

0.1.0 (2024-01-09)

  • First release on PyPI.

Download files

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

Source Distribution

slurm_helper_utils-0.2.1.tar.gz (33.6 kB view details)

Uploaded Source

Built Distribution

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

slurm_helper_utils-0.2.1-py2.py3-none-any.whl (29.0 kB view details)

Uploaded Python 2Python 3

File details

Details for the file slurm_helper_utils-0.2.1.tar.gz.

File metadata

  • Download URL: slurm_helper_utils-0.2.1.tar.gz
  • Upload date:
  • Size: 33.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for slurm_helper_utils-0.2.1.tar.gz
Algorithm Hash digest
SHA256 8c410afb0e64ef0b2135f38902fdd49d858900ea2f860b903d9a86fd87837aaf
MD5 801b8eaf64da4747f7f945c5ca2543fb
BLAKE2b-256 c1da1ed80efbf2fd09dd8605e39d4bf64ae05f0525c348d1e09664b175bddb80

See more details on using hashes here.

File details

Details for the file slurm_helper_utils-0.2.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for slurm_helper_utils-0.2.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 b0acbc714d7976300c3d25c59c3cc29218247872d219abe411cc1bf50b157249
MD5 822d297426c0d32c51b9fe2981ccafda
BLAKE2b-256 80fe341c4a02f2e0cd37c35f1ce11ab8ca2c634280b16adb9dcfc634a82d79c9

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 files

0.2.0

2 files

0.1.0

2 files

Supported by

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