slurm_script_generator.templates#

Built-in SLURM script templates for common job shapes.

Each template is a starting point, not a finished script: the placeholder command(s) need to be replaced with your own, and the pragma defaults are reasonable guesses that should be adjusted to the job at hand. Used by the slurm-template CLI (see slurm_script_generator.slurm_template).

Functions

build_script(name[, overrides, commands, ...])

Build a SlurmScript from a named template.

Classes

Template(description, defaults, object] =, ...)

A named starting point for a SLURM script.

class slurm_script_generator.templates.Template(description: str, defaults: ~typing.Dict[str, object] = <factory>, commands: ~typing.List[str] = <factory>, modules: ~typing.List[str] = <factory>)[source]#

Bases: object

A named starting point for a SLURM script.

commands: List[str]#
defaults: Dict[str, object]#
description: str#
modules: List[str]#
slurm_script_generator.templates.build_script(name: str, overrides: Dict[str, object] | None = None, commands: List[str] | None = None, modules: List[str] | None = None) SlurmScript[source]#

Build a SlurmScript from a named template.

Parameters:
  • name (str) – A key in TEMPLATES.

  • overrides (dict, optional) – Pragma values to override the template defaults with. Keys with a None value are ignored, so callers can pass a full set of parsed CLI args without stripping the unset ones first.

  • commands (list of str, optional) – Replace the template’s placeholder command(s).

  • modules (list of str, optional) – Replace the template’s module list.

Return type:

SlurmScript

Raises:

KeyError – If name is not a known template.