fixes for two scripts; omgbenchmark sample
diff --git a/configs-examples/omg.yaml b/configs-examples/omg.yaml
new file mode 100644
index 0000000..14e4207
--- /dev/null
+++ b/configs-examples/omg.yaml
@@ -0,0 +1,14 @@
+include: default.yaml
+
+clouds:
+ omg: local
+
+explicit_nodes:
+ "ssh://root@192.168.60.101::/home/yportnova/.ssh/id_rsa.pub": testnode
+ "ssh://root@192.168.59.3::/home/yportnova/.ssh/id_rsa.pub": testnode
+
+tests:
+ - omg:
+ prerun_script: "wally/suits/omgbench/prepare.sh"
+ run_script: "wally/suits/omgbench/run.sh"
+ run_opts: "times 23 url rabbit://guest:guest@192.168.60.101"
\ No newline at end of file
diff --git a/wally/run_test.py b/wally/run_test.py
index 2cd397e..af317b3 100755
--- a/wally/run_test.py
+++ b/wally/run_test.py
@@ -26,12 +26,14 @@
from wally.suits.itest import TestConfig
from wally.suits.io.fio import IOPerfTest
from wally.suits.postgres import PgBenchTest
+from wally.suits.omgbench import OmgTest
TOOL_TYPE_MAPPER = {
"io": IOPerfTest,
"pgbench": PgBenchTest,
"mysql": MysqlTest,
+ "omg": OmgTest,
}
@@ -540,6 +542,8 @@
rep = "\n\n".join(rep_lst)
elif tp in ['mysql', 'pgbench'] and data is not None:
rep = MysqlTest.format_for_console(data)
+ elif tp == 'omg':
+ rep = OmgTest.format_for_console(data)
else:
logger.warning("Can't generate text report for " + tp)
continue
diff --git a/wally/suits/itest.py b/wally/suits/itest.py
index af72084..0529c1f 100644
--- a/wally/suits/itest.py
+++ b/wally/suits/itest.py
@@ -211,10 +211,10 @@
"""
def run(self):
- barrier = Barrier(len(self.nodes))
+ barrier = Barrier(len(self.config.nodes))
th_test_func = functools.partial(self.th_test_func, barrier)
- with ThreadPoolExecutor(len(self.nodes)) as pool:
+ with ThreadPoolExecutor(len(self.config.nodes)) as pool:
return list(pool.map(th_test_func, self.config.nodes))
@abc.abstractmethod
@@ -262,7 +262,7 @@
class TwoScriptTest(ThreadedTest):
def __init__(self, *dt, **mp):
ThreadedTest.__init__(self, *dt, **mp)
-
+ self.remote_dir = '/tmp'
self.prerun_script = self.config.params['prerun_script']
self.run_script = self.config.params['run_script']
@@ -270,7 +270,7 @@
self.run_tout = self.config.params.get('run_tout', 3600)
def get_remote_for_script(self, script):
- return os.path.join(self.options.remote_dir,
+ return os.path.join(self.remote_dir,
os.path.basename(script))
def pre_run(self, node):
@@ -280,11 +280,11 @@
self.prerun_script: self.get_remote_for_script(self.prerun_script),
})
- cmd = self.get_remote_for_script(self.pre_run_script)
+ cmd = self.get_remote_for_script(self.prerun_script)
cmd += ' ' + self.config.params.get('prerun_opts', '')
run_on_node(node)(cmd, timeout=self.prerun_tout)
- def run(self, node):
+ def do_test(self, node):
cmd = self.get_remote_for_script(self.run_script)
cmd += ' ' + self.config.params.get('run_opts', '')
t1 = time.time()
diff --git a/wally/suits/omgbench/__init__.py b/wally/suits/omgbench/__init__.py
new file mode 100644
index 0000000..10a3151
--- /dev/null
+++ b/wally/suits/omgbench/__init__.py
@@ -0,0 +1,28 @@
+import os.path
+
+
+import texttable
+
+
+from ..itest import TwoScriptTest
+
+
+class OmgTest(TwoScriptTest):
+ root = os.path.dirname(__file__)
+ pre_run_script = os.path.join(root, "prepare.sh")
+ run_script = os.path.join(root, "run.sh")
+
+ @classmethod
+ def format_for_console(cls, data):
+ results = []
+
+ for res in data[0]:
+ results.append(float(res.raw_result))
+
+ totalt = sum(results)
+ totalms = int(100 * 2 * len(results) / totalt)
+ tab = texttable.Texttable(max_width=120)
+ tab.set_deco(tab.HEADER | tab.VLINES | tab.BORDER)
+ tab.header(["Bandwidth total"])
+ tab.add_row([totalms])
+ return tab.draw()
diff --git a/wally/suits/omgbench/prepare.sh b/wally/suits/omgbench/prepare.sh
new file mode 100755
index 0000000..2b49545
--- /dev/null
+++ b/wally/suits/omgbench/prepare.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+set -e
+set -x
+#
+#OMGPATN=/tmp
+#
+#mkdir -p "$OMGPATN"
+#cd "$OMGPATN"
+#
+#git clone https://github.com/openstack/rally
+#git clone https://github.com/Yulya/omgbenchmark
+#
+#mkdir venv
+#cd rally
+#./install_rally.sh -d "$OMGPATN"/venv -y
+#
+#cd "$OMGPATN"
+#source venv/bin/activate
+#apt-get -y install python-scipy libblas-dev liblapack-dev libatlas-base-dev gfortran
+#pip install oslo.messaging petname scipy
+#
+#
+#
diff --git a/wally/suits/omgbench/run.sh b/wally/suits/omgbench/run.sh
new file mode 100755
index 0000000..390bf67
--- /dev/null
+++ b/wally/suits/omgbench/run.sh
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+set -e
+
+
+while [[ $# > 1 ]]
+do
+key="$1"
+
+case $key in
+ url)
+ URL="$2"
+ shift
+ ;;
+ times)
+ TIMES="$2"
+ shift
+ ;;
+ *)
+ echo "Unknown option $key"
+ exit 1
+ ;;
+esac
+shift
+done
+
+OMGPATN=/tmp
+
+cd "$OMGPATN"
+source venv/bin/activate
+
+cd omgbenchmark/rally_plugin
+
+#sed -i -e "s,rabbit:\/\/guest:guest@localhost\/,$URL,g" deployment.json
+#sed -i -e "s,times\": 100,times\": $TIMES,g" task.json
+
+#rally --plugin-paths . deployment create --file=deployment.json --name=test2 &> /dev/null
+rally --plugin-paths . task start task.json &> ~/omg.log
+cat ~/omg.log | grep "Load duration" | grep -o '[0-9,.]\+'
\ No newline at end of file