From 658a41da85783d0ea06b91e5c72f755144b2e449 Mon Sep 17 00:00:00 2001 From: Marco Capitani Date: Wed, 10 Jan 2018 12:41:25 +0100 Subject: storyboard: re-add run_command method Also: logging fix in ssh_support, Enabling changes: storyboard: refactor 'start' method, it was getting big some more minor storyboard refactoring for decoupling update examples to new syntax --- rumba/utils.py | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) (limited to 'rumba/utils.py') diff --git a/rumba/utils.py b/rumba/utils.py index 7417074..2a8c6b7 100644 --- a/rumba/utils.py +++ b/rumba/utils.py @@ -54,15 +54,20 @@ class ExperimentManager(object): pass def __exit__(self, exc_type, exc_val, exc_tb): - if self.do_swap_out == self.PROMPT: - logger.info('Press ENTER to start swap out.') - input('') - if self.do_swap_out == self.PROMPT \ - or self.do_swap_out == self.AUTO: - self.experiment.swap_out() - if exc_val is not None: - logger.error('Something went wrong. Got %s: %s', - type(exc_val).__name__, str(exc_val)) - logger.debug('Exception details:', exc_info=exc_val) - time.sleep(0.1) # Give the queue logger enough time to flush. - return True # Suppress the exception we logged: no traceback. + try: + if self.do_swap_out == self.PROMPT: + logger.info('Press ENTER to start swap out.') + input('') + if self.do_swap_out == self.PROMPT \ + or self.do_swap_out == self.AUTO: + self.experiment.swap_out() + if exc_val is not None: + logger.error('Something went wrong. Got %s: %s', + type(exc_val).__name__, str(exc_val)) + logger.debug('Exception details:', exc_info=exc_val) + finally: + log.flush_and_kill_logging() + # Make sure to print all logs before execution terminates, + # Specifically the last two error logs above. + return True + # Suppress the exception we logged: no traceback, unless requested. -- cgit v1.2.3