Commit c64d2536 authored by Sebastien Robin's avatar Sebastien Robin

erp5-util-scalability: cleanup useless spaces

parent f4c4fd4c
...@@ -34,7 +34,7 @@ class DummyLogger(object): ...@@ -34,7 +34,7 @@ class DummyLogger(object):
def getConnection(erp5_url, log): def getConnection(erp5_url, log):
""" """
Return a connection with the erp5 instance. Return a connection with the erp5 instance.
""" """
start_time = time.time() start_time = time.time()
count = 0 count = 0
while MAX_GETTING_CONNECTION_TIME > time.time()-start_time: while MAX_GETTING_CONNECTION_TIME > time.time()-start_time:
...@@ -84,7 +84,7 @@ def waitFor0PendingActivities(erp5_url, log): ...@@ -84,7 +84,7 @@ def waitFor0PendingActivities(erp5_url, log):
if len(message_list)==1 : if len(message_list)==1 :
log("1 pending activity but ok.") log("1 pending activity but ok.")
ok = True ok = True
log("There is %d pending activities" %len(message_list)) log("There is %d pending activities" %len(message_list))
time.sleep(5) time.sleep(5)
except: except:
...@@ -139,7 +139,7 @@ class ScalabilityTest(object): ...@@ -139,7 +139,7 @@ class ScalabilityTest(object):
def __init__(self, data, test_result): def __init__(self, data, test_result):
self.__dict__ = {} self.__dict__ = {}
self.__dict__.update(data) self.__dict__.update(data)
self.test_result = test_result self.test_result = test_result
def doNothing(**kwargs): def doNothing(**kwargs):
pass pass
...@@ -186,7 +186,7 @@ class ScalabilityLauncher(object): ...@@ -186,7 +186,7 @@ class ScalabilityLauncher(object):
file_handler.setFormatter(formatter) file_handler.setFormatter(formatter)
logger.addHandler(file_handler) logger.addHandler(file_handler)
self.log = logger.info self.log = logger.info
# Proxy to with erp5 master test_result # Proxy to with erp5 master test_result
self.test_result = taskdistribution.TestResultProxyProxy( self.test_result = taskdistribution.TestResultProxyProxy(
self.__argumentNamespace.test_suite_master_url, self.__argumentNamespace.test_suite_master_url,
...@@ -205,40 +205,40 @@ class ScalabilityLauncher(object): ...@@ -205,40 +205,40 @@ class ScalabilityLauncher(object):
parser.add_argument('--test-result-path', parser.add_argument('--test-result-path',
metavar='ERP5_TEST_RESULT_PATH', metavar='ERP5_TEST_RESULT_PATH',
help='ERP5 relative path of the test result') help='ERP5 relative path of the test result')
parser.add_argument('--revision', parser.add_argument('--revision',
metavar='REVISION', metavar='REVISION',
help='Revision of the test_suite') help='Revision of the test_suite')
parser.add_argument('--test-suite', parser.add_argument('--test-suite',
metavar='TEST_SUITE', metavar='TEST_SUITE',
help='Name of the test suite') help='Name of the test suite')
parser.add_argument('--node-title', parser.add_argument('--node-title',
metavar='NODE_TITLE', metavar='NODE_TITLE',
help='Title of the testnode which is running this' help='Title of the testnode which is running this'
'launcher') 'launcher')
parser.add_argument('--test-suite-master-url', parser.add_argument('--test-suite-master-url',
metavar='TEST_SUITE_MASTER_URL', metavar='TEST_SUITE_MASTER_URL',
help='Url to connect to the ERP5 Master testsuite taskditributor') help='Url to connect to the ERP5 Master testsuite taskditributor')
parser.add_argument('--log-path', parser.add_argument('--log-path',
metavar='LOG_PATH', metavar='LOG_PATH',
help='Log Path') help='Log Path')
parser.add_argument('--erp5-location', parser.add_argument('--erp5-location',
metavar='ERP5_LOCATION', metavar='ERP5_LOCATION',
help='Path to erp5 depository') help='Path to erp5 depository')
parser.add_argument('--runner-path', parser.add_argument('--runner-path',
metavar='Runner_PATH', metavar='Runner_PATH',
help='runner Path') help='runner Path')
@staticmethod @staticmethod
def _checkParsedArguments(namespace): def _checkParsedArguments(namespace):
return namespace return namespace
@staticmethod @staticmethod
def _parseArguments(parser): def _parseArguments(parser):
ScalabilityLauncher._addParserArguments(parser) ScalabilityLauncher._addParserArguments(parser)
...@@ -270,7 +270,7 @@ class ScalabilityLauncher(object): ...@@ -270,7 +270,7 @@ class ScalabilityLauncher(object):
return None return None
decoded_data = Utils.deunicodeData(json.loads(data)) decoded_data = Utils.deunicodeData(json.loads(data))
return ScalabilityTest(decoded_data, self.test_result) return ScalabilityTest(decoded_data, self.test_result)
def run(self): def run(self):
self.log("Scalability Launcher started, with:") self.log("Scalability Launcher started, with:")
self.log("Test suite master url: %s" %self.__argumentNamespace.test_suite_master_url) self.log("Test suite master url: %s" %self.__argumentNamespace.test_suite_master_url)
...@@ -279,12 +279,12 @@ class ScalabilityLauncher(object): ...@@ -279,12 +279,12 @@ class ScalabilityLauncher(object):
self.log("Revision: %s" %self.__argumentNamespace.revision) self.log("Revision: %s" %self.__argumentNamespace.revision)
self.log("Node title: %s" %self.__argumentNamespace.node_title) self.log("Node title: %s" %self.__argumentNamespace.node_title)
self.log("ERP5 url: %s" %self.__argumentNamespace.erp5_url) self.log("ERP5 url: %s" %self.__argumentNamespace.erp5_url)
error_message_set, exit_status = set(), 0 error_message_set, exit_status = set(), 0
# Get suite informations # Get suite informations
suite = makeSuite(self.__argumentNamespace.test_suite, self.log) suite = makeSuite(self.__argumentNamespace.test_suite, self.log)
test_suite_list = suite.getTestList() test_suite_list = suite.getTestList()
# Main loop # Main loop
while True: while True:
...@@ -295,7 +295,7 @@ class ScalabilityLauncher(object): ...@@ -295,7 +295,7 @@ class ScalabilityLauncher(object):
time.sleep(15) time.sleep(15)
current_test = self.getRunningTest() current_test = self.getRunningTest()
self.log("Test Case %s going to be run." %(current_test.title)) self.log("Test Case %s going to be run." %(current_test.title))
# Prepare configuration # Prepare configuration
current_test_number = int(current_test.title) current_test_number = int(current_test.title)
test_duration = suite.getTestDuration(current_test_number) test_duration = suite.getTestDuration(current_test_number)
...@@ -312,11 +312,11 @@ class ScalabilityLauncher(object): ...@@ -312,11 +312,11 @@ class ScalabilityLauncher(object):
# Store the number of documents generated for each iteration # Store the number of documents generated for each iteration
document_number = [] document_number = []
# Repeat the same test several times to accurate test result # Repeat the same test several times to accurate test result
for i in range(1, repetition+1): for i in range(1, repetition+1):
self.log("Repetition: %d/%d" %(i, repetition)) self.log("Repetition: %d/%d" %(i, repetition))
# Get the number of documents present before running the test. # Get the number of documents present before running the test.
waitFor0PendingActivities(self.__argumentNamespace.erp5_url, self.log) waitFor0PendingActivities(self.__argumentNamespace.erp5_url, self.log)
previous_document_number = getCreatedDocumentNumberFromERP5(self.__argumentNamespace.erp5_url, self.log) previous_document_number = getCreatedDocumentNumberFromERP5(self.__argumentNamespace.erp5_url, self.log)
...@@ -340,7 +340,7 @@ class ScalabilityLauncher(object): ...@@ -340,7 +340,7 @@ class ScalabilityLauncher(object):
'--user-index', str(user_index), '--user-index', str(user_index),
]) ])
user_index += user_number/len(test_suite_list) user_index += user_number/len(test_suite_list)
# Launch commands # Launch commands
tester_process_list = [] tester_process_list = []
for command in command_list: for command in command_list:
...@@ -357,7 +357,7 @@ class ScalabilityLauncher(object): ...@@ -357,7 +357,7 @@ class ScalabilityLauncher(object):
# Count created documents # Count created documents
# Wait for 0 pending activities before counting # Wait for 0 pending activities before counting
waitFor0PendingActivities(self.__argumentNamespace.erp5_url, self.log) waitFor0PendingActivities(self.__argumentNamespace.erp5_url, self.log)
current_document_number = getCreatedDocumentNumberFromERP5(self.__argumentNamespace.erp5_url, self.log) current_document_number = getCreatedDocumentNumberFromERP5(self.__argumentNamespace.erp5_url, self.log)
created_document_number = current_document_number - previous_document_number created_document_number = current_document_number - previous_document_number
self.log("previous_document_number: %d" %previous_document_number) self.log("previous_document_number: %d" %previous_document_number)
...@@ -366,7 +366,7 @@ class ScalabilityLauncher(object): ...@@ -366,7 +366,7 @@ class ScalabilityLauncher(object):
document_number.append(created_document_number) document_number.append(created_document_number)
# Move csv/logs # Move csv/logs
self.moveLogs(current_test.title) self.moveLogs(current_test.title)
self.log("Test Case %s is finish" %(current_test.title)) self.log("Test Case %s is finish" %(current_test.title))
# Get the maximum as choice # Get the maximum as choice
......
...@@ -147,7 +147,7 @@ class ERP5_scalability(_ERP5): ...@@ -147,7 +147,7 @@ class ERP5_scalability(_ERP5):
def getTestPath(self): def getTestPath(self):
return 'erp5/util/benchmark/examples/' return 'erp5/util/benchmark/examples/'
def getUsersFilePath(self): def getUsersFilePath(self):
return 'erp5/util/benchmark/examples/scalabilityUsers' return 'erp5/util/benchmark/examples/scalabilityUsers'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment