diff options
author | Marco Capitani <m.capitani@nextworks.it> | 2018-01-10 12:41:25 +0100 |
---|---|---|
committer | Marco Capitani <m.capitani@nextworks.it> | 2018-01-11 16:47:32 +0100 |
commit | 658a41da85783d0ea06b91e5c72f755144b2e449 (patch) | |
tree | aeee1f589d6f3e7999b5c3c9d2f990ef802cc905 /rumba/utils.py | |
parent | bb466208e238be10a0ca42e2db3f9edbb04e7bb8 (diff) | |
download | rumba-658a41da85783d0ea06b91e5c72f755144b2e449.tar.gz rumba-658a41da85783d0ea06b91e5c72f755144b2e449.zip |
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
Diffstat (limited to 'rumba/utils.py')
-rw-r--r-- | rumba/utils.py | 29 |
1 files changed, 17 insertions, 12 deletions
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. |