Skip to content

Commit

Permalink
Backport 0.4 handling of workers after death
Browse files Browse the repository at this point in the history
  • Loading branch information
sideshowdave7 committed Aug 11, 2017
1 parent c2ce431 commit ddca2f4
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions eventmq/jobmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,9 @@ def _start_event_loop(self):
Starts the actual event loop. Usually called by :meth:`start`
"""
# Acknowledgment has come
# When the job manager unexpectedly disconnects from the router and
# reconnects it needs to send a ready for each previously available
# worker.
# Send a READY for each previously available worker
if hasattr(self, '_workers'):
for _ in self._workers:
self.send_ready()

# Instantiate workers
self.workers

self.status = STATUS.running

Expand Down Expand Up @@ -218,6 +214,14 @@ def _start_event_loop(self):
except Exception:
logger.exception("Unhandled exception in main jobmanager loop")

# Cleanup
del self._workers

# Flush the queues with workers
self.request_queue = mp_queue()
self.finished_queue = mp_queue()
logger.info("Reached end of event loop")

def handle_response(self, resp):
"""
Handles a response from a worker process to the jobmanager
Expand Down

0 comments on commit ddca2f4

Please sign in to comment.