coexist.schedulers.SlurmScheduler#
- class coexist.schedulers.SlurmScheduler(time, qos=None, mail_type='FAIL', ntasks='1', mem=None, commands='set -e\n', interpreter='python', script='access_slurm_submission.sh', **kwargs)[source]#
Bases:
SchedulerLaunch simulations on a SLURM distributed cluster using
sbatch.First a bash script must be defined for launching each simulation job; this class generates this script, but some details must be defined by you; they are specified as class parameters, see examples below.
- Parameters:
- time
str The time allocated for a single simulation, given as a string, e.g. “1:0:0”. Will be added as “#SBATCH –time 1:0:0”.
- qos
str, optional The “#SBATCH –qos bbdefault”
sbatchcommand.- mail_type
str,default“FAIL” The “#SBATCH –mail-type FAIL”
sbatchcommand.- ntasks
str,default“1” The “#SBATCH –ntasks 1”
sbatchcommand.- mem
str, optional The “#SBATCH –mem 4G”
sbatchcommand.- commands
strorlist[str],default“moduleloadPython” Any other non-SLURM commands to run in the job submission script before executing the simulation; this is normally the setup work, e.g. loading necessary modules, environments, etc.
- interpreter
str,defaultos.path.split(sys.executable)[1] Name of the Python interpreter which will be used to execute the simulation script; this is normally set to the name of the executable used to run ACCES, e.g. “usr/bin/python3” -> “python3”.
- **kwargs
otherkeywordarguments Other “#SBATCH” commands to include at the top of the job submission script; e.g.
constraint = "cascadelake"is transformed into"#SBATCH --constraint cascadelake";mem_per_cpu = "4"is transformed into"#SBATCH --mem-per-cpu 4".
- time
Examples
>>> from coexist.schedulers import SlurmScheduler >>> scheduler = SlurmScheduler( >>> "10:0:0", # Time allocated for a single simulation >>> commands = """ >>> # Commands to add in the sbatch script after `#` >>> set -e >>> module purge; module load bluebear >>> module load BEAR-Python-DataScience >>> """, >>> qos = "bbdefault", >>> constraint = "cascadelake", # Any other #SBATCH --<CMD> = "VAL" >>> )
- __init__(time, qos=None, mail_type='FAIL', ntasks='1', mem=None, commands='set -e\n', interpreter='python', script='access_slurm_submission.sh', **kwargs)[source]#
Methods
__init__(time[, qos, mail_type, ntasks, ...])generate(scriptpath)schedule(dirpath, index)