dragonfruit.slurm.sbatch module

dragonfruit.slurm.sbatch.create_command(sbatch_args: Optional[str] = None, depend_self=False, after='afterany') Sequence[str]

Create a command for SLURM submission, to be used with the “submit_script” function.

Parameters
  • sbatch_args – Single string containing the SLURM options, including the flags, e.g. sbatch_args=’-N 1 -n 40 -p xeon40’

  • depend_self – Bool, add a dependency on the calling job. Requires that it is called from within a SLURM environment (otherwise, a warning is raised) Default: False

  • after – Type of dependency, only relevant is depend_self is True. Default: ‘afterany’.

dragonfruit.slurm.sbatch.dependency(job_id: int, after: str = 'afterany')

Create SLURM dependency string.

Parameters
  • job_id – SLURM id of the job to depend on

  • after – Type of dependency. Default: ‘afterany’

dragonfruit.slurm.sbatch.py_to_sh(filename: Union[str, pathlib.Path], script_args: Optional[Sequence[str]] = None) str

Convert a python file into a shell file for a SLURM submission. The same python file will be used for a python execution. Will add the prolog to the shell script. Returns the script as a string.

Parameters
  • filename – Filename of the python file. Should end in “.py”

  • script_args – List of arguments to be passed along with the python file, in a “python <filename> <arg_1> <arg_2> … <arg_N>” format.

dragonfruit.slurm.sbatch.self_dependency(after: str = 'afterany')

Create SLURM dependency string on the job itself. Requires that it is called from within a SLURM environment

Parameters

after – Type of dependency. Default: ‘afterany’

dragonfruit.slurm.sbatch.submit_script(script: str, command: Sequence[str])

Submit submit script using a specified command.