Skip to content

Commit

Permalink
fix: handling of remaining jobs when using --keep-going (#1693)
Browse files Browse the repository at this point in the history
* fix: proper handling of remaining jobs in case of keepgoing behavior

* syntax
  • Loading branch information
johanneskoester committed May 31, 2022
1 parent fdfc717 commit 87e4303
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions snakemake/scheduler.py
Expand Up @@ -404,7 +404,9 @@ def remaining_jobs(self):
return [
job
for job in self.dag.needrun_jobs()
if job not in self.running and not self.dag.finished(job)
if job not in self.running
and not self.dag.finished(job)
and job not in self.failed
]

def schedule(self):
Expand Down Expand Up @@ -451,7 +453,7 @@ def schedule(self):
logger.error(_ERROR_MSG_FINAL)
# we still have unfinished jobs. this is not good. direct
# user to github issue
if self.remaining_jobs:
if self.remaining_jobs and not self.keepgoing:
logger.error(_ERROR_MSG_ISSUE_823)
logger.error(
"Remaining jobs:\n"
Expand Down Expand Up @@ -609,15 +611,13 @@ def _handle_error(self, job):
# attempt starts counting from 1, but the first attempt is not
# a restart, hence we subtract 1.
if job.restart_times > job.attempt - 1:
logger.info("Trying to restart job {}.".format(self.dag.jobid(job)))
logger.info(f"Trying to restart job {self.dag.jobid(job)}.")
job.attempt += 1
# add job to those being ready again
self.dag._ready_jobs.add(job)
else:
self._errors = True
self.failed.add(job)
if self.keepgoing:
logger.info("Job failed, going on with independent jobs.")

def exit_gracefully(self, *args):
with self._lock:
Expand Down

0 comments on commit 87e4303

Please sign in to comment.