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
#
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:
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]
# ---
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]
# ---
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")
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)
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"...
# 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)
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
+
#-------------------------------------------------------------------------