diff --git a/submitit/__init__.py b/submitit/__init__.py index 5936c67..5df0a3a 100644 --- a/submitit/__init__.py +++ b/submitit/__init__.py @@ -18,4 +18,4 @@ from .slurm.slurm import SlurmExecutor as SlurmExecutor from .slurm.slurm import SlurmJob as SlurmJob -__version__ = "1.5.1" +__version__ = "1.5.2" diff --git a/submitit/core/core.py b/submitit/core/core.py index d74b005..53a4d9a 100644 --- a/submitit/core/core.py +++ b/submitit/core/core.py @@ -925,7 +925,7 @@ def _submit_command(self, command: str) -> Job[tp.Any]: """ tmp_uuid = uuid.uuid4().hex submission_file_path = ( - utils.JobPaths.get_first_id_independent_folder(self.folder) / f"submission_file_{tmp_uuid}.sh" + utils.JobPaths.get_first_id_independent_folder(self.folder) / f".submission_file_{tmp_uuid}.sh" ) with submission_file_path.open("w") as f: f.write(self._make_submission_file_text(command, tmp_uuid)) @@ -935,7 +935,7 @@ def _submit_command(self, command: str) -> Job[tp.Any]: job_id = self._get_job_id_from_submission_command(output) tasks_ids = list(range(self._num_tasks())) job: Job[tp.Any] = self.job_class(folder=self.folder, job_id=job_id, tasks=tasks_ids) - job.paths.move_temporary_file(submission_file_path, "submission_file") + job.paths.move_temporary_file(submission_file_path, "submission_file", keep_as_symlink=True) self._write_job_id(job.job_id, tmp_uuid) self._set_job_permissions(job.paths.folder) return job diff --git a/submitit/core/utils.py b/submitit/core/utils.py index ab0bd01..d8ea7a0 100644 --- a/submitit/core/utils.py +++ b/submitit/core/utils.py @@ -93,9 +93,11 @@ def _format_id(self, path: tp.Union[Path, str]) -> Path: replaced_path = replaced_path.replace("%a", array_index[0]) return Path(replaced_path.replace("%A", array_id)) - def move_temporary_file(self, tmp_path: tp.Union[Path, str], name: str) -> None: + def move_temporary_file(self, tmp_path: tp.Union[Path, str], name: str, keep_as_symlink: bool = False) -> None: self.folder.mkdir(parents=True, exist_ok=True) Path(tmp_path).rename(getattr(self, name)) + if keep_as_symlink: + Path(tmp_path).symlink_to(getattr(self, name)) @staticmethod def get_first_id_independent_folder(folder: tp.Union[Path, str]) -> Path: