]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
[EDF29852] : first successful launch of out of process sever. my_log_4_this_session...
authorAnthony Geay <anthony.geay@edf.fr>
Tue, 26 Mar 2024 08:35:22 +0000 (09:35 +0100)
committerAnthony Geay <anthony.geay@edf.fr>
Tue, 26 Mar 2024 08:35:22 +0000 (09:35 +0100)
src/Basics/KernelBasis.cxx
src/Basics/KernelBasis.hxx
src/Container/CMakeLists.txt
src/Container/SALOME_Container.py
src/Container/SALOME_ContainerManager.cxx
src/Container/SALOME_ContainerManager.hxx
src/Container/SALOME_Container_No_NS_Serv.cxx
src/Container/SALOME_Container_No_NS_Serv_Generic.hxx [new file with mode: 0644]
src/Container/SALOME_Container_No_NS_Serv_OutProcess.cxx [new file with mode: 0644]
src/Container/SALOME_Container_No_NS_Serv_OutProcess_Replay.cxx [new file with mode: 0644]

index 86a38745b0d0c6478863579990fdaad45677c79e..db29c9d87f055eb6a4390096f79c9afef12e6891 100644 (file)
@@ -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;
index 76d25e8923a6dce6ad643f8b49593fbca89802ff..4a42e4257860ab97f957ba38c2efdfc2fbb4230b 100644 (file)
@@ -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<std::string> BASICS_EXPORT GetAllPyExecutionModes();
index e05955add5b01642b69693588d153ef15956a5f3..4eb507ecca731a536b265ff07cc033e0c298029f 100644 (file)
@@ -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})
index 71cc038d6b6b0a604be157f3c141741f8be7f5df..0dc535d39a79bd0ac6ae0cd221b6cc10f9c8b838 100644 (file)
@@ -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
index 20776769ff1c79d0948900fa69bb1a212011eca8..232f47eb1ebe0e07458347a02574b40b029090ed 100644 (file)
@@ -31,6 +31,7 @@
 #include "Basics_Utils.hxx"
 #include "Basics_DirUtils.hxx"
 #include "PythonCppUtils.hxx"
+#include "KernelBasis.hxx"
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <signal.h>
@@ -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;
 }
 
index 330d3ed7c1274a04cb8b8b41e1c394a598004ae1..1ca71fef20e05304953db68a02e76451fc3a5b9b 100644 (file)
@@ -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;
index 2494313d9c86c3ee7cb3e012c3b5d806ddfb6859..f7df00250ab731d6820e0ceb2133804f4237f62c 100644 (file)
 // 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 <containerName> <IOR of Engines::EmbeddedNamingService>" );
-  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<SALOME_NamingService_Container_Abstract> ns( new SALOME_Embedded_NamingService_Client(ns_serv_obj) );
-  return container_common_main<Engines_Container_SSL_i>(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 (file)
index 0000000..d5bc1e7
--- /dev/null
@@ -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 <containerName> <IOR of Engines::EmbeddedNamingService>" );        \
+  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<SALOME_NamingService_Container_Abstract> ns( new SALOME_Embedded_NamingService_Client(ns_serv_obj) );                                  \
+  return container_common_main<cls>(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 (file)
index 0000000..f535d07
--- /dev/null
@@ -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 (file)
index 0000000..27a90f5
--- /dev/null
@@ -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 )