Skip to content

Commit

Permalink
exit on external condition more nicely
Browse files Browse the repository at this point in the history
  • Loading branch information
yannikschaelte committed Dec 10, 2020
1 parent 6196f0d commit 6446a77
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pyabc/sampler/redis_eps/work_static.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ def get_int(var: str):
f"after {internal_counter} samples.")
# notify quit (manually here as we call exit)
redis.decr(idfy(N_WORKER, ana_id, t))
redis.incr(idfy(N_JOB, ana_id, t))
sys.exit(0)

# check whether time's up
Expand All @@ -117,6 +118,7 @@ def get_int(var: str):
f"runtime {current_runtime} exceeds "
f"max runtime {max_runtime_s}")
# return to task queue
redis.incr(idfy(N_JOB, ana_id, t))
return

# check whether the analysis was terminated or replaced by a new
Expand All @@ -127,6 +129,7 @@ def get_int(var: str):
f"Worker {n_worker} stops during population because "
"the analysis seems to have been stopped.")
# return to task queue
redis.incr(idfy(N_JOB, ana_id, t))
return

# increase global evaluation counter
Expand Down

0 comments on commit 6446a77

Please sign in to comment.