Commit ff05f123 authored by Benjamin Blanc's avatar Benjamin Blanc

util: resolve test_result problems

parent 75b26012
...@@ -8,6 +8,8 @@ import sys ...@@ -8,6 +8,8 @@ import sys
import multiprocessing import multiprocessing
import errno import errno
import logging
import logging.handlers
from .argument import ArgumentType from .argument import ArgumentType
from .performance_tester import PerformanceTester from .performance_tester import PerformanceTester
from erp5.util import taskdistribution from erp5.util import taskdistribution
...@@ -23,18 +25,30 @@ class ScalabilityTest(object): ...@@ -23,18 +25,30 @@ class ScalabilityTest(object):
print 'self.count: %s' %(str(self.count)) print 'self.count: %s' %(str(self.count))
class ScalabilityLauncher(object): class ScalabilityLauncher(object):
def __init__(self, namespace=None): def __init__(self):
if not namespace: # Parse arguments
self.__argumentNamespace = self._parseArguments(argparse.ArgumentParser( self.__argumentNamespace = self._parseArguments(argparse.ArgumentParser(
description='Run ERP5 benchmarking scalability suites.')) description='Run ERP5 benchmarking scalability suites.'))
else: # Create Logger
self.__argumentNamespace = namespace logger_format = '%(asctime)s %(name)-13s: %(levelname)-8s %(message)s'
formatter = logging.Formatter(logger_format)
logging.basicConfig(level=logging.INFO,
format=logger_format)
logger = logging.getLogger('scalability_launcher')
logger.addHandler(logging.NullHandler())
file_handler = logging.handlers.RotatingFileHandler(
filename=self.__argumentNamespace.log_path,
maxBytes=20000000, backupCount=4)
file_handler.setFormatter(formatter)
logger.addHandler(file_handler)
self.log = logger.info
# Here make a connection with erp5 master
portal_url = __argumentNamespace.test_result_url
result = taskdistribution.TestResultProxyProxy(portal_url, 1.0, # Proxy to with erp5 master test_result
self._logger, __argumentNamespace.test_result_url, result = taskdistribution.TestResultProxyProxy(self.__argumentNamespace.portal_url,
__argumentNamespace.node_title, __argumentNamespace.revision) 1.0, logger, self.__argumentNamespace.test_result_url,
self.__argumentNamespace.node_title, self.__argumentNamespace.revision)
@staticmethod @staticmethod
def _addParserArguments(parser): def _addParserArguments(parser):
...@@ -43,7 +57,7 @@ class ScalabilityLauncher(object): ...@@ -43,7 +57,7 @@ class ScalabilityLauncher(object):
metavar='ERP5_URL', metavar='ERP5_URL',
help='Main url of ERP5 instance to test') help='Main url of ERP5 instance to test')
parser.add_argument('--erp5-test-result-url', parser.add_argument('--test-result-url',
metavar='ERP5_TEST_RESULT_URL', metavar='ERP5_TEST_RESULT_URL',
help='ERP5 URL to find test results corresponding ' help='ERP5 URL to find test results corresponding '
'to the current running test_suite') 'to the current running test_suite')
...@@ -56,6 +70,14 @@ class ScalabilityLauncher(object): ...@@ -56,6 +70,14 @@ class ScalabilityLauncher(object):
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('--portal-url',
metavar='PORTAL_URL',
help='Url to connect to ERP5 Master portal')
parser.add_argument('--log-path',
metavar='LOG_PATH',
help='Log Path')
@staticmethod @staticmethod
def _checkParsedArguments(namespace): def _checkParsedArguments(namespace):
...@@ -94,7 +116,7 @@ class ScalabilityLauncher(object): ...@@ -94,7 +116,7 @@ class ScalabilityLauncher(object):
start_time = time.time() start_time = time.time()
error_message_set, exit_status = set(), 0 error_message_set, exit_status = set(), 0
print self.__argumentNamespace.erp5_test_result_url print self.__argumentNamespace.test_result_url
print self.__argumentNamespace.erp5_url print self.__argumentNamespace.erp5_url
print self.__argumentNamespace.revision print self.__argumentNamespace.revision
print self.__argumentNamespace.node_title print self.__argumentNamespace.node_title
......
...@@ -356,8 +356,14 @@ class TestResultProxyProxy(TestResultProxy): ...@@ -356,8 +356,14 @@ class TestResultProxyProxy(TestResultProxy):
""" """
def __init__(self, portal_url, retry_time, logger, test_result_path, def __init__(self, portal_url, retry_time, logger, test_result_path,
node_title, revision): node_title, revision):
proxy = ServerProxy(portal_url, allow_none=True) try:
TestResultProxy.__init__(proxy, retry_time, logger, test_result_path, proxy = ServerProxy(
portal_url,
allow_none=True,
).portal_task_distribution
except:
raise ValueError("Cannot instanciate ServerProxy")
TestResultProxy(proxy, retry_time, logger, test_result_path,
node_title, revision) node_title, revision)
......
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