Skip to content

Commit

Permalink
Fix array job handling in Slurm
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanluoyc committed Feb 8, 2024
1 parent 9a030ff commit 67afd54
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lxm3/xm_cluster/execution/slurm.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ def _create_job_header(
job_log_dir: str,
job_name: str,
) -> str:
num_array_tasks = None
job_header = header_from_executor(
job_name, executor, num_array_tasks, job_log_dir
)
Expand Down Expand Up @@ -129,9 +128,10 @@ def launch(self, job_name: str, job: job_script_builder.ClusterJob):
num_jobs = len(job.env_vars)
else:
num_jobs = 1

console.log(f"Launching {num_jobs} job on {self._settings.hostname}")
job_id = self._cluster.launch(job_script_path)
console.log(f"Successfully launched job {job_id}")

if num_jobs > 1:
job_ids = [f"{job_id}_{i}" for i in range(num_jobs)]
else:
Expand Down Expand Up @@ -215,9 +215,9 @@ def header_from_executor(

log_directory = executor.log_directory or job_log_dir
if num_array_tasks is not None:
stdout = os.path.join(log_directory, "slurm-%A_%a.out")
stdout = os.path.join(log_directory, "%x-%A_%a.out")
else:
stdout = os.path.join(log_directory, "slurm-%j.out")
stdout = os.path.join(log_directory, "%x-%j.out")

header.append(f"#SBATCH --output={stdout}")

Expand Down

0 comments on commit 67afd54

Please sign in to comment.