Salome HOME
[EDF30062] [EDF29150]: Additional fault tolerant mecanism
[modules/kernel.git] / src / Basics / KernelBasis.cxx
index db29c9d87f055eb6a4390096f79c9afef12e6891..c236f00206bd1da8866d2dce09878906b761435d 100644 (file)
@@ -81,6 +81,10 @@ namespace SALOME
   static constexpr char OUT_OF_PROCESS_NO_REPLAY_VALUE_STR[] = "OutOfProcessNoReplay";
   static constexpr char OUT_OF_PROCESS_WITH_REPLAY_VALUE = 2;
   static constexpr char OUT_OF_PROCESS_WITH_REPLAY_VALUE_STR[] = "OutOfProcessWithReplay";
+  static constexpr char OUT_OF_PROCESS_NO_REPLAY_FT_VALUE = 3;
+  static constexpr char OUT_OF_PROCESS_NO_REPLAY_FT_VALUE_STR[] = "OutOfProcessNoReplayFT";
+  static constexpr char OUT_OF_PROCESS_WITH_REPLAY_FT_VALUE = 4;
+  static constexpr char OUT_OF_PROCESS_WITH_REPLAY_FT_VALUE_STR[] = "OutOfProcessWithReplayFT";
 
   static PyExecutionMode FromIntToPyExecutionMode(char value)
   {
@@ -92,6 +96,10 @@ namespace SALOME
         return PyExecutionMode::OutOfProcessNoReplay;
       case OUT_OF_PROCESS_WITH_REPLAY_VALUE:
         return PyExecutionMode::OutOfProcessWithReplay;
+      case OUT_OF_PROCESS_NO_REPLAY_FT_VALUE:
+        return PyExecutionMode::OutOfProcessNoReplayFT;
+      case OUT_OF_PROCESS_WITH_REPLAY_FT_VALUE:
+        return PyExecutionMode::OutOfProcessWithReplayFT;
     }
     throw std::range_error("FromIntToPyExecutionMode : Invalid value for Py Execution Mode ! Must be in 0 (InProcess), 1 (OutOfProcessNoReplay) or 2 (OutOfProcessWithReplay) !");
   }
@@ -104,6 +112,10 @@ namespace SALOME
       return PyExecutionMode::OutOfProcessNoReplay;
     if(value == OUT_OF_PROCESS_WITH_REPLAY_VALUE_STR)
       return PyExecutionMode::OutOfProcessWithReplay;
+    if(value == OUT_OF_PROCESS_NO_REPLAY_FT_VALUE_STR)
+      return PyExecutionMode::OutOfProcessNoReplayFT;
+    if(value == OUT_OF_PROCESS_WITH_REPLAY_FT_VALUE_STR)
+      return PyExecutionMode::OutOfProcessWithReplayFT;
     throw std::range_error("FromStrToPyExecutionMode : Invalid str value for py execution mode !");
   }
 
@@ -117,12 +129,61 @@ namespace SALOME
         return OUT_OF_PROCESS_NO_REPLAY_VALUE_STR;
       case PyExecutionMode::OutOfProcessWithReplay:
         return OUT_OF_PROCESS_WITH_REPLAY_VALUE_STR;
+      case PyExecutionMode::OutOfProcessNoReplayFT:
+        return OUT_OF_PROCESS_NO_REPLAY_FT_VALUE_STR;
+      case PyExecutionMode::OutOfProcessWithReplayFT:
+        return OUT_OF_PROCESS_WITH_REPLAY_FT_VALUE_STR;
       default:
         throw std::range_error("FromExecutionModeToStr : Invalid str value for py execution mode !");
     }
   }
 }
 
+constexpr int SALOME_BIG_OBJ_ON_DISK_THRES_DFT = 50000000;
+
+static int SALOME_BIG_OBJ_ON_DISK_THRES = SALOME_BIG_OBJ_ON_DISK_THRES_DFT;
+
+int SALOME::GetBigObjOnDiskThreshold()
+{
+  return SALOME_BIG_OBJ_ON_DISK_THRES;
+}
+
+void SALOME::SetBigObjOnDiskThreshold(int newThresholdInByte)
+{
+  SALOME_BIG_OBJ_ON_DISK_THRES = newThresholdInByte;
+}
+
+static std::string SALOME_FILE_BIG_OBJ_DIR;
+
+constexpr int DFT_SALOME_NB_RETRY = 1;
+
+static int SALOME_NB_RETRY = DFT_SALOME_NB_RETRY;
+
+std::string SALOME::GetBigObjOnDiskDirectory()
+{
+  return SALOME_FILE_BIG_OBJ_DIR;
+}
+
+void SALOME::SetBigObjOnDiskDirectory(const std::string& directory)
+{
+  SALOME_FILE_BIG_OBJ_DIR = directory;
+}
+
+bool SALOME::BigObjOnDiskDirectoryDefined()
+{
+  return ! SALOME_FILE_BIG_OBJ_DIR.empty();
+}
+
+void SALOME::SetNumberOfRetry(int nbRetry)
+{
+  SALOME_NB_RETRY = nbRetry;
+}
+
+int SALOME::GetNumberOfRetry()
+{
+  return SALOME_NB_RETRY;
+}
+
 static SALOME::PyExecutionMode DefaultPyExecMode = SALOME::PyExecutionMode::NotSet;
 
 void SALOME::SetPyExecutionMode(PyExecutionMode mode)