logger.debug("startSalome : {} ".format(args))
+ ior_fakens_filename = None
+
# Launch Session Server (to show splash ASAP)
#
mySessionServ = runSalomeNoServer.NoSessionServer(args,args['modules'],modules_root_dir)
mySessionServ.setpath(modules_list,modules_root_dir)
mySessionServ.run()
+ ior_fakens_filename = mySessionServ.iorfakens
end_time = os.times()
except Exception:
import traceback
traceback.print_exc()
- print("-------------------------------------------------------------")
- print("-- to get an external python interpreter:runSalome --interp=1")
- print("-------------------------------------------------------------")
+ logger.error("-------------------------------------------------------------")
+ logger.error("-- to get an external python interpreter:runSalome --interp=1")
+ logger.error("-------------------------------------------------------------")
logger.debug("additional external python interpreters: {}".format(nbaddi))
if nbaddi:
for i in range(nbaddi):
- print("i=",i)
anInterp=InterpServer(args)
anInterp.run()
except ImportError:
pass
- return
+ return ior_fakens_filename
# -----------------------------------------------------------------------------
show registered objects in Naming Service.
"""
global process_id
-
+ ior_fakens_filename = None
try:
- startSalome(args, modules_list, modules_root_dir)
+ ior_fakens_filename = startSalome(args, modules_list, modules_root_dir)
except Exception:
import traceback
traceback.print_exc()
- print()
- print()
- print("--- Error during Salome launch ---")
+ logger.error("--- Error during Salome launch ---")
# print(process_id)
the processes resulting from the previous execution.
"""%filedict)
- return
+ return ior_fakens_filename
def execScript(script_path):
print('executing', script_path)
kill_salome(args)
# --
setenv.set_env(args, modules_list, modules_root_dir, keepEnvironment=keep_env)
- useSalome(args, modules_list, modules_root_dir)
- return args
+ ior_fakens_filename = useSalome(args, modules_list, modules_root_dir)
+ return args, ior_fakens_filename
# -----------------------------------------------------------------------------
-def foreGround(args):
+def foreGround(args, ior_fakens_filename):
# --
- if "session_object" not in args:
+ if ior_fakens_filename is None:
+ return
+ if not os.path.exists(ior_fakens_filename):
return
- session = args["session_object"]
+ import CORBA
+ import Engines
+ orb = CORBA.ORB_init([''], CORBA.ORB_ID)
+ ior_fakens = None
+ try:
+ ior_fakens = orb.string_to_object(open(ior_fakens_filename).read())
+ except Exception:
+ pass
+ session = orb.string_to_object(ior_fakens.Resolve("/Kernel/Session").decode())
# --
# Wait until gui is arrived
# tmax = nbtot * dt
#
def runSalome():
- args = main()
+ args, ior_fakens_filename = main()
# --
test = args['gui'] and args['session_gui']
test = test or args['wake_up_session']
if test:
from time import sleep
sleep(3.0)
- foreGround(args)
+ foreGround(args, ior_fakens_filename)
pass
pass
#
import KernelBasis
KernelBasis.setSSLMode(False)
-def salome_init(path=None, embedded=False):
+def salome_init(path=None, embedded=False, iorfakensfile=None):
+ """
+ :param iorfakensfile: filename inside which IOR of fake NS will be written
+ """
import KernelBasis
if KernelBasis.getSSLMode():
if KernelBasis.getIOROfEmbeddedNS() == "":
- salome_init_without_session(path, embedded)
+ salome_init_without_session(path, embedded, iorfakensfile)
else:
salome_init_without_session_attached(path, embedded)
else:
from NamingService import NamingService
naming_service = NamingService()
-def salome_init_without_session(path=None, embedded=False):
+def salome_init_without_session(path=None, embedded=False, iorfakensfile=None):
salome_init_without_session_common(path,embedded)
global lcc,cm,dsm,esm
import KernelLauncher
#
import KernelLogger
naming_service.Register(KernelLogger.myLogger(),"/Logger")
+ #
+ from NamingService import NamingService
+ if iorfakensfile is not None:
+ with open(iorfakensfile,"w") as iorfakensf:
+ iorfakensf.write(NamingService.IOROfNS())
def salome_init_without_session_attached(path=None, embedded=False):
"""