Skip to content

Commit

Permalink
Better save location for slurm logs
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanbb committed Jun 7, 2024
1 parent 4956678 commit 1848bae
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion mesmerize_core/caiman_extensions/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,7 @@ def _run_slurm(
runfile_path: str,
algo: str,
uuid,
log_dir: Optional[str] = None,
**kwargs
):
# raise NotImplementedError("Not yet implemented, just a placeholder")
Expand All @@ -473,8 +474,14 @@ def _run_slurm(
else:
n_procs = psutil.cpu_count() - 1

if log_dir is None:
log_dir_path = Path(runfile_path).parent
else:
log_dir_path = Path(log_dir)

submission_command = (
f'sbatch --job-name={algo}-{str(uuid)[:8]} --ntasks=1 --cpus-per-task={n_procs} --wrap="{runfile_path}"'
f'sbatch --job-name={algo}-{str(uuid)[:8]} --ntasks=1 --cpus-per-task={n_procs} ' +
f'--output={log_dir_path / "slurm-%x.out"} --wrap="{runfile_path}"'
)

return Popen(submission_command.split(" "))
Expand Down

0 comments on commit 1848bae

Please sign in to comment.