From a5488afe63cb97ab590286d4e39851567356056d Mon Sep 17 00:00:00 2001 From: "Harry (Open ERP)" Date: Fri, 4 Sep 2009 11:03:10 +0530 Subject: [PATCH] [IMP]quality_integration_server: put max_limit in server connection bzr revid: hmo@tinyerp.com-20090904053310-djdif3t0fvehsh9e --- .../base_quality_interrogation.py | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/bin/addons/quality_integration_server/base_quality_interrogation.py b/bin/addons/quality_integration_server/base_quality_interrogation.py index 2df0af247c7..620edd7dade 100755 --- a/bin/addons/quality_integration_server/base_quality_interrogation.py +++ b/bin/addons/quality_integration_server/base_quality_interrogation.py @@ -34,6 +34,8 @@ import socket admin_passwd = 'admin' waittime = 10 +wait_count = 0 +wait_limit = 12 def start_server(root_path, port, addons_path): if root_path: @@ -47,19 +49,27 @@ def clean(): ps.close() if pid: os.kill(pid,9) - + def execute(connector, method, *args): + global wait_count res = False try: res = getattr(connector,method)(*args) except socket.error,e: - if e.args[0] == 111: + if e.args[0] == 111: + if wait_count > wait_limit: + print "Server is taking too long to start, it has exceeded the maximum limit of %d seconds."%(wait_limit) + clean() + sys.exit(1) print 'Please wait %d sec to start server....'%(waittime) + wait_count += 1 time.sleep(waittime) res = execute(connector, method, *args) else: raise e - return res + wait_count = 0 + return res + def login(uri, dbname, user, pwd): conn = xmlrpclib.ServerProxy(uri + '/xmlrpc/common') @@ -110,12 +120,13 @@ def check_quality(uri, user, pwd, dbname, modules): html += "" for x,y,detail in quality_result['check_detail_ids']: if detail.get('detail') != '': - test = detail.get('name') + msg = detail.get('message') + test = detail.get('name') score = round(float(detail.get('score',0)),2) html += "
  • %s (%.2f)
  • "%(test,test,score) detail_html +="

    %s (Score : %s)

    %s
    "%(test,test,score,detail.get('detail')) detail_html +='''Go to Top''' - test_detail[test] = (score,detail.get('detail','')) + test_detail[test] = (score,msg,detail.get('detail','')) html += "
    %s"%(detail_html) final[quality_result['name']] = (quality_result['final_score'],html,test_detail)