summaryrefslogtreecommitdiffstats
path: root/storperf/fio/fio_invoker.py
diff options
context:
space:
mode:
Diffstat (limited to 'storperf/fio/fio_invoker.py')
-rw-r--r--storperf/fio/fio_invoker.py30
1 files changed, 27 insertions, 3 deletions
diff --git a/storperf/fio/fio_invoker.py b/storperf/fio/fio_invoker.py
index fad2546..4f39eb7 100644
--- a/storperf/fio/fio_invoker.py
+++ b/storperf/fio/fio_invoker.py
@@ -7,10 +7,10 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
-from threading import Thread
import json
import logging
import subprocess
+from threading import Thread
class FIOInvoker(object):
@@ -88,11 +88,35 @@ class FIOInvoker(object):
stderr=subprocess.PIPE)
t = Thread(target=self.stdout_handler, args=())
- t.daemon = False
+ t.daemon = True
t.start()
t = Thread(target=self.stderr_handler, args=())
- t.daemon = False
+ t.daemon = True
t.start()
+ self.logger.debug("Started fio on " + self.remote_host)
t.join()
+ self.logger.debug("Finished fio on " + self.remote_host)
+
+ def terminate(self):
+ self.logger.debug("Terminating fio on " + self.remote_host)
+ cmd = ['ssh', '-o', 'StrictHostKeyChecking=no',
+ '-i', 'storperf/resources/ssh/storperf_rsa',
+ 'storperf@' + self.remote_host,
+ 'sudo', 'killall', '-9', 'fio']
+
+ kill_process = subprocess.Popen(cmd,
+ universal_newlines=True,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE)
+
+ for line in iter(kill_process.stdout.readline, b''):
+ self.logger.debug("FIO Termination: " + line)
+
+ kill_process.stdout.close()
+
+ for line in iter(kill_process.stderr.readline, b''):
+ self.logger.debug("FIO Termination: " + line)
+
+ kill_process.stderr.close()