From: Bernard Secher Date: Thu, 22 Nov 2018 13:52:17 +0000 (+0100) Subject: connection to a corba naming service on a server X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=7ae5ecfd6da5887219084270aa2b5218e6965854;p=modules%2Fyacs.git connection to a corba naming service on a server --- diff --git a/bin/launchConfigureParser.py b/bin/launchConfigureParser.py index 30f4eb73a..1a5984cd7 100644 --- a/bin/launchConfigureParser.py +++ b/bin/launchConfigureParser.py @@ -70,6 +70,8 @@ valgrind_session_nam = "valgrind_session" shutdown_servers_nam = "shutdown_servers" foreground_nam = "foreground" wake_up_session_nam = "wake_up_session" +launcher_only_nam = "launcher_only" +launcher_nam = "launcher" # values in XML configuration file giving specific module parameters ( section) # which are stored in opts with key _ (eg SMESH_plugins) @@ -89,8 +91,9 @@ standalone_choices = [ "registry", "study", "moduleCatalog", "cppContainer"] # values of boolean type (must be '0' or '1'). # xml_parser.boolValue() is used for correct setting -boolKeys = ( gui_nam, splash_nam, logger_nam, file_nam, xterm_nam, portkill_nam, killall_nam, except_nam, pinter_nam, shutdown_servers_nam ) +boolKeys = ( gui_nam, splash_nam, logger_nam, file_nam, xterm_nam, portkill_nam, killall_nam, except_nam, pinter_nam, shutdown_servers_nam, launcher_only_nam ) intKeys = ( interp_nam, ) +strKeys = ( launcher_nam ) # values of list type listKeys = ( embedded_nam, key_nam, modules_nam, standalone_nam, plugins_nam ) @@ -365,6 +368,8 @@ class xml_parser: self.opts[key] = self.boolValue( val ) # assign boolean value: 0 or 1 elif nam in intKeys: self.opts[key] = self.intValue( val ) # assign integer value + elif nam in strKeys: + self.opts[key] = val # assign value elif nam in listKeys: self.opts[key] = [ self.strValue( a ) for a in re.split( "[:;,]", val ) ] # assign list value: [] else: @@ -683,6 +688,22 @@ Python file arguments, if any, must be comma-separated (without blank characters dest="print_port", help=help_str) + # launch only omniNames and Launcher server + help_str = "launch only omniNames and Launcher server" + pars.add_argument("--launcher_only", + action="store_true", + dest="launcher_only", + help=help_str) + + # machine and port where is the Launcher + help_str = "machine and port where is the Launcher. Usage: " + help_str += "--launcher=machine:port" + pars.add_argument("--launcher", + metavar="<=machine:port>", + type=str, + dest="launcher", + help=help_str) + # Do not relink ${HOME}/.omniORB_last.cfg help_str = "Do not save current configuration ${HOME}/.omniORB_last.cfg" pars.add_argument("--nosave-config", @@ -833,7 +854,6 @@ def get_env(appname=salomeappname, cfgname=salomecfgname, exeName=None): # - Command line options have the highest priority and replace options # specified in configuration file(s) ### - global args config_var = appname+'Config' @@ -1087,6 +1107,14 @@ def get_env(appname=salomeappname, cfgname=salomecfgname, exeName=None): args[shutdown_servers_nam] = cmd_opts.shutdown_servers pass + # Launcher only + if cmd_opts.launcher_only is not None: + args[launcher_only_nam] = cmd_opts.launcher_only + + # machine and port where is the Launcher + if cmd_opts.launcher is not None: + args[launcher_nam] = cmd_opts.launcher + # Foreground if cmd_opts.foreground is None: args[foreground_nam] = 1 diff --git a/bin/orbmodule.py b/bin/orbmodule.py index 60e800b5e..c50fb558e 100644 --- a/bin/orbmodule.py +++ b/bin/orbmodule.py @@ -41,6 +41,15 @@ class client: def __init__(self,args=None): # Initialise the ORB + + if 'launcher' in args: + pos = args['launcher'].find(":") + if pos != -1: + machine = args['launcher'][0:pos] + port = args['launcher'][pos+1:] + sys.argv.append('-ORBInitRef') + sys.argv.append("NameService=corbaname::" + machine + ":" + port) + print("Connect to naming service on machine: "+machine+" port: "+port) self.orb=CORBA.ORB_init(sys.argv, CORBA.ORB_ID) # Initialise the Naming Service diff --git a/bin/runSalome.py b/bin/runSalome.py index b07a5eabe..11a17d24e 100755 --- a/bin/runSalome.py +++ b/bin/runSalome.py @@ -177,6 +177,14 @@ class ConnectionManagerServer(Server): self.args=args self.initArgs() self.CMD=['SALOME_ConnectionManagerServer'] + if 'launcher' in self.args: + pos = args['launcher'].find(":") + if pos != -1: + self.CMD+=['-ORBInitRef'] + machine = args['launcher'][0:pos] + port = args['launcher'][pos+1:] + self.CMD+=["NameService=corbaname::" + machine + ":" + port] + # --- @@ -234,6 +242,13 @@ class SessionServer(Server): self.initArgs() self.SCMD1=['SALOME_Session_Server'] self.SCMD2=[] + if 'launcher' in self.args: + pos = args['launcher'].find(":") + if pos != -1: + self.SCMD1+=['-ORBInitRef'] + machine = args['launcher'][0:pos] + port = args['launcher'][pos+1:] + self.SCMD1+=["NameService=corbaname::" + machine + ":" + port] if 'registry' in self.args['embedded']: self.SCMD1+=['--with','Registry', '(','--salome_session','theSession',')'] @@ -471,7 +486,7 @@ def startSalome(args, modules_list, modules_root_dir): # Launch Session Server (to show splash ASAP) # - if args["gui"]: + if args["gui"] and not args['launcher_only']: mySessionServ = SessionServer(args,args['modules'],modules_root_dir) mySessionServ.setpath(modules_list,modules_root_dir) mySessionServ.run() @@ -523,17 +538,18 @@ def startSalome(args, modules_list, modules_root_dir): # Launch LauncherServer # - myCmServer = LauncherServer(args) - myCmServer.setpath(modules_list,modules_root_dir) - myCmServer.run() + if not 'launcher' in args: + myCmServer = LauncherServer(args) + myCmServer.setpath(modules_list,modules_root_dir) + myCmServer.run() # # Launch ConnectionManagerServer # - myConnectionServer = ConnectionManagerServer(args) - myConnectionServer.run() - + if not args['launcher_only']: + myConnectionServer = ConnectionManagerServer(args) + myConnectionServer.run() from Utils_Identity import getShortHostName @@ -565,7 +581,7 @@ def startSalome(args, modules_list, modules_root_dir): # Wait until Session Server is registered in naming service # - if args["gui"]: + if args["gui"] and not args['launcher_only']: ##---------------- import Engines import SALOME @@ -776,7 +792,7 @@ def main(exeName=None): if args['wake_up_session']: test = False pass - if test: + if test and not 'launcher' in args: from searchFreePort import searchFreePort searchFreePort(args, save_config, args.get('useport')) pass