]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
last modif after tests bsr/resmgr
authorBernard Secher <bernard.secher@cea.fr>
Tue, 26 Mar 2019 15:45:34 +0000 (16:45 +0100)
committerBernard Secher <bernard.secher@cea.fr>
Thu, 28 Mar 2019 13:17:10 +0000 (14:17 +0100)
bin/appliskel/salome_tester/salome_instance.py
bin/runSalome.py
bin/runSession.py
src/NamingService/SALOME_NamingServicePy.py

index 36c5aee8da27482fc8aaf66fada17588907c4d96..867fe8ed9fd0ac663f2c435cd575407f0db633a3 100755 (executable)
@@ -49,10 +49,13 @@ class SalomeInstance(object):
     salome_instance = SalomeInstance()
     salome_instance.__run(args=instance_args, with_gui=with_gui)
 
-    with open(port_log) as f:
-      salome_instance.port = int(f.readline())
+    try:
+      with open(port_log) as f:
+        salome_instance.port = int(f.readline())
+      os.remove(port_log)
+    except:
+      pass
 
-    os.remove(port_log)
     return salome_instance
   #
 
index 11a17d24e2cc8bb06607976c91f5779df88ebd60..e51e08cb24bf837b1dae18eac4963099996b75eb 100755 (executable)
@@ -144,7 +144,15 @@ class CatalogServer(Server):
     def __init__(self,args):
         self.args=args
         self.initArgs()
-        self.SCMD1=['SALOME_ModuleCatalog_Server','-common']
+        self.SCMD1=['SALOME_ModuleCatalog_Server']
+        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]
+        self.SCMD1+=['-common']
         self.SCMD2=[]
         home_dir=os.getenv('HOME')
         if home_dir is not None:
@@ -169,6 +177,13 @@ class SalomeDSServer(Server):
         self.args=args
         self.initArgs()
         self.CMD=['SALOMEDS_Server']
+        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]
 
 # ---
 
@@ -193,6 +208,13 @@ class RegistryServer(Server):
         self.args=args
         self.initArgs()
         self.CMD=['SALOME_Registry_Server', '--salome_session','theSession']
+        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]
 
 # ---
 
@@ -200,7 +222,15 @@ class ContainerCPPServer(Server):
     def __init__(self,args,with_gui=False):
         self.args=args
         self.initArgs()
-        self.CMD=['SALOME_Container','FactoryServer']
+        self.CMD=['SALOME_Container']
+        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]
+        self.CMD+=['FactoryServer']
         if not with_gui and self.args["valgrind_session"]:
             l = ["valgrind"]
             val = os.getenv("VALGRIND_OPTIONS")
index 305fda70feba7a21c82b82e8042b70172218d817..fde468001a926bcf7b8934023b0fe55f67104107 100644 (file)
@@ -118,6 +118,10 @@ User "myself" connects to remotemachine to run the script concatenate.py in
                     help="[Remote mode] The user on the computer to connect to."
                     )
 
+  parser.add_option('-l', '--launcher', dest="launcher", default=None,
+                    help="[Remote mode] The machine and the port to connect to."
+                    )
+
   short_args, extra_args = getShortAndExtraArgs(args)
   try:
     (options, args) = parser.parse_args(short_args)
@@ -127,6 +131,12 @@ User "myself" connects to remotemachine to run the script concatenate.py in
 
   port = options.port
   host = options.host
+  launcher = options.launcher
+  if launcher is not None:
+    pos = launcher.find(":")
+    if pos != -1:
+      host = launcher[0:pos]
+      port = launcher[pos+1:]
 
   # :GLITCH: this code defines specific environment variables (OMNIORB_CONFIG, NSPORT,
   # NSHOST) which are later used by other modules. Working, but not really "safe"...
@@ -162,7 +172,7 @@ User "myself" connects to remotemachine to run the script concatenate.py in
   # determine running mode, that is either 'local' or 'remote'
   here = getShortHostName()
   mode = "local"
-  if host != here and host != "localhost" and host != "no_host":
+  if host != here and host != "localhost" and host != "no_host" and launcher is None:
     mode="remote"
     pass
   params = SessionParameters(mode, port, host, options.user, options.directory)
index 342c9371608bd26b354e29cf5f90af4207411b89..8fdde096bfece450976281493ec1efc1c8b89869 100644 (file)
@@ -190,6 +190,43 @@ class SALOME_NamingServicePy_i(object):
             self._obj = None
         return self._obj
 
+    #-------------------------------------------------------------------------
+
+    def Resolve_Dir(self, Path):
+        """ ns.Resolve_Dir(pathname) -> dir
+
+        find a CORBA object (ior) by its pathname
+        """
+        #MESSAGE ( "SALOME_NamingServicePy_i::Resolve" )
+        path_list = list(Path)
+        if path_list[0]=='/':
+            self._current_context = self._root_context
+            #delete first '/' before split
+            Path=Path[1:]
+
+        result_resolve_path = Path.split('/')
+        _context_name=[]
+        for i in range(len(result_resolve_path)-1):
+            _context_name.append(CosNaming.NameComponent(result_resolve_path[i],"dir"))
+        _context_name.append(CosNaming.NameComponent(result_resolve_path[len(result_resolve_path)-1],"dir"))
+        print(_context_name)
+        return None
+        try:
+            self._obj = self._current_context.resolve(_context_name)
+        except CosNaming.NamingContext.NotFound as ex:
+            MESSAGE ( "Resolve : CosNaming.NamingContext.NotFound" )
+            self._obj = None
+        except CosNaming.NamingContext.InvalidName as ex:
+            MESSAGE ( "Resolve : CosNaming.NamingContext.InvalidName" )
+            self._obj = None
+        except CosNaming.NamingContext.CannotProceed as ex:
+            MESSAGE ( "Resolve : CosNaming.NamingContext.CannotProceed" )
+            self._obj = None
+        except (CORBA.TRANSIENT,CORBA.OBJECT_NOT_EXIST,CORBA.COMM_FAILURE):
+            MESSAGE ( "Resolve : CORBA.TRANSIENT,CORBA.OBJECT_NOT_EXIST,CORBA.COMM_FAILURE" )
+            self._obj = None
+        return self._obj
+
 
     #-------------------------------------------------------------------------