コード例 #1
0
def startSalome(args, modules_list, modules_root_dir):
    """Launch all SALOME servers requested by args"""
    init_time = os.times()

    if verbose(): print "startSalome ", args

    #
    # Set server launch command
    #
    if args.has_key('server_launch_mode'):
        Server.set_server_launch_mode(args['server_launch_mode'])

    #
    # Wake up session option
    #
    if args['wake_up_session']:
        if "OMNIORB_CONFIG" not in os.environ:
            from salome_utils import generateFileName
            omniorbUserPath = os.getenv("OMNIORB_USER_PATH")
            kwargs={}
            if omniorbUserPath is not None:
                kwargs["with_username"]=True

            last_running_config = generateFileName(omniorbUserPath, prefix="omniORB",
                                                   suffix="last",
                                                   extension="cfg",
                                                   hidden=True,
                                                   **kwargs)
            os.environ['OMNIORB_CONFIG'] = last_running_config
            pass
        pass

    #
    # Initialisation ORB and Naming Service
    #

    clt=orbmodule.client(args)

    #
    # Wake up session option
    #
    if args['wake_up_session']:
        import Engines
        import SALOME
        import SALOMEDS
        import SALOME_ModuleCatalog
        import SALOME_Session_idl
        session = clt.waitNS("/Kernel/Session",SALOME.Session)
        status = session.GetStatSession()
        if status.activeGUI:
            from salome_utils import getPortNumber
            port = getPortNumber()
            msg  = "Warning :"
            msg += "\n"
            msg += "Session GUI for port number %s is already active."%(port)
            msg += "\n"
            msg += "If you which to wake up another session,"
            msg += "\n"
            msg += "please use variable OMNIORB_CONFIG"
            msg += "\n"
            msg += "to get the correct session object in naming service."
            sys.stdout.write(msg+"\n")
            sys.stdout.flush()
            return clt
        session.GetInterface()
        args["session_object"] = session
        return clt

    # Launch Logger Server (optional)
    # and wait until it is registered in naming service
    #

    if args['logger']:
        myServer=LoggerServer(args)
        myServer.run()
        clt.waitLogger("Logger")

    # Launch  Session Server (to show splash ASAP)
    #

    if args["gui"]:
        mySessionServ = SessionServer(args,args['modules'],modules_root_dir)
        mySessionServ.setpath(modules_list,modules_root_dir)
        mySessionServ.run()

    #
    # Launch Registry Server,
    # and wait until it is registered in naming service
    #

    if ('registry' not in args['embedded']) | (args["gui"] == 0) :
        myServer=RegistryServer(args)
        myServer.run()
        if sys.platform == "win32":
          clt.waitNS("/Registry")
        else:
          clt.waitNSPID("/Registry",myServer.PID)

    #
    # Launch Catalog Server,
    # and wait until it is registered in naming service
    #

    if ('moduleCatalog' not in args['embedded']) | (args["gui"] == 0):
        cataServer=CatalogServer(args)
        cataServer.setpath(modules_list,modules_root_dir)
        cataServer.run()
        import SALOME_ModuleCatalog
        if sys.platform == "win32":
          clt.waitNS("/Kernel/ModulCatalog",SALOME_ModuleCatalog.ModuleCatalog)
        else:
          clt.waitNSPID("/Kernel/ModulCatalog",cataServer.PID,SALOME_ModuleCatalog.ModuleCatalog)

    #
    # Launch SalomeDS Server,
    # and wait until it is registered in naming service
    #

    #print "ARGS = ",args
    if ('study' not in args['embedded']) | (args["gui"] == 0):
        print "RunStudy"
        myServer=SalomeDSServer(args)
        myServer.run()
        if sys.platform == "win32":
          clt.waitNS("/myStudyManager")
        else:
          clt.waitNSPID("/myStudyManager",myServer.PID)

    #
    # Launch LauncherServer
    #

    myCmServer = LauncherServer(args)
    myCmServer.setpath(modules_list,modules_root_dir)
    myCmServer.run()

    #
    # Launch ConnectionManagerServer
    #

    myConnectionServer = ConnectionManagerServer(args)
    myConnectionServer.run()


    from Utils_Identity import getShortHostName

    if os.getenv("HOSTNAME") == None:
        if os.getenv("HOST") == None:
            os.environ["HOSTNAME"]=getShortHostName()
        else:
            os.environ["HOSTNAME"]=os.getenv("HOST")

    theComputer = getShortHostName()

    #
    # Launch local C++ Container (FactoryServer),
    # and wait until it is registered in naming service
    #

    if ('cppContainer' in args['standalone']) | (args["gui"] == 0) :
        myServer=ContainerCPPServer(args)
        myServer.run()
        if sys.platform == "win32":
          clt.waitNS("/Containers/" + theComputer + "/FactoryServer")
        else:
          clt.waitNSPID("/Containers/" + theComputer + "/FactoryServer",myServer.PID)

    if 'pyContainer' in args['standalone']:
        raise Exception('Python containers no longer supported')

    #
    # Wait until Session Server is registered in naming service
    #

    if args["gui"]:
##----------------
        import Engines
        import SALOME
        import SALOMEDS
        import SALOME_ModuleCatalog
        import SALOME_Session_idl
        if sys.platform == "win32":
          session=clt.waitNS("/Kernel/Session",SALOME.Session)
        else:
          session=clt.waitNSPID("/Kernel/Session",mySessionServ.PID,SALOME.Session)
        args["session_object"] = session
    end_time = os.times()
    if verbose(): print
    print "Start SALOME, elapsed time : %5.1f seconds"% (end_time[4]
                                                         - init_time[4])

    # ASV start GUI without Loader
    #if args['gui']:
    #    session.GetInterface()

    #
    # additionnal external python interpreters
    #
    nbaddi=0

    try:
        if 'interp' in args:
            nbaddi = args['interp']
    except:
        import traceback
        traceback.print_exc()
        print "-------------------------------------------------------------"
        print "-- to get an external python interpreter:runSalome --interp=1"
        print "-------------------------------------------------------------"

    if verbose(): print "additional external python interpreters: ", nbaddi
    if nbaddi:
        for i in range(nbaddi):
            print "i=",i
            anInterp=InterpServer(args)
            anInterp.run()

    # set PYTHONINSPECT variable (python interpreter in interactive mode)
    if args['pinter']:
        os.environ["PYTHONINSPECT"]="1"
        try:
            import readline
        except ImportError:
            pass

    return clt
コード例 #2
0
import sys, os,signal,string,commands
import subprocess
import runSalome
import orbmodule
import TestKiller
import setenv

# get SALOME environment :

args, modules_list, modules_root_dir = setenv.get_config()
setenv.set_env(args, modules_list, modules_root_dir)

# launch CORBA naming server

clt=orbmodule.client()

# launch CORBA logger server

myServer=runSalome.LoggerServer(args)
myServer.run()
clt.waitLogger("Logger")

# execute Unit Test

command = ['./TestSALOMETraceCollector']
ret = subprocess.call(command)

# kill Test process

TestKiller.killProcess(runSalome.process_id)
コード例 #3
0
def startSalome():

  #
  # Lancement Session Loader
  #
  SessionLoader().run()

  #
  # Initialisation ORB et Naming Service
  #
  clt=orbmodule.client()

  # (non obligatoire) Lancement Logger Server et attente de sa 
  #  disponibilite dans le naming service
  #
  if with_logger:
	LoggerServer().run()
	clt.waitLogger("Logger")

  #
  # Lancement Registry Server
  #
  RegistryServer().run()

  #
  # Attente de la disponibilité du Registry dans le Naming Service
  #
  clt.waitNS("/Registry")

  #
  # Lancement Catalog Server
  #
  cataServer=CatalogServer()
  cataServer.setpath(liste_modules)
  cataServer.run()

  #
  # Attente de la disponibilité du Catalog Server dans le Naming Service
  #
  import SALOME_ModuleCatalog
  clt.waitNS("/Kernel/ModulCatalog",SALOME_ModuleCatalog.ModuleCatalog)

  #
  # Lancement SalomeDS Server
  #
  os.environ["CSF_PluginDefaults"]=os.path.join(kernel_root_dir,"share","salome","resources")
  os.environ["CSF_SALOMEDS_ResourcesDefaults"]=os.path.join(kernel_root_dir,"share","salome","resources")
  SalomeDSServer().run()

  if "GEOM" in liste_modules:
	print "GEOM OCAF Resources"
	os.environ["CSF_GEOMDS_ResourcesDefaults"]=os.path.join(modules_root_dir["GEOM"],"share","salome","resources")


  #
  # Attente de la disponibilité du SalomeDS dans le Naming Service
  #
  clt.waitNS("/myStudyManager")

  #
  # Lancement Session Server
  #
  SessionServer().run()

  #
  # Attente de la disponibilité du Session Server dans le Naming Service
  #
  import SALOME
  session=clt.waitNS("/Kernel/Session",SALOME.Session)

  #
  # Lancement containers
  #
  theComputer = os.getenv("HOSTNAME")
  theComputer = theComputer.split('.')[0]

  #
  # Lancement Container C++ local
  #
  if with_container_cpp:
	  ContainerCPPServer().run()
	  #
	  # Attente de la disponibilité du Container C++ local 
          # dans le Naming Service
	  #
	  clt.waitNS("/Containers/" + theComputer + "/FactoryServer")
  #
  # Lancement Container Python local
  #
  if with_container_python:
	  ContainerPYServer().run()
	  #
	  # Attente de la disponibilité du Container Python local 
          #  dans le Naming Service
	  #
	  clt.waitNS("/Containers/" + theComputer + "/FactoryServerPy")

  if with_container_superv:
	#
	# Lancement Container Supervision local
	#
	ContainerSUPERVServer().run()
	#
	# Attente de la disponibilité du Container Supervision local 
        # dans le Naming Service
	#
	clt.waitNS("/Containers/" + theComputer + "/SuperVisionContainer")
  #
  # Activation du GUI de Session Server
  #
  #session.GetInterface()

  end_time = os.times()
  print
  print "Start SALOME, elpased time : %5.1f seconds"% (end_time[4] - init_time[4])

  return clt
コード例 #4
0
#  -*- coding: iso-8859-1 -*-
# 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
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
#
# See http://www.salome-platform.org/ or email : [email protected]
#

## \file waitNS.py
# \brief command to wait until module catalog server is launched
#

import orbmodule
clt = orbmodule.client()
clt.waitNS("/Kernel/ModulCatalog")
コード例 #5
0
def startSalome(args, modules_list, modules_root_dir):
    """Launch all SALOME servers requested by args"""
    init_time = os.times()

    if verbose(): print "startSalome ", args

    #
    # Set server launch command
    #
    if args.has_key('server_launch_mode'):
        Server.set_server_launch_mode(args['server_launch_mode'])

    #
    # Wake up session option
    #
    if args['wake_up_session']:
        if "OMNIORB_CONFIG" not in os.environ:
            from salome_utils import generateFileName
            omniorbUserPath = os.getenv("OMNIORB_USER_PATH")
            kwargs = {}
            if omniorbUserPath is not None:
                kwargs["with_username"] = True

            last_running_config = generateFileName(omniorbUserPath,
                                                   prefix="omniORB",
                                                   suffix="last",
                                                   extension="cfg",
                                                   hidden=True,
                                                   **kwargs)
            os.environ['OMNIORB_CONFIG'] = last_running_config
            pass
        pass

    #
    # Initialisation ORB and Naming Service
    #

    clt = orbmodule.client(args)

    #
    # Wake up session option
    #
    if args['wake_up_session']:
        import Engines
        import SALOME
        import SALOMEDS
        import SALOME_ModuleCatalog
        import SALOME_Session_idl
        session = clt.waitNS("/Kernel/Session", SALOME.Session)
        status = session.GetStatSession()
        if status.activeGUI:
            from salome_utils import getPortNumber
            port = getPortNumber()
            msg = "Warning :"
            msg += "\n"
            msg += "Session GUI for port number %s is already active." % (port)
            msg += "\n"
            msg += "If you which to wake up another session,"
            msg += "\n"
            msg += "please use variable OMNIORB_CONFIG"
            msg += "\n"
            msg += "to get the correct session object in naming service."
            sys.stdout.write(msg + "\n")
            sys.stdout.flush()
            return clt
        session.GetInterface()
        args["session_object"] = session
        return clt

    # Launch Logger Server (optional)
    # and wait until it is registered in naming service
    #

    if args['logger']:
        myServer = LoggerServer(args)
        myServer.run()
        clt.waitLogger("Logger")

    # Launch  Session Server (to show splash ASAP)
    #

    if args["gui"]:
        mySessionServ = SessionServer(args, args['modules'], modules_root_dir)
        mySessionServ.setpath(modules_list, modules_root_dir)
        mySessionServ.run()

    #
    # Launch Registry Server,
    # and wait until it is registered in naming service
    #

    if ('registry' not in args['embedded']) | (args["gui"] == 0):
        myServer = RegistryServer(args)
        myServer.run()
        if sys.platform == "win32":
            clt.waitNS("/Registry")
        else:
            clt.waitNSPID("/Registry", myServer.PID)

    #
    # Launch Catalog Server,
    # and wait until it is registered in naming service
    #

    if ('moduleCatalog' not in args['embedded']) | (args["gui"] == 0):
        cataServer = CatalogServer(args)
        cataServer.setpath(modules_list, modules_root_dir)
        cataServer.run()
        import SALOME_ModuleCatalog
        if sys.platform == "win32":
            clt.waitNS("/Kernel/ModulCatalog",
                       SALOME_ModuleCatalog.ModuleCatalog)
        else:
            clt.waitNSPID("/Kernel/ModulCatalog", cataServer.PID,
                          SALOME_ModuleCatalog.ModuleCatalog)

    #
    # Launch SalomeDS Server,
    # and wait until it is registered in naming service
    #

    #print "ARGS = ",args
    if ('study' not in args['embedded']) | (args["gui"] == 0):
        print "RunStudy"
        myServer = SalomeDSServer(args)
        myServer.run()
        if sys.platform == "win32":
            clt.waitNS("/myStudyManager")
        else:
            clt.waitNSPID("/myStudyManager", myServer.PID)

    #
    # Launch LauncherServer
    #

    myCmServer = LauncherServer(args)
    myCmServer.setpath(modules_list, modules_root_dir)
    myCmServer.run()

    #
    # Launch ConnectionManagerServer
    #

    myConnectionServer = ConnectionManagerServer(args)
    myConnectionServer.run()

    from Utils_Identity import getShortHostName

    if os.getenv("HOSTNAME") == None:
        if os.getenv("HOST") == None:
            os.environ["HOSTNAME"] = getShortHostName()
        else:
            os.environ["HOSTNAME"] = os.getenv("HOST")

    theComputer = getShortHostName()

    #
    # Launch local C++ Container (FactoryServer),
    # and wait until it is registered in naming service
    #

    if ('cppContainer' in args['standalone']) | (args["gui"] == 0):
        myServer = ContainerCPPServer(args)
        myServer.run()
        if sys.platform == "win32":
            clt.waitNS("/Containers/" + theComputer + "/FactoryServer")
        else:
            clt.waitNSPID("/Containers/" + theComputer + "/FactoryServer",
                          myServer.PID)

    if 'pyContainer' in args['standalone']:
        raise Exception('Python containers no longer supported')

    #
    # Wait until Session Server is registered in naming service
    #

    if args["gui"]:
        ##----------------
        import Engines
        import SALOME
        import SALOMEDS
        import SALOME_ModuleCatalog
        import SALOME_Session_idl
        if sys.platform == "win32":
            session = clt.waitNS("/Kernel/Session", SALOME.Session)
        else:
            session = clt.waitNSPID("/Kernel/Session", mySessionServ.PID,
                                    SALOME.Session)
        args["session_object"] = session
    end_time = os.times()
    if verbose(): print
    print "Start SALOME, elapsed time : %5.1f seconds" % (end_time[4] -
                                                          init_time[4])

    # ASV start GUI without Loader
    #if args['gui']:
    #    session.GetInterface()

    #
    # additionnal external python interpreters
    #
    nbaddi = 0

    try:
        if 'interp' in args:
            nbaddi = args['interp']
    except:
        import traceback
        traceback.print_exc()
        print "-------------------------------------------------------------"
        print "-- to get an external python interpreter:runSalome --interp=1"
        print "-------------------------------------------------------------"

    if verbose(): print "additional external python interpreters: ", nbaddi
    if nbaddi:
        for i in range(nbaddi):
            print "i=", i
            anInterp = InterpServer(args)
            anInterp.run()

    # set PYTHONINSPECT variable (python interpreter in interactive mode)
    if args['pinter']:
        os.environ["PYTHONINSPECT"] = "1"
        try:
            import readline
        except ImportError:
            pass

    return clt