From: Cédric Aguerre Date: Tue, 28 Jul 2015 13:20:09 +0000 (+0200) Subject: PortManager: improve detection of busy ports X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=bec59e4d16028a65febfc4b899e3c917d36f72fe;p=modules%2Fyacs.git PortManager: improve detection of busy ports --- diff --git a/bin/PortManager.py b/bin/PortManager.py index 16345298c..518b4eed9 100644 --- a/bin/PortManager.py +++ b/bin/PortManager.py @@ -33,6 +33,7 @@ import logging def createLogger(): logger = logging.getLogger(__name__) # logger.setLevel(logging.DEBUG) + logger.setLevel(logging.INFO) ch = logging.StreamHandler() ch.setLevel(logging.DEBUG) formatter = logging.Formatter("%(levelname)s:%(threadName)s:%(message)s") @@ -119,7 +120,7 @@ def getPort(preferedPort=None): with open(config_file, 'r') as f: config = pickle.load(f) except: - print "Problem loading PortManager file: %s"%config_file + logger.info("Problem loading PortManager file: %s"%config_file) # In this case config dictionary is reset logger.debug("load busy_ports: %s"%str(config["busy_ports"])) @@ -135,6 +136,9 @@ def getPort(preferedPort=None): msg += "Can't find a free port to launch omniNames\n" msg += "Try to kill the running servers and then launch SALOME again.\n" raise RuntimeError, msg + logger.debug("Port %s seems to be busy"%str(port)) + if not port in config["busy_ports"]: + config["busy_ports"].append(port) port = port + 1 logger.debug("found free port: %s"%str(port)) config["busy_ports"].append(port)