Salome HOME
PortManager is not an option anymore
authorCédric Aguerre <cedric.aguerre@edf.fr>
Mon, 18 Jan 2016 13:10:52 +0000 (14:10 +0100)
committerCédric Aguerre <cedric.aguerre@edf.fr>
Mon, 18 Jan 2016 13:10:52 +0000 (14:10 +0100)
CMakeLists.txt
SalomeKERNELConfig.cmake.in
bin/PortManager.py
bin/salomeContext.py
bin/searchFreePort.py
doc/salome/salome_command.dox
src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx

index 384d9882a7aab19ce4c8c1acf27f22da656bca6e..cc9fe1274e8bf87ee647350be5355cbbfddc9668 100755 (executable)
@@ -1,4 +1,4 @@
-# Copyright (C) 2012-2015  CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2012-2016  CEA/DEN, EDF R&D, OPEN CASCADE
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -60,12 +60,11 @@ OPTION(SALOME_LIGHT_ONLY "Build SALOME Light only (no CORBA)" OFF)
 OPTION(SALOME_USE_LIBBATCH "Use LibBatch in KERNEL" OFF)
 CMAKE_DEPENDENT_OPTION(SALOME_PACO_PARALLEL "Build with PACO (implies SALOME_USE_MPI)" OFF
                        "NOT SALOME_LIGHT_ONLY" OFF)
-OPTION(SALOME_USE_PORTMANAGER "Add PortManager support" ON)
 CMAKE_DEPENDENT_OPTION(SALOME_USE_MPI "Use MPI containers" OFF
                        "NOT SALOME_PACO_PARALLEL" ON)
 CMAKE_DEPENDENT_OPTION(SALOME_USE_MPI "Use MPI containers" ${SALOME_USE_MPI}
                        "NOT SALOME_LIGHT_ONLY" OFF)
-MARK_AS_ADVANCED(SALOME_LIGHT_ONLY SALOME_USE_LIBBATCH SALOME_PACO_PARALLEL SALOME_USE_PORTMANAGER)
+MARK_AS_ADVANCED(SALOME_LIGHT_ONLY SALOME_USE_LIBBATCH SALOME_PACO_PARALLEL)
 
 # Required prerequisites
 #   Find "big" prerequisites first - they reference themselves many others
@@ -102,9 +101,6 @@ ENDIF()
 IF(SALOME_PACO_PARALLEL)
   FIND_PACKAGE(SalomePaco REQUIRED)
 ENDIF()
-IF(SALOME_USE_PORTMANAGER)
-  ADD_DEFINITIONS(-DWITH_PORTMANAGER)
-ENDIF()
 IF(SALOME_BUILD_TESTS)
   ENABLE_TESTING()
   FIND_PACKAGE(SalomeCppUnit)
index c9c4cfa884eb916244084237374fccef376a3a74..463578ff99636b970b21957b02a7a3b22cad5ddb 100644 (file)
@@ -10,7 +10,7 @@
 #  SALOME_LIGHT_ONLY         - ON if SALOME is built in Light mode (no CORBA)
 
 ###############################################################
-# Copyright (C) 2007-2015  CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
 #
 # Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -67,11 +67,6 @@ SET(SALOME_KERNEL_BUILD_TESTS @SALOME_BUILD_TESTS@)
 SET(SALOME_KERNEL_LIGHT_ONLY  @SALOME_LIGHT_ONLY@)
 SET(SALOME_USE_LIBBATCH       @SALOME_USE_LIBBATCH@)
 
-SET(SALOME_USE_PORTMANAGER     @SALOME_USE_PORTMANAGER@)
-IF(SALOME_USE_PORTMANAGER)
-  LIST(APPEND KERNEL_DEFINITIONS "-DWITH_PORTMANAGER")
-ENDIF()
-
 # Prerequisites:
 IF(SALOME_KERNEL_BUILD_TESTS)
   SET_AND_CHECK(CPPUNIT_ROOT_DIR_EXP  "@PACKAGE_CPPUNIT_ROOT_DIR@")
index f1641bdb68a7b8c7ef148327fe378c5b9ff4ee64..6532587133c7a7d9d0f9d2d2833ef4b0cc7962b3 100644 (file)
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 #  -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2015  CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
 #
 # Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -44,7 +44,7 @@ def createLogger():
 logger = createLogger()
 
 #------------------------------------
-# A file locker (Linux only)
+# A file locker
 def __acquire_lock(lock):
   if sys.platform == "win32":
     import msvcrt
@@ -62,6 +62,7 @@ def __release_lock(lock):
     import fcntl
     fcntl.flock(lock, fcntl.LOCK_UN)
 #
+#------------------------------------
 
 def _getConfigurationFilename():
   omniorbUserPath = os.getenv("OMNIORB_USER_PATH")
@@ -200,7 +201,7 @@ def releasePort(port):
     __release_lock(lock)
 
     logger.debug("released port port: %s"%str(port))
-  
+
   os.umask(oldmask)
 #
 
index 7a89e9666250300eeacf871ac046996629bb54e8..2132c0613ac6d29698c46b5ed551b89327f8b022 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2013-2015  CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2013-2016  CEA/DEN, EDF R&D, OPEN CASCADE
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -425,6 +425,7 @@ class SalomeContext:
             p.start()
             p.join()
     except ImportError:
+      # :TODO: should be declared obsolete
       from killSalome import killAllPorts
       killAllPorts()
       pass
index 3240663b4a35c889299f7d040f4625716241b826..cdf304eba8e60a085a5c649bb443b24c57df2fcc 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 #  -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2015  CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
 #
 # Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -64,65 +64,6 @@ def __setup_config(nsport, args, save_config):
   #
 #
 
-def searchFreePort_withoutPortManager(args={}, save_config=1, use_port=None):
-  # :NOTE: Under windows:
-  #        netstat options -l and -t are unavailable
-  #        grep command is unavailable
-  from subprocess import Popen, PIPE
-  (stdout, stderr) = Popen(['netstat','-an'], stdout=PIPE).communicate()
-  import StringIO
-  buf = StringIO.StringIO(stdout)
-  ports = buf.readlines()
-
-  #
-  def portIsUsed(port, data):
-    import re
-    regObj = re.compile( ".*tcp.*:([0-9]+).*:.*listen", re.IGNORECASE );
-    for item in data:
-      try:
-        p = int(regObj.match(item).group(1))
-        if p == port: return True
-        pass
-      except:
-        pass
-      pass
-    return False
-  #
-
-  if use_port:
-    print "Check if port can be used: %d" % use_port,
-    if not portIsUsed(use_port, ports):
-      print "- OK"
-      __setup_config(use_port, args, save_config)
-      return
-    else:
-      print "- KO: port is busy"
-    pass
-  #
-
-  print "Searching for a free port for naming service:",
-  #
-
-  NSPORT=2810
-  limit=NSPORT+100
-  #
-
-  while 1:
-    if not portIsUsed(NSPORT, ports):
-      print "%s - OK"%(NSPORT)
-      __setup_config(NSPORT, args, save_config)
-      break
-    print "%s"%(NSPORT),
-    if NSPORT == limit:
-      msg  = "\n"
-      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
-    NSPORT=NSPORT+1
-    pass
-  #
-#
-
 def searchFreePort_withPortManager(queue, args={}, save_config=1, use_port=None):
   from PortManager import getPort
   port = getPort(use_port)
@@ -186,6 +127,5 @@ def searchFreePort(args={}, save_config=1, use_port=None):
 
     p.join() # this blocks until the process terminates
   except ImportError:
-    searchFreePort_withoutPortManager(args, save_config, use_port)
-    __savePortToFile(args)
+    raise Exception('PortManager module not found')
 #
index 2d23874173d01bf67d8fafeb9757f5ac6f68a3c5..1bb3a45e8a79d63fb52e83929538816b4f24fc6b 100644 (file)
@@ -89,11 +89,8 @@ For example:
 \section handling_concurrency Handling concurrent starts
 A SALOME instance uses a dedicated TCP port number on which the CORBA name server of each SALOME application will connect. This refers to a technical solution that allows multiple software components belonging to the same application to communicate with each other. This approach is a standard used when multiple applications are running at the same time (components should not interfere with each other), and when application components can be distributed across multiple machines.
 
-Each SALOME application owns a specific port number. This port is determined automatically when application starts. When multiple applications are started at the same time, assigning a number to each port could be conflicting, and the same port could be assigned to several applications. To prevent from such a situation, a Python object named \c Portmanager has been implemented (Linux only). In SALOME 7, this object is available when activating a specific compilation flag of KERNEL module:
-- For gcc: -DWITH_PORTMANAGER
-- With CMake: SALOME_USE_PORTMANAGER=ON
+Each SALOME application owns a specific port number. This port is determined automatically when application starts. When multiple applications are started at the same time, assigning a number to each port could be conflicting, and the same port could be assigned to several applications. To prevent from such a situation, a Python object named \c Portmanager has been implemented. This object has been introduced in SALOME 7 as an optional tool, then evaluated on Linux and Windows. In SALOME 8, this object becomes the standard.
 
-Since SALOME 7.5.0 this flag is switched ON by default.
 Several instances can be safely started concurrently. For example in an automated process, calling several times the following commands (WORK_DIR variable changes at each call):
 \code
 salome start -t --ns-port-log=${WORK_DIR}/session.log
index 966ab07d6d212cef0800d68bc50794c38724dd39..754fffa220b8d5c002b0c35b6d538b12cca08b97 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2015  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -623,7 +623,6 @@ void SALOME_LifeCycleCORBA::killOmniNames()
     system( cmd.c_str() );
   }
 
-#ifdef WITH_PORTMANAGER
   // shutdown portmanager
   if ( !portNumber.empty() )
   {
@@ -635,7 +634,6 @@ void SALOME_LifeCycleCORBA::killOmniNames()
     MESSAGE(cmd);
     system( cmd.c_str() );
   }
-#endif
 }
 
 //=============================================================================