[Erp5-report] r45897 arnaud.fontaine - in /erp5/trunk/utils/erp5.utils.benchmark: ./ src/er...
nobody at svn.erp5.org
nobody at svn.erp5.org
Thu Jun 16 03:49:39 CEST 2011
Author: arnaud.fontaine
Date: Thu Jun 16 03:49:38 2011
New Revision: 45897
URL: http://svn.erp5.org?rev=45897&view=rev
Log:
Add script specific to nosqltestbed.
Modified:
erp5/trunk/utils/erp5.utils.benchmark/setup.py
erp5/trunk/utils/erp5.utils.benchmark/src/erp5/utils/benchmark/benchmark.py
erp5/trunk/utils/erp5.utils.benchmark/src/erp5/utils/benchmark/runBenchmark.py
Modified: erp5/trunk/utils/erp5.utils.benchmark/setup.py
URL: http://svn.erp5.org/erp5/trunk/utils/erp5.utils.benchmark/setup.py?rev=45897&r1=45896&r2=45897&view=diff
==============================================================================
--- erp5/trunk/utils/erp5.utils.benchmark/setup.py [utf8] (original)
+++ erp5/trunk/utils/erp5.utils.benchmark/setup.py [utf8] Thu Jun 16 03:49:38 2011
@@ -20,6 +20,7 @@ setup(
entry_points = {
'console_scripts': [
'runBenchmark = erp5.utils.benchmark.runBenchmark:runBenchmark',
+ 'scalability_tester_erp5 = erp5.utils.benchmark.runBenchmark:runTester',
'generateReport = erp5.utils.benchmark.generateReport:generateReport']
},
include_package_data=True,
Modified: erp5/trunk/utils/erp5.utils.benchmark/src/erp5/utils/benchmark/benchmark.py
URL: http://svn.erp5.org/erp5/trunk/utils/erp5.utils.benchmark/src/erp5/utils/benchmark/benchmark.py?rev=45897&r1=45896&r2=45897&view=diff
==============================================================================
--- erp5/trunk/utils/erp5.utils.benchmark/src/erp5/utils/benchmark/benchmark.py [utf8] (original)
+++ erp5/trunk/utils/erp5.utils.benchmark/src/erp5/utils/benchmark/benchmark.py [utf8] Thu Jun 16 03:49:38 2011
@@ -39,7 +39,8 @@ class ArgumentType(object):
return path
@classmethod
- def objectFromModule(cls, module_name, object_name=None, callable_object=False):
+ def objectFromModule(cls, module_name, object_name=None,
+ callable_object=False):
if module_name.endswith('.py'):
module_name = module_name[:-3]
@@ -229,7 +230,7 @@ from erp5.utils.test_browser.browser imp
class BenchmarkProcess(multiprocessing.Process):
def __init__(self, exit_msg_queue, nb_users, user_index,
- argument_namespace, *args, **kwargs):
+ argument_namespace, publish_method, *args, **kwargs):
self._exit_msg_queue = exit_msg_queue
self._nb_users = nb_users
self._user_index = user_index
@@ -245,6 +246,7 @@ class BenchmarkProcess(multiprocessing.P
self._current_repeat = 1
self._current_result = BenchmarkResult()
+ self._publish_method = publish_method
super(BenchmarkProcess, self).__init__(*args, **kwargs)
@@ -348,6 +350,9 @@ class BenchmarkProcess(multiprocessing.P
self.runBenchmarkSuiteList()
self._current_repeat += 1
+ if self._current_repeat == 5 and self._publish_method:
+ self._publish_method(self._result_filename, result_file.tell())
+
except StopIteration, e:
exit_msg = str(e)
exit_status = 1
@@ -357,5 +362,9 @@ class BenchmarkProcess(multiprocessing.P
exit_msg = "An error occured, see: %s" % self._log_filename
exit_status = 2
+ else:
+ if self._publish_method:
+ self._publish_method(self._result_filename, result_file.tell())
+
self._exit_msg_queue.put(exit_msg)
sys.exit(exit_status)
Modified: erp5/trunk/utils/erp5.utils.benchmark/src/erp5/utils/benchmark/runBenchmark.py
URL: http://svn.erp5.org/erp5/trunk/utils/erp5.utils.benchmark/src/erp5/utils/benchmark/runBenchmark.py?rev=45897&r1=45896&r2=45897&view=diff
==============================================================================
--- erp5/trunk/utils/erp5.utils.benchmark/src/erp5/utils/benchmark/runBenchmark.py [utf8] (original)
+++ erp5/trunk/utils/erp5.utils.benchmark/src/erp5/utils/benchmark/runBenchmark.py [utf8] Thu Jun 16 03:49:38 2011
@@ -33,7 +33,7 @@ import os
from benchmark import ArgumentType
-def parseArguments():
+def parseArguments(argv):
parser = argparse.ArgumentParser(description='Run ERP5 benchmarking suites.')
# Optional arguments
@@ -105,7 +105,7 @@ def parseArguments():
metavar='BENCHMARK_SUITES',
help='Benchmark suite modules')
- namespace = parser.parse_args()
+ namespace = parser.parse_args(argv)
namespace.user_tuple = ArgumentType.objectFromModule(namespace.user_info_filename,
object_name='user_tuple')
@@ -130,13 +130,14 @@ import multiprocessing
from benchmark import BenchmarkProcess
-def runConstantBenchmark(argument_namespace, nb_users):
+def runConstantBenchmark(argument_namespace, nb_users, publish_method):
process_list = []
exit_msg_queue = multiprocessing.Queue(nb_users)
for user_index in range(nb_users):
- process = BenchmarkProcess(exit_msg_queue, nb_users, user_index, argument_namespace)
+ process = BenchmarkProcess(exit_msg_queue, nb_users, user_index, argument_namespace,
+ publish_method)
process_list.append(process)
for process in process_list:
@@ -171,13 +172,13 @@ def runConstantBenchmark(argument_namesp
sys.exit(1)
-def runBenchmark():
- argument_namespace = parseArguments()
+def runBenchmark(publish_method=None, argv=None):
+ argument_namespace = parseArguments(argv)
if isinstance(argument_namespace.users, tuple):
nb_users, max_users = argument_namespace.users
while True:
- runConstantBenchmark(argument_namespace, nb_users)
+ runConstantBenchmark(argument_namespace, nb_users, publish_method)
if nb_users == max_users:
break
@@ -186,7 +187,20 @@ def runBenchmark():
max_users)
else:
- runConstantBenchmark(argument_namespace, argument_namespace.users)
+ runConstantBenchmark(argument_namespace, argument_namespace.users,
+ publish_method)
+
+from slapos.tool.nosqltester import NoSQLTester
+
+class BenchmarkTester(NoSQLTester):
+ def run_tester(self):
+ runBenchmark(self.send_result_availability_notification,
+ self.params['argv'])
+
+from slapos.tool.nosqltester import main
+
+def runTester():
+ main(klass=BenchmarkTester)
if __name__ == '__main__':
runBenchmark()
More information about the Erp5-report
mailing list