slurm submission limited to array < 800

This commit is contained in:
Mayeul Aubin 2025-04-16 20:54:21 +02:00
parent 438f3f024e
commit 748ebdd398
2 changed files with 13 additions and 8 deletions

View file

@ -2,6 +2,7 @@ from argparse import ArgumentParser
from args_main import parse_arguments_main
path_to_monofonic_binary = "/home/aubin/monofonic/build/monofonIC"
limit_slurm_arrays=799
def register_arguments_slurm(parser:ArgumentParser):
"""
@ -133,12 +134,16 @@ def create_slurm_script(slurm_template:str,
- simbelmyne
- scola
"""
index_sub=0
if array is not None and job != "scola":
raise ValueError(f"Array job range provided for job type {job}.")
if array is None and job == "scola":
raise ValueError(f"Array job range not provided for job type {job}.")
else:
index_sub=array[0]//limit_slurm_arrays
array=(array[0]%limit_slurm_arrays, array[1]%limit_slurm_arrays)
from os.path import isfile
if not isfile(slurm_template):
raise FileNotFoundError(f"SLURM template {slurm_template} does not exist.")
@ -155,7 +160,7 @@ def create_slurm_script(slurm_template:str,
case "simbelmyne":
command_line = f"{job} {job_config_file} {job_log}"
case "scola":
command_line = f"{job} {job_config_file} {job_log} "+"-b ${SLURM_ARRAY_TASK_ID}"
command_line = f"{job} {job_config_file} {job_log} "+f"-b $(({index_sub*limit_slurm_arrays} + $SLURM_ARRAY_TASK_ID))"
case _:
raise ValueError(f"Job type {job} not recognized.")
@ -163,7 +168,7 @@ def create_slurm_script(slurm_template:str,
with open(slurm_script, "w") as f:
for line in template:
if job_name is not None and "--job-name" in line:
line = f"#SBATCH --job-name={job_name}\n"
line = f"#SBATCH --job-name={index_sub if index_sub!=0 else ''}{job_name}\n"
if array is not None and "--array" in line:
line = f"#SBATCH --array={array[0]}-{array[1]}\n"
if array is not None and ("--output" in line or "--error" in line):