summaryrefslogtreecommitdiffstats
path: root/storperf
diff options
context:
space:
mode:
Diffstat (limited to 'storperf')
-rw-r--r--storperf/fio/fio_invoker.py24
-rw-r--r--storperf/utilities/data_handler.py2
-rw-r--r--storperf/utilities/math.py4
3 files changed, 18 insertions, 12 deletions
diff --git a/storperf/fio/fio_invoker.py b/storperf/fio/fio_invoker.py
index a201802..106696d 100644
--- a/storperf/fio/fio_invoker.py
+++ b/storperf/fio/fio_invoker.py
@@ -21,6 +21,7 @@ class FIOInvoker(object):
self.event_callback_ids = set()
self._remote_host = None
self.callback_id = None
+ self.terminated = False
@property
def remote_host(self):
@@ -51,17 +52,19 @@ class FIOInvoker(object):
json_metric = json.loads(self.json_body)
self.json_body = ""
- for event_listener in self.event_listeners:
- try:
+ if not self.terminated:
+ for event_listener in self.event_listeners:
+ try:
+ self.logger.debug(
+ "Event listener callback")
+ event_listener(
+ self.callback_id, json_metric)
+ except Exception, e:
+ self.logger.exception(
+ "Notifying listener %s: %s",
+ self.callback_id, e)
self.logger.debug(
- "Event listener callback")
- event_listener(self.callback_id, json_metric)
- except Exception, e:
- self.logger.exception(
- "Notifying listener %s: %s",
- self.callback_id, e)
- self.logger.debug(
- "Event listener callback complete")
+ "Event listener callback complete")
except Exception, e:
self.logger.error("Error parsing JSON: %s", e)
except IOError:
@@ -128,6 +131,7 @@ class FIOInvoker(object):
def terminate(self):
self.logger.debug("Terminating fio on " + self.remote_host)
+ self.terminated = True
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
diff --git a/storperf/utilities/data_handler.py b/storperf/utilities/data_handler.py
index e38f502..a4c9ae4 100644
--- a/storperf/utilities/data_handler.py
+++ b/storperf/utilities/data_handler.py
@@ -125,7 +125,7 @@ class DataHandler(object):
for item in series:
elapsed = (item[0] - start_time)
- sample_number = (elapsed / 60) + 1
+ sample_number = int(round(float(elapsed) / 60))
normalized_series.append([sample_number, item[1]])
return normalized_series
diff --git a/storperf/utilities/math.py b/storperf/utilities/math.py
index 4ddddca..8e04134 100644
--- a/storperf/utilities/math.py
+++ b/storperf/utilities/math.py
@@ -6,6 +6,7 @@
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
+import copy
def slope(data_series):
@@ -20,7 +21,7 @@ def slope(data_series):
[[x1,y1], [x2,y2], ..., [xm,ym]].
If this data pattern were to change, the data_treatement function
should be adjusted to ensure compatibility with the rest of the
- Steady State Dectection module.
+ Steady State Detection module.
"""
# In the particular case of an empty data series
@@ -28,6 +29,7 @@ def slope(data_series):
beta2 = None
else: # The general case
+ data_series = copy.deepcopy(data_series)
m = len(data_series)
# To make sure at least one element is a float number so the result
# of the algorithm be a float number