Skip to content

Commit

Permalink
fix [slurm]: Put srun in the right place
Browse files Browse the repository at this point in the history
  • Loading branch information
luator committed Apr 24, 2024
1 parent 6719fad commit 97211c2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions cluster_utils/slurm_cluster_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
echo "Job id: {id}, cluster id: ${{SLURM_JOB_ID}}, hostname: $(hostname), time: $(date)"
echo
srun {cmd}
{cmd}
rc=$?
if [[ $rc == %(RETURN_CODE_FOR_RESUME)d ]]; then
echo "exit with code %(RETURN_CODE_FOR_RESUME)d for resume"
Expand Down Expand Up @@ -231,7 +231,8 @@ def _generate_run_script(self, job: Job):
runs_script_name = "job_{}_{}.sh".format(job.iteration, job.id)
submission_dir = pathlib.Path(self.submission_dir)
run_script_file_path = submission_dir / runs_script_name
cmd = job.generate_execution_cmd(self.paths)
# need to prefix the actual job command with `srun` so that --signal works.
cmd = job.generate_execution_cmd(self.paths, cmd_prefix="srun")

stdout_file = run_script_file_path.with_suffix(".out")
stderr_file = run_script_file_path.with_suffix(".err")
Expand Down
2 changes: 1 addition & 1 deletion tests/test_slurm_cluster_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def test_generate_run_script(job_data):

assert job_data.job.run_script_path == str(expected_path)

job_cmd = job_data.job.generate_execution_cmd(job_data.paths)
job_cmd = job_data.job.generate_execution_cmd(job_data.paths, cmd_prefix="srun")
run_script = run_script_path.read_text()
assert (
run_script
Expand Down

0 comments on commit 97211c2

Please sign in to comment.