Skip to content

Commit

Permalink
Avoid duplicate backups when JobGroup replicates return
Browse files Browse the repository at this point in the history
  • Loading branch information
emitra17 committed Jan 8, 2019
1 parent eb6eeeb commit 677805d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pybnf/algorithms.py
Original file line number Diff line number Diff line change
Expand Up @@ -875,9 +875,11 @@ def run(self, log_prefix, scheduler_node=None, resume=None, debug=False, reuse_c
futures.append(f)
pending[f] = (job.params, job.job_id)
pool = custom_as_completed(futures, with_results=True, raise_errors=False)
backed_up = True
while True:
if sim_count % backup_every == 0 and sim_count != 0:
if sim_count % backup_every == 0 and not backed_up:
self.backup(set([pending[fut][0] for fut in pending]))
backed_up = True
f, res = next(pool)
if isinstance(res, DaskError):
if isinstance(res.error, PybnfError):
Expand All @@ -894,6 +896,7 @@ def run(self, log_prefix, scheduler_node=None, resume=None, debug=False, reuse_c
continue
res = group.average_results()
sim_count += 1
backed_up = False
if isinstance(res, FailedSimulation):
if res.fail_type >= 1:
self.fail_count += 1
Expand Down

0 comments on commit 677805d

Please sign in to comment.