diff --git a/changes.d/6345.fix.md b/changes.d/6345.fix.md new file mode 100644 index 00000000000..a629eb6c8ed --- /dev/null +++ b/changes.d/6345.fix.md @@ -0,0 +1 @@ +Fix duplicate job submissions of tasks in the preparing state before reload. diff --git a/cylc/flow/task_job_mgr.py b/cylc/flow/task_job_mgr.py index 185966ff12d..d5c98288294 100644 --- a/cylc/flow/task_job_mgr.py +++ b/cylc/flow/task_job_mgr.py @@ -536,6 +536,12 @@ def submit_task_jobs(self, workflow, itasks, curve_auth, stdin_files = [] job_log_dirs = [] for itask in itasks_batch: + if not itask.waiting_on_job_prep: + # Avoid duplicate job submissions when flushing + # preparing tasks before a reload. See + # https://github.com/cylc/cylc-flow/pull/6345 + continue + if remote_mode: stdin_files.append( os.path.expandvars( @@ -554,8 +560,11 @@ def submit_task_jobs(self, workflow, itasks, curve_auth, # write flag so that subsequent manual retrigger will # generate a new job file. itask.local_job_file_path = None - itask.waiting_on_job_prep = False + + if not job_log_dirs: + continue + self.proc_pool.put_command( SubProcContext( self.JOBS_SUBMIT,