From 8c8513d3f2c6769380f5d0a99ee9865bf5bf5747 Mon Sep 17 00:00:00 2001 From: Anthony Geay Date: Mon, 26 Feb 2024 11:32:39 +0100 Subject: [PATCH] [EDF29576] : WIP --- src/Container/Container_i.cxx | 19 +++++++++++++------ src/KERNEL_PY/__init__.py | 11 ++++++----- src/NamingService/NamingService.i | 9 +++++++++ 3 files changed, 28 insertions(+), 11 deletions(-) diff --git a/src/Container/Container_i.cxx b/src/Container/Container_i.cxx index 872e161ab..547ce7f40 100644 --- a/src/Container/Container_i.cxx +++ b/src/Container/Container_i.cxx @@ -734,7 +734,7 @@ void Abstract_Engines_Container_i::Shutdown() } } _listInstances_map.clear(); - + MESSAGE("Engines_Container_i::Shutdown() -- step 2"); // NS unregistering may throw in SSL mode if master process hosting SALOME_Embedded_NamingService servant has vanished // In this case it's skip it and still continue. try @@ -745,13 +745,20 @@ void Abstract_Engines_Container_i::Shutdown() catch(...) { } - // - this->cleanAllPyScripts(); - // + MESSAGE("Engines_Container_i::Shutdown() -- step 3"); + try + { + this->cleanAllPyScripts(); + // + { + AutoGIL gstate; + AutoPyRef result = PyObject_CallMethod(_pyCont, (char*)"shutdownPy", (char*)"",nullptr); + } + } + catch(...) { - AutoGIL gstate; - AutoPyRef result = PyObject_CallMethod(_pyCont, (char*)"shutdownPy", (char*)"",nullptr); } + MESSAGE("Engines_Container_i::Shutdown() -- step 4"); // if(_isServantAloneInProcess) { diff --git a/src/KERNEL_PY/__init__.py b/src/KERNEL_PY/__init__.py index 4446fdb60..8e9e92b45 100644 --- a/src/KERNEL_PY/__init__.py +++ b/src/KERNEL_PY/__init__.py @@ -283,6 +283,12 @@ def salome_init_without_session(path=None, embedded=False, iorfakensfile=None): with open(iorfakensfile,"w") as iorfakensf: iorfakensf.write(NamingService.IOROfNS()) +CM_NAME_IN_NS = "/ContainerManager" +RM_NAME_IN_NS = "/ResourcesManager" +DSM_NAME_IN_NS = "/DataServerManager" +ESM_NAME_IN_NS = "/ExternalServers" +LOGM_NAME_IN_NS = "/LogManager" + def salome_init_without_session_attached(path=None, embedded=False): """ Configuration SSL inside a python interpretor launched in the SALOME_Container_No_NS_Serv. @@ -297,25 +303,20 @@ def salome_init_without_session_attached(path=None, embedded=False): import KernelBasis nsAbroad = orb.string_to_object( KernelBasis.getIOROfEmbeddedNS() ) import SALOME - CM_NAME_IN_NS = "/ContainerManager" cm = orb.string_to_object( nsAbroad.Resolve(CM_NAME_IN_NS).decode() ) type(cm).SetOverrideEnvForContainersSimple = ContainerManagerSetOverrideEnvForContainersSimple naming_service.Register(cm,CM_NAME_IN_NS) - RM_NAME_IN_NS = "/ResourcesManager" rm = orb.string_to_object( nsAbroad.Resolve(RM_NAME_IN_NS).decode() ) naming_service.Register(rm,RM_NAME_IN_NS) # from LifeCycleCORBA import LifeCycleCORBASSL lcc = LifeCycleCORBASSL() - DSM_NAME_IN_NS = "/DataServerManager" dsm = orb.string_to_object( nsAbroad.Resolve(DSM_NAME_IN_NS).decode() ) naming_service.Register(dsm,DSM_NAME_IN_NS) # - ESM_NAME_IN_NS = "/ExternalServers" esm = orb.string_to_object( nsAbroad.Resolve(ESM_NAME_IN_NS).decode() ) naming_service.Register(esm,ESM_NAME_IN_NS) # - LOGM_NAME_IN_NS = "/LogManager" logm = orb.string_to_object( nsAbroad.Resolve(LOGM_NAME_IN_NS).decode() ) naming_service.Register(logm,LOGM_NAME_IN_NS) diff --git a/src/NamingService/NamingService.i b/src/NamingService/NamingService.i index f63aba017..308588a3f 100644 --- a/src/NamingService/NamingService.i +++ b/src/NamingService/NamingService.i @@ -141,6 +141,15 @@ def NamingService_DumpIORInFile(cls,iorFileName): with open( iorFileName, "w" ) as f: f.write( cls.IOROfNS() ) NamingService.DumpIORInFile = classmethod(NamingService_DumpIORInFile) +def NamingService_LoadIORInFile(cls,iorFileName): + import Engines + import CORBA + orb=CORBA.ORB_init(['']) + with open( iorFileName ) as f: + ior = f.read() + ref = orb.string_to_object(ior) + return ref +NamingService.LoadIORInFile = classmethod( NamingService_LoadIORInFile ) def NamingService_KillContainersInFile(cls,logFileName): import Engines import CORBA -- 2.39.2