From e6ee50eaa942ccf86b6c386739f8819298245757 Mon Sep 17 00:00:00 2001 From: bohanjason Date: Sat, 23 May 2020 18:29:02 -0400 Subject: [PATCH] raise exception if oltpbench fails --- client/driver/fabfile.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/client/driver/fabfile.py b/client/driver/fabfile.py index 29537e0..80d1fa5 100644 --- a/client/driver/fabfile.py +++ b/client/driver/fabfile.py @@ -621,8 +621,13 @@ def _ready_to_shut_down_controller(): if os.path.exists(pidfile) and os.path.exists(dconf.OLTPBENCH_LOG): with open(dconf.OLTPBENCH_LOG, 'r') as f: content = f.read() + if 'Failed' in content: + m = re.search('\n.*Failed.*\n', content) + error_msg = m.group(0) + LOG.info('OLTPBench Failed!') + return True, error_msg ready = 'Output throughput samples into file' in content - return ready + return ready, None def clean_logs(): @@ -742,14 +747,18 @@ def loop(i): LOG.info('Start the first collection') # stop the experiment - while not _ready_to_shut_down_controller(): + ready_to_shut_down = False + error_msg = None + while not ready_to_shut_down: + ready_to_shut_down, error_msg = _ready_to_shut_down_controller() time.sleep(1) signal_controller() LOG.info('Start the second collection, shut down the controller') p.join() - + if error_msg: + raise Exception('OLTPBench Failed: ' + error_msg) # add user defined metrics if dconf.ENABLE_UDM is True: add_udm() @@ -770,7 +779,6 @@ def loop(i): # change config change_conf(response['recommendation']) - @task def run_loops(max_iter=10): # dump database if it's not done before.