From ae4a2636b071d1947af9b30956b6123e907e5498 Mon Sep 17 00:00:00 2001 From: Ovidiu Mircescu Date: Mon, 12 Jul 2021 14:36:50 +0200 Subject: [PATCH] ResourcesManager in sessionless mode. --- src/KERNEL_PY/__init__.py | 12 +++++++++++- src/Launcher/KernelLauncher.cxx | 11 +++++++++++ src/Launcher/KernelLauncher.hxx | 1 + src/Launcher/KernelLauncher.i | 7 +++++++ 4 files changed, 30 insertions(+), 1 deletion(-) diff --git a/src/KERNEL_PY/__init__.py b/src/KERNEL_PY/__init__.py index cbe51e8e0..8a62c4a42 100644 --- a/src/KERNEL_PY/__init__.py +++ b/src/KERNEL_PY/__init__.py @@ -184,6 +184,10 @@ def salome_init(path=None, embedded=False): salome_init_with_session(path, embedded) class StandAloneLifecyle: + def __init__(self, containerManager, resourcesManager): + self._cm = containerManager + self._rm = resourcesManager + def FindOrLoadComponent(self,contName,moduleName): global orb import importlib @@ -193,9 +197,14 @@ class StandAloneLifecyle: return result #raise RuntimeError("Undealed situation cont = {} module = {}".format(contName,moduleName)) + def getContainerManager(self): + return self._cm + + def getResourcesManager(self): + return self._rm + def salome_init_without_session(): global lcc,myStudy,orb,modulcat,sg,cm - lcc = StandAloneLifecyle() import KernelBasis KernelBasis.setSSLMode(True) import KernelDS @@ -208,6 +217,7 @@ def salome_init_without_session(): modulcat = KernelModuleCatalog.myModuleCatalog( list_of_catalogs_regarding_environement() ) import KernelLauncher cm = KernelLauncher.myContainerManager() + lcc = StandAloneLifecyle(cm, KernelLauncher.myResourcesManager()) # activate poaManager to accept co-localized CORBA calls. poa = orb.resolve_initial_references("RootPOA") poaManager = poa._get_the_POAManager() diff --git a/src/Launcher/KernelLauncher.cxx b/src/Launcher/KernelLauncher.cxx index 05213a884..5eaaae9f9 100644 --- a/src/Launcher/KernelLauncher.cxx +++ b/src/Launcher/KernelLauncher.cxx @@ -23,6 +23,7 @@ #include "SALOME_ContainerManager.hxx" #include "SALOME_Fake_NamingService.hxx" #include "SALOME_KernelServices.hxx" +#include "SALOME_ResourcesManager.hxx" #include @@ -35,3 +36,13 @@ std::string GetContainerManagerInstance() CORBA::String_var ior = orb->object_to_string(cm); return std::string(ior.in()); } + +std::string GetResourcesManagerInstance() +{ + SALOME_Launcher *launcher = KERNEL::getLauncherSA(); + SALOME_Fake_NamingService ns; + CORBA::Object_var cm = ns.Resolve(SALOME_ResourcesManager::_ResourcesManagerNameInNS); + CORBA::ORB_ptr orb = KERNEL::getORB(); + CORBA::String_var ior = orb->object_to_string(cm); + return std::string(ior.in()); +} diff --git a/src/Launcher/KernelLauncher.hxx b/src/Launcher/KernelLauncher.hxx index 378843b99..567f5e581 100644 --- a/src/Launcher/KernelLauncher.hxx +++ b/src/Launcher/KernelLauncher.hxx @@ -22,3 +22,4 @@ #include std::string GetContainerManagerInstance(); +std::string GetResourcesManagerInstance(); diff --git a/src/Launcher/KernelLauncher.i b/src/Launcher/KernelLauncher.i index 013758ca5..d67ef54f5 100644 --- a/src/Launcher/KernelLauncher.i +++ b/src/Launcher/KernelLauncher.i @@ -28,6 +28,7 @@ %inline { std::string GetContainerManagerInstance(); + std::string GetResourcesManagerInstance(); } %pythoncode %{ @@ -36,4 +37,10 @@ def myContainerManager(): import CORBA orb=CORBA.ORB_init(['']) return orb.string_to_object(GetContainerManagerInstance()) + +def myResourcesManager(): + import Engines + import CORBA + orb=CORBA.ORB_init(['']) + return orb.string_to_object(GetResourcesManagerInstance()) %} -- 2.39.2