]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
PortManager: improve detection of busy ports
authorCédric Aguerre <cedric.aguerre@edf.fr>
Tue, 28 Jul 2015 13:20:09 +0000 (15:20 +0200)
committerCédric Aguerre <cedric.aguerre@edf.fr>
Tue, 28 Jul 2015 13:24:35 +0000 (15:24 +0200)
bin/PortManager.py

index 16345298c60071e73d064ac7d0b8fd05dd8be627..518b4eed9bf78b3bd3b75a3c64fa260c3e625737 100644 (file)
@@ -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)