SlurmGen - Simple Slurm Manager


Keywords
Python, Slurm, HPC, Cluster
License
BSD-2-Clause
Install
pip install slurmgen==3.9.0

Documentation

SlurmGen - Simple Slurm Manager

Summary

SlurmGen is a very simple Slurm manager:

  • The job description is stored in JSON files.
  • The JSON files are transformed into Slurm scripts.
  • The Slurm script can be run locally or on a Slurm Cluster.

SlurmGen is only supporting a small subset of Slurm:

  • Create and delete folders.
  • Set environment variables.
  • Set the job name and log.
  • Set the ressources (memory, time, CPU, etc.).
  • Define the set of commands to be executed.

SlurmGen is not a binding and/or a wrapper for Slurm. SlurmGen is only generating Slurm scripts from JSON files. SlurmGen is written in Python without any external dependencies.

Example

An example is located in the example folder of the repository:

  • job_def.json contains the job definition
  • job_tmpl.json contains the template data
  • run_slurm.py contains is dummy script executed by the Slurm job
  • slurm_output contains the generated Slurm script and log file
  • data_output contains data generated by the Slurm job
# Create a Slurm script with a command line template.
sgen job_def.json --tmpl_str "title" "test" --tmpl_str "var" "Welcome to everyone"

# Create a Slurm script with a JSON file template.
sgen job_def.json --tmpl_file job_tmpl.json

# Create a Slurm script and run the job locally.
sgen job_def.json --local --tmpl_file job_tmpl.json

# Create a Slurm script and run the job on the cluster.
sgen job_def.json --cluster --tmpl_file job_tmpl.json

Project Links

Author

Copyright

(c) 2023 - Thomas Guillod

BSD 2-Clause "Simplified" License