Kill watchdog thread when engine is stopped

Step 1 of stopping the engine via api. Stop the watchdog thread,
so we don't do anymore monitoring.

Change-Id: I3d78834ab3cf81643260a47efec7c738f7a2f63f
This commit is contained in:
Pranesh Pandurangan 2014-06-12 19:57:43 -07:00
parent b41ea8a81f
commit 4e4533796b
1 changed files with 7 additions and 3 deletions

View File

@ -74,6 +74,9 @@ class Engine(object):
self._repairs = [] self._repairs = []
self._known_routing_keys = set() self._known_routing_keys = set()
# Watchdog-related variables
self._watchdog_thread = None
LOG.info('Created engine obj %s', self.name) LOG.info('Created engine obj %s', self.name)
# TODO(praneshp): Move to utils? # TODO(praneshp): Move to utils?
@ -113,8 +116,8 @@ class Engine(object):
self.futures.append(scheduler) self.futures.append(scheduler)
# watchdog # watchdog
watchdog_thread = self.start_watchdog() self._watchdog_thread = self.start_watchdog()
watchdog_thread.join() self._watchdog_thread.join()
def schedule(self): def schedule(self):
while True: while True:
@ -202,7 +205,8 @@ class Engine(object):
self.stop_engine() self.stop_engine()
def stop_engine(self): def stop_engine(self):
pass # Stop watchdog monitoring
self._watchdog_thread.stop()
def repair_modified(self): def repair_modified(self):
LOG.info('Repair configuration changed') LOG.info('Repair configuration changed')