Skip to content

Commit fa0e1d0

Browse files
committed
slurm: Support reusage of mail_type and mail_user information from previous job
1 parent 53b91fa commit fa0e1d0

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

varipeps/utils/slurm.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,8 @@ def generate_restart_scripts(
151151
#SBATCH --cpus-per-task={ncpus:d}
152152
#SBATCH --mem={mem}
153153
#SBATCH --time={time_limit}
154-
#SBATCH --mail-type=FAIL,END
154+
{mail_type}
155+
{mail_user}
155156
156157
"{executable}" "{python_script}" "{state_file}"
157158
"""
@@ -189,6 +190,16 @@ def generate_restart_scripts(
189190
else:
190191
time_limit_str = f"{time_limit_hours:02d}:{time_limit_minutes:02d}:{time_limit_seconds:02d}"
191192

193+
if (mail_type := slurm_data.get("MailType")) is not None:
194+
mail_type = f"#SBATCH --mail-type={mail_type}"
195+
else:
196+
mail_type = ""
197+
198+
if (mail_user := slurm_data.get("MailUser")) is not None:
199+
mail_user = f"#SBATCH --mail-user={mail_user}"
200+
else:
201+
mail_user = ""
202+
192203
slurm_file_content = TEMPLATE_SLURM.format(
193204
partition=slurm_data["Partition"],
194205
qos=slurm_data["QOS"],
@@ -198,6 +209,8 @@ def generate_restart_scripts(
198209
ncpus=slurm_data["CPUs/Task"],
199210
mem=mem,
200211
time_limit=time_limit_str,
212+
mail_type=mail_type,
213+
mail_user=mail_user,
201214
executable=str(executable),
202215
python_script=str(python_script_path),
203216
state_file=restart_state_file,

0 commit comments

Comments
 (0)