From c8c5f6dbb6c967049818035175db1efd759c0fad Mon Sep 17 00:00:00 2001 From: Patrick Armstrong Date: Thu, 15 Mar 2012 14:15:18 -0700 Subject: [PATCH] Make PD handle ctrl-c better --- epu/dashiproc/processdispatcher.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/epu/dashiproc/processdispatcher.py b/epu/dashiproc/processdispatcher.py index 8385694c..fb8882e1 100644 --- a/epu/dashiproc/processdispatcher.py +++ b/epu/dashiproc/processdispatcher.py @@ -53,7 +53,12 @@ def start(self): self.matchmaker.initialize() self.matchmaker_thread = gevent.spawn(self.matchmaker.run) - self.dashi.consume() + try: + self.dashi.consume() + except KeyboardInterrupt: + log.warning("Caught terminate signal. Bye!") + else: + log.info("Exiting normally. Bye!") def stop(self): self.dashi.cancel()