-# 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
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
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)
# 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
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@")
#!/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
logger = createLogger()
#------------------------------------
-# A file locker (Linux only)
+# A file locker
def __acquire_lock(lock):
if sys.platform == "win32":
import msvcrt
import fcntl
fcntl.flock(lock, fcntl.LOCK_UN)
#
+#------------------------------------
def _getConfigurationFilename():
omniorbUserPath = os.getenv("OMNIORB_USER_PATH")
__release_lock(lock)
logger.debug("released port port: %s"%str(port))
-
+
os.umask(oldmask)
#
-# 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
p.start()
p.join()
except ImportError:
+ # :TODO: should be declared obsolete
from killSalome import killAllPorts
killAllPorts()
pass
#!/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
#
#
-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)
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')
#
\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
-// 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
system( cmd.c_str() );
}
-#ifdef WITH_PORTMANAGER
// shutdown portmanager
if ( !portNumber.empty() )
{
MESSAGE(cmd);
system( cmd.c_str() );
}
-#endif
}
//=============================================================================