]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
connection to a corba naming service on a server
authorBernard Secher <bernard.secher@cea.fr>
Thu, 22 Nov 2018 13:52:17 +0000 (14:52 +0100)
committerBernard Secher <bernard.secher@cea.fr>
Thu, 28 Mar 2019 13:17:10 +0000 (14:17 +0100)
bin/launchConfigureParser.py
bin/orbmodule.py
bin/runSalome.py

index 30f4eb73afd64bf4200a0487116e140573370cb2..1a5984cd73b7e2f200edece1cd0e00d19db603cd 100644 (file)
@@ -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 (<module_name> section)
 # which are stored in opts with key <module_name>_<parameter> (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
index 60e800b5e24b46117dfeec25394a97cfd93b63f1..c50fb558eec95b961cd3430ebda08dea7283558b 100644 (file)
@@ -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
index b07a5eabe493d2308e239a1540c81a43ae7d184b..11a17d24e2cc8bb06607976c91f5779df88ebd60 100755 (executable)
@@ -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