summaryrefslogtreecommitdiffstats
path: root/storperf/fio/fio_invoker.py
diff options
context:
space:
mode:
authormbeierl <mark.beierl@emc.com>2015-11-23 08:23:47 -0800
committermbeierl <mark.beierl@emc.com>2015-11-23 20:15:59 -0800
commit002920e29d7fa4a28abec96773b470c90bafe55d (patch)
tree893f45209a84f197ef6ec3848ed83fc9df3eab8f /storperf/fio/fio_invoker.py
parentd480e8746512caf8821c42582e7ab75d25b3127b (diff)
Adding workload modules
Adding the ablity to define workloads in modules which can be referenced from the API. Breaking out the test execution into its own class so it will be easier to support ReST or other interfaces. Added flake8 and code coverage reports where possible to merge and verify jobs Change-Id: Ieb51e4e7e1e989288a6f81f4757709669914a196 JIRA: STORPERF-21 Signed-off-by: mbeierl <mark.beierl@emc.com>
Diffstat (limited to 'storperf/fio/fio_invoker.py')
-rw-r--r--storperf/fio/fio_invoker.py22
1 files changed, 12 insertions, 10 deletions
diff --git a/storperf/fio/fio_invoker.py b/storperf/fio/fio_invoker.py
index 722b051..be1b37c 100644
--- a/storperf/fio/fio_invoker.py
+++ b/storperf/fio/fio_invoker.py
@@ -7,19 +7,15 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
-import sys
-import getopt
import subprocess
import json
-from threading import Thread
+from threading import Thread
import logging
-class Usage(Exception):
- def __init__(self, msg):
- self.msg = msg
class FIOInvoker(object):
+
def __init__(self):
self.logger = logging.getLogger(__name__)
self.event_listeners = set()
@@ -39,7 +35,8 @@ class FIOInvoker(object):
self.json_body += line
try:
if line == "}\n":
- self.logger.debug("Have a json snippet: %s", self.json_body)
+ self.logger.debug(
+ "Have a json snippet: %s", self.json_body)
json_metric = json.loads(self.json_body)
self.json_body = ""
@@ -59,9 +56,13 @@ class FIOInvoker(object):
self.fio_process.stderr.close()
def execute(self, args=[]):
- self.fio_process = subprocess.Popen(['fio']+args,
- universal_newlines=True, stdout=subprocess.PIPE,
- stderr=subprocess.PIPE);
+ for arg in args:
+ self.logger.debug("FIO arg: " + arg)
+
+ self.fio_process = subprocess.Popen(['fio'] + args,
+ universal_newlines=True,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE)
t = Thread(target=self.stdout_handler, args=())
t.daemon = False
@@ -71,3 +72,4 @@ class FIOInvoker(object):
t.daemon = False
t.start()
+ t.join()