fix sensors deploy code
diff --git a/config.py b/config.py
index cfe5438..e5962da 100644
--- a/config.py
+++ b/config.py
@@ -39,3 +39,4 @@
cfg_dict['html_report_file'] = in_var_dir('report.html')
cfg_dict['text_report_file'] = in_var_dir('report.txt')
cfg_dict['log_file'] = in_var_dir('log.txt')
+ cfg_dict['sensor_storage'] = in_var_dir('sensor_storage.txt')
diff --git a/report.py b/report.py
index ec42035..b2cc1a2 100644
--- a/report.py
+++ b/report.py
@@ -176,9 +176,12 @@
return str(ch)
-def make_io_report(results, path, lab_url, creds):
- data = collect_lab_data(lab_url, creds)
- lab_info = total_lab_info(data)
+def make_io_report(results, path, lab_url=None, creds=None):
+ if lab_url is not None:
+ data = collect_lab_data(lab_url, creds)
+ lab_info = total_lab_info(data)
+ else:
+ lab_info = ""
for suite_type, test_suite_data in results:
if suite_type != 'io':
diff --git a/run_test.py b/run_test.py
index b424b76..8086308 100755
--- a/run_test.py
+++ b/run_test.py
@@ -1,5 +1,6 @@
import os
import sys
+import time
import Queue
import pprint
import logging
@@ -18,9 +19,9 @@
from nodes import discover
from nodes.node import Node
from config import cfg_dict, load_config
-from sensors.api import start_monitoring
from tests.itest import IOPerfTest, PgBenchTest
from formatters import format_results_for_console
+from sensors.api import start_monitoring, deploy_and_start_sensors
logger = logging.getLogger("io-perf-tool")
@@ -124,15 +125,15 @@
logger.info("All nodes connected successfully")
-def save_sensors_data(q):
+def save_sensors_data(q, fd):
logger.info("Start receiving sensors data")
- sensor_data = []
while True:
val = q.get()
if val is None:
- q.put(sensor_data)
+ q.put([])
break
- sensor_data.append(val)
+ fd.write("\n" + str(time.time()) + " : ")
+ fd.write(repr(val))
logger.info("Sensors thread exits")
@@ -245,14 +246,16 @@
ctx.sensors_control_queue = ctx.sensor_cm.__enter__()
+ fd = open(cfg_dict['sensor_storage'], "w")
th = threading.Thread(None, save_sensors_data, None,
- (ctx.sensors_control_queue,))
+ (ctx.sensors_control_queue, fd))
th.daemon = True
th.start()
ctx.sensor_listen_thread = th
def remove_sensors_stage(cfg, ctx):
+ ctx.sensor_cm.__exit__(None, None, None)
ctx.sensors_control_queue.put(None)
ctx.sensor_listen_thread.join()
ctx.sensor_data = ctx.sensors_control_queue.get()
@@ -327,12 +330,26 @@
connect_all(new_nodes)
+ # deploy sensors on new nodes
+ # unify this code
+ if 'sensors' in cfg:
+ sens_cfg = []
+ sensors_str = cfg["sensors"]["roles_mapping"]['testnode']
+ sensors = [sens.strip() for sens in sensors_str.split(",")]
+
+ collect_cfg = dict((sensor, {}) for sensor in sensors)
+ for node in new_nodes:
+ sens_cfg.append((node.connection, collect_cfg))
+
+ uri = cfg["sensors"]["receiver_uri"]
+ deploy_and_start_sensors(uri, None,
+ connected_config=sens_cfg)
+
for test_group in config.get('tests', []):
ctx.results.extend(run_tests(test_group, ctx.nodes))
finally:
- # shut_down_vms_stage(cfg, ctx)
- pass
+ shut_down_vms_stage(cfg, ctx)
elif 'tests' in key:
ctx.results.extend(run_tests(config, ctx.nodes))
diff --git a/sensors/deploy_sensors.py b/sensors/deploy_sensors.py
index 3c715ef..feb8bcb 100644
--- a/sensors/deploy_sensors.py
+++ b/sensors/deploy_sensors.py
@@ -17,6 +17,7 @@
def deploy_and_start_sensors(monitor_uri, config,
remote_path='/tmp/sensors',
connected_config=None):
+
paths = {os.path.dirname(__file__): remote_path}
with ThreadPoolExecutor(max_workers=32) as executor:
futures = []
diff --git a/tests/itest.py b/tests/itest.py
index ad76b9e..975499b 100644
--- a/tests/itest.py
+++ b/tests/itest.py
@@ -160,6 +160,7 @@
out_err = run_over_ssh(conn, cmd,
stdin_data=self.raw_cfg,
timeout=int(exec_time * 1.1 + 300))
+ logger.info("Done")
finally:
barrier.exit()