From 9e480fb9f613c9fcf3b5910380bda4b4edae68fb Mon Sep 17 00:00:00 2001 From: hategan Date: Thu, 10 Aug 2023 11:19:40 -0700 Subject: [PATCH] Don't clean up submit file if it doesn't exist, which is the case when attaching a job to a native job. --- src/psij/executors/batch/batch_scheduler_executor.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/psij/executors/batch/batch_scheduler_executor.py b/src/psij/executors/batch/batch_scheduler_executor.py index f784717fd..ca1688a2f 100644 --- a/src/psij/executors/batch/batch_scheduler_executor.py +++ b/src/psij/executors/batch/batch_scheduler_executor.py @@ -510,7 +510,8 @@ def _clean_submit_script(self, job: Job) -> None: assert isinstance(self.config, BatchSchedulerExecutorConfig) if not self.config.keep_files: submit_file_path = self.work_directory / (job.id + '.job') - submit_file_path.unlink() + if submit_file_path.exists(): + submit_file_path.unlink() except Exception as ex: logger.warning('Job %s: failed clean submit script: %s', job.id, ex)