From 4e4533796bf29d00f38aeb4ba06b89c9e7870bd5 Mon Sep 17 00:00:00 2001 From: Pranesh Pandurangan Date: Thu, 12 Jun 2014 19:57:43 -0700 Subject: [PATCH] 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 --- entropy/engine.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/entropy/engine.py b/entropy/engine.py index bc6734e..de72ae6 100644 --- a/entropy/engine.py +++ b/entropy/engine.py @@ -74,6 +74,9 @@ class Engine(object): self._repairs = [] self._known_routing_keys = set() + # Watchdog-related variables + self._watchdog_thread = None + LOG.info('Created engine obj %s', self.name) # TODO(praneshp): Move to utils? @@ -113,8 +116,8 @@ class Engine(object): self.futures.append(scheduler) # watchdog - watchdog_thread = self.start_watchdog() - watchdog_thread.join() + self._watchdog_thread = self.start_watchdog() + self._watchdog_thread.join() def schedule(self): while True: @@ -202,7 +205,8 @@ class Engine(object): self.stop_engine() def stop_engine(self): - pass + # Stop watchdog monitoring + self._watchdog_thread.stop() def repair_modified(self): LOG.info('Repair configuration changed')