From: Anthony Geay Date: Tue, 26 Mar 2024 08:35:22 +0000 (+0100) Subject: [EDF29852] : first successful launch of out of process sever. my_log_4_this_session... X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=6287d4be648abf1fc820fbfd4c3cc8ba5422436b;p=modules%2Fkernel.git [EDF29852] : first successful launch of out of process sever. my_log_4_this_session and my_container are still missing --- diff --git a/src/Basics/KernelBasis.cxx b/src/Basics/KernelBasis.cxx index 86a38745b..db29c9d87 100644 --- a/src/Basics/KernelBasis.cxx +++ b/src/Basics/KernelBasis.cxx @@ -75,8 +75,6 @@ void WriteInStderr(const std::string& msg) namespace SALOME { - enum class PyExecutionMode { NotSet, InProcess, OutOfProcessNoReplay, OutOfProcessWithReplay }; - static constexpr char IN_PROCESS_VALUE = 0; static constexpr char IN_PROCESS_VALUE_STR[] = "InProcess"; static constexpr char OUT_OF_PROCESS_NO_REPLAY_VALUE = 1; diff --git a/src/Basics/KernelBasis.hxx b/src/Basics/KernelBasis.hxx index 76d25e892..4a42e4257 100644 --- a/src/Basics/KernelBasis.hxx +++ b/src/Basics/KernelBasis.hxx @@ -37,7 +37,7 @@ void BASICS_EXPORT WriteInStderr(const std::string& msg); namespace SALOME { - enum class PyExecutionMode; + enum class PyExecutionMode { NotSet, InProcess, OutOfProcessNoReplay, OutOfProcessWithReplay }; void BASICS_EXPORT SetPyExecutionMode(PyExecutionMode mode); void BASICS_EXPORT SetPyExecutionModeStr(const std::string& mode); std::vector BASICS_EXPORT GetAllPyExecutionModes(); diff --git a/src/Container/CMakeLists.txt b/src/Container/CMakeLists.txt index e05955add..4eb507ecc 100644 --- a/src/Container/CMakeLists.txt +++ b/src/Container/CMakeLists.txt @@ -113,11 +113,17 @@ TARGET_LINK_LIBRARIES(SALOME_Container SalomeContainerServer) ADD_EXECUTABLE(SALOME_Container_No_NS_Serv SALOME_Container_No_NS_Serv.cxx) TARGET_LINK_LIBRARIES(SALOME_Container_No_NS_Serv SalomeContainerServer) +ADD_EXECUTABLE(SALOME_Container_No_NS_Serv_OutProcess SALOME_Container_No_NS_Serv_OutProcess.cxx) +TARGET_LINK_LIBRARIES(SALOME_Container_No_NS_Serv_OutProcess SalomeContainerServer) + +ADD_EXECUTABLE(SALOME_Container_No_NS_Serv_OutProcess_Replay SALOME_Container_No_NS_Serv_OutProcess_Replay.cxx) +TARGET_LINK_LIBRARIES(SALOME_Container_No_NS_Serv_OutProcess_Replay SalomeContainerServer) + IF(SALOME_BUILD_TESTS) ADD_EXECUTABLE(TestSalome_file TestSalome_file.cxx) TARGET_LINK_LIBRARIES(TestSalome_file SALOMETraceCollectorTest ${SALOME_Container_LIBS}) ENDIF() -INSTALL(TARGETS SALOME_Container SALOME_Container_No_NS_Serv DESTINATION ${SALOME_INSTALL_BINS}) +INSTALL(TARGETS SALOME_Container SALOME_Container_No_NS_Serv SALOME_Container_No_NS_Serv_OutProcess SALOME_Container_No_NS_Serv_OutProcess_Replay DESTINATION ${SALOME_INSTALL_BINS}) # Executable scripts to be installed SALOME_INSTALL_SCRIPTS("${SCRIPTS}" ${SALOME_INSTALL_SCRIPT_PYTHON}) diff --git a/src/Container/SALOME_Container.py b/src/Container/SALOME_Container.py index 71cc038d6..0dc535d39 100644 --- a/src/Container/SALOME_Container.py +++ b/src/Container/SALOME_Container.py @@ -223,4 +223,4 @@ class SALOME_Container_OutOfProcess_Replay_i(SALOME_Container_i): super().__init__(containerName, containerIORStr, dftTimeIntervalInMs) def getPyScriptCls(self): - return SALOME_PyNode.PyScriptNode_i + return SALOME_PyNode.PyScriptNode_OutOfProcess_Replay_i diff --git a/src/Container/SALOME_ContainerManager.cxx b/src/Container/SALOME_ContainerManager.cxx index 20776769f..232f47eb1 100644 --- a/src/Container/SALOME_ContainerManager.cxx +++ b/src/Container/SALOME_ContainerManager.cxx @@ -31,6 +31,7 @@ #include "Basics_Utils.hxx" #include "Basics_DirUtils.hxx" #include "PythonCppUtils.hxx" +#include "KernelBasis.hxx" #include #include #include @@ -558,9 +559,27 @@ Engines::Container_ptr SALOME_ContainerManager::GiveContainer(const Engines::Con return ret; } +std::string SALOME_ContainerManager::GetCppBinaryOfKernelSSLContainer() const +{ + switch( SALOME::GetPyExecutionMode() ) + { + case SALOME::PyExecutionMode::InProcess: + return "SALOME_Container_No_NS_Serv"; + case SALOME::PyExecutionMode::OutOfProcessNoReplay: + return "SALOME_Container_No_NS_Serv_OutProcess"; + case SALOME::PyExecutionMode::OutOfProcessWithReplay: + return "SALOME_Container_No_NS_Serv_OutProcess_Replay"; + default: + { + ERROR_MESSAGE("Not manager py execution mode"); + THROW_SALOME_EXCEPTION("GetCppBinaryOfKernelSSLContainer : Not manager py execution mode"); + } + } +} + std::string SALOME_ContainerManager::GetCppBinaryOfKernelContainer() const { - std::string ret = this->_isSSL ? "SALOME_Container_No_NS_Serv" : "SALOME_Container"; + std::string ret = this->_isSSL ? GetCppBinaryOfKernelSSLContainer() : "SALOME_Container"; return ret; } diff --git a/src/Container/SALOME_ContainerManager.hxx b/src/Container/SALOME_ContainerManager.hxx index 330d3ed7c..1ca71fef2 100644 --- a/src/Container/SALOME_ContainerManager.hxx +++ b/src/Container/SALOME_ContainerManager.hxx @@ -94,6 +94,8 @@ protected: FindContainer(const Engines::ContainerParameters& params, const std::string& resource); + std::string GetCppBinaryOfKernelSSLContainer() const; + std::string GetCppBinaryOfKernelContainer() const; std::string GetRunRemoteExecutableScript() const; diff --git a/src/Container/SALOME_Container_No_NS_Serv.cxx b/src/Container/SALOME_Container_No_NS_Serv.cxx index 2494313d9..f7df00250 100644 --- a/src/Container/SALOME_Container_No_NS_Serv.cxx +++ b/src/Container/SALOME_Container_No_NS_Serv.cxx @@ -17,26 +17,6 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -#include "SALOME_Container_Common.cxx" -#include "SALOME_Container_i.hxx" -#include "SALOME_Embedded_NamingService_Client.hxx" -#include "Utils_SALOME_Exception.hxx" -#include "SALOME_KernelORB.hxx" -#include "KernelBasis.hxx" +#include "SALOME_Container_No_NS_Serv_Generic.hxx" -int main(int argc, char* argv[]) -{ - if(argc<3) - THROW_SALOME_EXCEPTION( "SALOME_Container_No_NS_Serv : requires 2 input arguments " ); - CORBA::ORB_ptr orb(KERNEL::getORB()); - std::string IOROfEmbeddedNamingService(argv[2]); - setIOROfEmbeddedNS(IOROfEmbeddedNamingService); - CORBA::Object_var ns_serv_obj_base = orb->string_to_object(IOROfEmbeddedNamingService.c_str()); - if( CORBA::is_nil(ns_serv_obj_base) ) - THROW_SALOME_EXCEPTION( "SALOME_Container_No_NS_Serv : argument 2 is NOT a valid IOR" ); - Engines::EmbeddedNamingService_var ns_serv_obj = Engines::EmbeddedNamingService::_narrow(ns_serv_obj_base); - if( CORBA::is_nil(ns_serv_obj) ) - THROW_SALOME_EXCEPTION( "SALOME_Container_No_NS_Serv : argument 2 is NOT a valid IOR of Engines::EmbeddedNamingService" ); - std::unique_ptr ns( new SALOME_Embedded_NamingService_Client(ns_serv_obj) ); - return container_common_main(argc,argv,std::move(ns)); -} +GENERIC_CONTAINER_EXECUTABLE( Engines_Container_SSL_i ) diff --git a/src/Container/SALOME_Container_No_NS_Serv_Generic.hxx b/src/Container/SALOME_Container_No_NS_Serv_Generic.hxx new file mode 100644 index 000000000..d5bc1e7f6 --- /dev/null +++ b/src/Container/SALOME_Container_No_NS_Serv_Generic.hxx @@ -0,0 +1,43 @@ +// Copyright (C) 2021-2024 CEA, EDF +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include "SALOME_Container_Common.cxx" +#include "SALOME_Container_i.hxx" +#include "SALOME_Embedded_NamingService_Client.hxx" +#include "Utils_SALOME_Exception.hxx" +#include "SALOME_KernelORB.hxx" +#include "KernelBasis.hxx" + +#define GENERIC_CONTAINER_EXECUTABLE( cls ) \ +int main(int argc, char* argv[]) \ +{ \ + if(argc<3) \ + THROW_SALOME_EXCEPTION( "SALOME_Container_No_NS_Serv : requires 2 input arguments " ); \ + CORBA::ORB_ptr orb(KERNEL::getORB()); \ + std::string IOROfEmbeddedNamingService(argv[2]); \ + setIOROfEmbeddedNS(IOROfEmbeddedNamingService); \ + CORBA::Object_var ns_serv_obj_base = orb->string_to_object(IOROfEmbeddedNamingService.c_str()); \ + if( CORBA::is_nil(ns_serv_obj_base) ) \ + THROW_SALOME_EXCEPTION( "SALOME_Container_No_NS_Serv : argument 2 is NOT a valid IOR" ); \ + Engines::EmbeddedNamingService_var ns_serv_obj = Engines::EmbeddedNamingService::_narrow(ns_serv_obj_base); \ + if( CORBA::is_nil(ns_serv_obj) ) \ + THROW_SALOME_EXCEPTION( "SALOME_Container_No_NS_Serv : argument 2 is NOT a valid IOR of Engines::EmbeddedNamingService" ); \ + std::unique_ptr ns( new SALOME_Embedded_NamingService_Client(ns_serv_obj) ); \ + return container_common_main(argc,argv,std::move(ns)); \ +} diff --git a/src/Container/SALOME_Container_No_NS_Serv_OutProcess.cxx b/src/Container/SALOME_Container_No_NS_Serv_OutProcess.cxx new file mode 100644 index 000000000..f535d073a --- /dev/null +++ b/src/Container/SALOME_Container_No_NS_Serv_OutProcess.cxx @@ -0,0 +1,22 @@ +// Copyright (C) 2021-2024 CEA, EDF +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include "SALOME_Container_No_NS_Serv_Generic.hxx" + +GENERIC_CONTAINER_EXECUTABLE( Engines_Container_SSL_OutOfProcess_i ) diff --git a/src/Container/SALOME_Container_No_NS_Serv_OutProcess_Replay.cxx b/src/Container/SALOME_Container_No_NS_Serv_OutProcess_Replay.cxx new file mode 100644 index 000000000..27a90f58e --- /dev/null +++ b/src/Container/SALOME_Container_No_NS_Serv_OutProcess_Replay.cxx @@ -0,0 +1,22 @@ +// Copyright (C) 2021-2024 CEA, EDF +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include "SALOME_Container_No_NS_Serv_Generic.hxx" + +GENERIC_CONTAINER_EXECUTABLE( Engines_Container_SSL_OutOfProcess_Replay_i )