From c57040f14dea7e50ada1c8e1e28a56be3bb0f759 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 23 Jan 2015 15:33:43 -0800 Subject: [PATCH] DaemonState: add wait() Signed-off-by: Sage Weil --- teuthology/orchestra/daemon.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/teuthology/orchestra/daemon.py b/teuthology/orchestra/daemon.py index 21de682232..df42410e7d 100644 --- a/teuthology/orchestra/daemon.py +++ b/teuthology/orchestra/daemon.py @@ -46,6 +46,23 @@ class DaemonState(object): self.proc = None self.log.info('Stopped') + """ + Wait for daemon to exit + + Wait for daemon to stop (but don't trigger the stop). Pass up + any exception. Mark the daemon as not running. + """ + def wait(self, timeout=300): + self.log.debug('waiting for process to exit') + try: + run.wait([self.proc], timeout=timeout) + self.log.info('Stopped') + except: + self.log.info('Failed') + raise + finally: + self.proc = None + def restart(self, *args, **kwargs): """ Restart with a new command passed in the arguments -- 2.39.5