mlrl.testbed_slurm.runner module

Author: Michael Rapp (michael.rapp.ml@gmail.com)

Provides classes that allow to run experiments via the Slurm Workload Manager.

class mlrl.testbed_slurm.runner.JobArray(command: ~mlrl.testbed.command.Command, command_modifier: ~typing.Callable[[~mlrl.testbed.command.Command], ~mlrl.testbed.command.Command], file_name_modifier: ~typing.Callable[[str], str], task_ids: set[int] = <factory>)

Bases: object

Defines a Slurm job array.

Attributes:

command: The command to be executed command_modifier: A function that modifies a given command such that it can be used in the job array file_name_modifier: A function that modifies a given file name such that it can be used in the job array task_ids: The task ids to be used in the job array

command: Command
command_modifier: Callable[[Command], Command]
file_name_modifier: Callable[[str], str]
property formatted_task_ids: str | None

The task ids to be used in the job array formatted such that they can be used as the value or the sbatch argument “–array”.

property modified_command: Command

The command to be executed, modified such that it can be used in the job array.

task_ids: set[int]
class mlrl.testbed_slurm.runner.SlurmRunner

Bases: Runner

A BatchMode.Runner that allows to run experiments via the Slurm Workload manager.

class ConfigFile(file_path: Path, schema_file_path: Path)

Bases: object

A YAML configuration file that configures Slurm jobs to be run.

property after_script: list[str]

The shell commands to be executed after the experiment has finished.

property before_script: list[str]

The shell commands to be executed before the experiment is started.

property sbatch_arguments: list[str]

The sbatch arguments (starting with #SBATCH) to be passed to a Slurm job.

run_batch(args: Namespace, batch: list[Command], _: Recipe)

See mlrl.testbed.modes.mode_batch.BatchMode.Runner.run_batch()