]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
[EDF30399] : Steer directory hosting replay files
authorAnthony Geay <anthony.geay@edf.fr>
Fri, 21 Jun 2024 07:30:13 +0000 (09:30 +0200)
committerAnthony Geay <anthony.geay@edf.fr>
Fri, 21 Jun 2024 07:30:13 +0000 (09:30 +0200)
idl/SALOME_Component.idl
idl/SALOME_ContainerManager.idl
src/Basics/KernelBasis.cxx
src/Basics/KernelBasis.hxx
src/Basics/KernelBasis.i
src/Container/Container_i.cxx
src/Container/SALOME_ContainerManager.cxx
src/Container/SALOME_ContainerManager.hxx
src/Container/SALOME_Container_i.hxx
src/Container/SALOME_PyNode.py
src/Launcher/Test/testCrashProofContainer.py

index 8911badd941d26a40adb3a86bc9b4972b20d68c7..e73f0b9bc29280ffdcd6abea5e987a979a396b90 100644 (file)
@@ -89,6 +89,8 @@ module Engines
     void set_big_obj_on_disk_threshold(in long thresholdInByte);
 
     void set_big_obj_on_disk_directory(in string directory);
+
+    void set_directory_for_replay_files(in string directory);
     
     void set_number_of_retry(in long nbRetry);
 
index 110c5b41988e8dc0d7b6fb32cdc0282434d711ff..49ff215019e279b291b1ed5ce5ddd5807da4e535 100644 (file)
@@ -112,6 +112,8 @@ interface ContainerManager
 
   void SetBigObjOnDiskDirectory(in string directory);
 
+  void SetDirectoryForReplayFiles(in string directory);
+
   void SetNumberOfRetry(in long nbRetry);
 
   long GetNumberOfRetry();
index d06fe8365106a3090cc3d41fca0d50df7750a95e..ed6837dc80a49f81387163fb96a0ea3fd07a43bf 100644 (file)
@@ -146,6 +146,8 @@ 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;
 
+std::string SALOME_REPLAY_FILES_DIR;
+
 int SALOME::GetBigObjOnDiskThreshold()
 {
   return SALOME_BIG_OBJ_ON_DISK_THRES;
@@ -227,6 +229,16 @@ std::string SALOME::GetBigObjOnDiskDirectoryCoarse()
   return SALOME_FILE_BIG_OBJ_DIR;
 }
 
+std::string SALOME::GetDirectoryForReplayFiles()
+{
+  return SALOME_REPLAY_FILES_DIR;
+}
+
+void SALOME::SetDirectoryForReplayFiles(const std::string& directory)
+{
+  SALOME_REPLAY_FILES_DIR = directory;
+}
+
 void SALOME::SetBigObjOnDiskDirectory(const std::string& directory)
 {
   SALOME_FILE_BIG_OBJ_DIR = directory;
index 360efc37592b66ecd5efc4c472428f272696d3b3..121bf978cb966bde68e72d4814aa09b38f1626c7 100644 (file)
@@ -52,6 +52,8 @@ namespace SALOME
   std::vector<std::string> BASICS_EXPORT GetAllPyExecutionModes();
   std::string BASICS_EXPORT GetPyExecutionModeStr();
   PyExecutionMode BASICS_EXPORT GetPyExecutionMode();
+  std::string BASICS_EXPORT GetDirectoryForReplayFiles();
+  void BASICS_EXPORT SetDirectoryForReplayFiles(const std::string& directory);
   int BASICS_EXPORT GetBigObjOnDiskThreshold();
   void BASICS_EXPORT SetBigObjOnDiskThreshold(int newThresholdInByte);
   std::string BASICS_EXPORT BigObjOnDiskProtocolToStr(BigObjTransferProtocol protocol);
index 3f2ed7dab7bdd57a12676b35ff84fa6bd2547098..8b6ae421e206c4e3cad7f20ac46ab4b9945945aa 100644 (file)
@@ -58,6 +58,8 @@ using namespace SALOME;
 %rename (BigObjOnDiskProtocolToStr) BigObjOnDiskProtocolToStrSwig;
 %rename (SetBigObjOnDiskDirectory) SetBigObjOnDiskDirectorySwig;
 %rename (BigObjOnDiskDirectoryDefined) BigObjOnDiskDirectoryDefinedSwig;
+%rename (GetDirectoryForReplayFiles) GetDirectoryForReplayFilesSwig;
+%rename (SetDirectoryForReplayFiles) SetDirectoryForReplayFilesSwig;
 %rename (SetNumberOfRetry) SetNumberOfRetrySwig;
 %rename (GetNumberOfRetry) GetNumberOfRetrySwig;
 
@@ -151,6 +153,16 @@ int GetNumberOfRetrySwig()
   return SALOME::GetNumberOfRetry( );
 }
 
+std::string GetDirectoryForReplayFilesSwig()
+{
+  return SALOME::GetDirectoryForReplayFiles();
+}
+
+void SetDirectoryForReplayFilesSwig(const std::string& directory)
+{
+  SALOME::SetDirectoryForReplayFiles(directory);
+}
+
 std::string BigObjOnDiskProtocolToStrSwig( int protocol )
 {
   return SALOME::BigObjOnDiskProtocolToStr( SALOME::FromIntToBigObjOnDiskProtocol( protocol ) );
index 4841ee2a0581cc24aaf27c635000bbf7b4f478c0..173633db4c6cd265f065e7fa412928d616be6ca2 100644 (file)
@@ -1185,6 +1185,11 @@ void Abstract_Engines_Container_i::set_number_of_retry(CORBA::Long nbRetry)
   SALOME::SetNumberOfRetry( nbRetry );
 }
 
+void Abstract_Engines_Container_i::set_directory_for_replay_files(const char *directory)
+{
+  SALOME::SetDirectoryForReplayFiles( directory );
+}
+
 void Abstract_Engines_Container_i::set_startup_code(const char *codeAtStartUp)
 {
   _code_at_startup = codeAtStartUp;
index 8a322b92d1eb4ee44b49cae483b0e681a7e368ae..688358c1e023efd9e5697d974cdcea9da507b642 100644 (file)
@@ -246,6 +246,11 @@ void SALOME_ContainerManager::SetBigObjOnDiskDirectory(const char *directory)
   SALOME::SetBigObjOnDiskDirectory(directory);
 }
 
+void SALOME_ContainerManager::SetDirectoryForReplayFiles(const char *directory)
+{
+  SALOME::SetDirectoryForReplayFiles( directory );
+}
+
  void SALOME_ContainerManager::SetNumberOfRetry(CORBA::Long nbRetry)
  {
     SALOME::SetNumberOfRetry( nbRetry );
@@ -551,6 +556,7 @@ Engines::Container_ptr SALOME_ContainerManager::GiveContainer(const Engines::Con
         INFOS("[GiveContainer] container " << containerNameInNS << " override " << envInfo.str());
         cont->set_big_obj_on_disk_directory( SALOME::GetBigObjOnDiskDirectoryCoarse().c_str() );
         cont->set_big_obj_on_disk_threshold( SALOME::GetBigObjOnDiskThreshold() );
+        cont->set_directory_for_replay_files( SALOME::GetDirectoryForReplayFiles().c_str() );
         cont->set_number_of_retry( SALOME::GetNumberOfRetry() );
         Engines::FieldsDict envCorba;
         {
index a02bd92587fb00eb25be733ab2182662e43d331f..1fa3fa3ce1499a2df2c520e5b6ab66e0de3086ca 100644 (file)
@@ -83,6 +83,8 @@ public:
 
   void SetBigObjOnDiskDirectory(const char *directory) override;
 
+  void SetDirectoryForReplayFiles(const char *directory) override;
+
   void SetNumberOfRetry(CORBA::Long nbRetry) override;
 
   CORBA::Long GetNumberOfRetry() override;
index b6ace750dc0efcb2243f46f1f82b107c6c37c35a..4acef01d28c9083a7abc202f8b03fbaf0ae090a7 100644 (file)
@@ -87,6 +87,8 @@ public:
   void set_big_obj_on_disk_directory(const char *directory) override;
 
   void set_number_of_retry(CORBA::Long nbRetry) override;
+
+  void set_directory_for_replay_files(const char *directory) override;
   
   void set_startup_code(const char *codeAtStartUp) override;
 
index 5e70f99996fd481bfd6441c20bddeec5d71d86ed..d71e57c447a9043a7b7b684325b33c503a587baa 100644 (file)
@@ -953,7 +953,10 @@ def ExecCrashProofGeneric( code, context, outargsname, containerRef, instanceOfL
     EXEC_CODE_FNAME_PXF = "execsafe_"
     def RetrieveUniquePartFromPfx( fname ):
       return os.path.splitext( os.path.basename(fname)[len(EXEC_CODE_FNAME_PXF):] )[0]
-    with tempfile.NamedTemporaryFile(dir=os.getcwd(),prefix=EXEC_CODE_FNAME_PXF,suffix=".py", mode="w", delete = False) as codeFd:
+    dirForReplayFiles = KernelBasis.GetDirectoryForReplayFiles()
+    if not dirForReplayFiles:
+      raise RuntimeError("You are in context of exec resistant you have to position Directory hosting these files properly")
+    with tempfile.NamedTemporaryFile(dir=dirForReplayFiles,prefix=EXEC_CODE_FNAME_PXF,suffix=".py", mode="w", delete = False) as codeFd:
       codeFd.write( "{}\n".format( containerRef.get_startup_code() ) )
       codeFd.write( code )
       if closeEyesOnErrorAtExit:
@@ -963,17 +966,17 @@ sys.stderr.write({!r})
 sys.stderr.flush()""".format( MY_KEY_TO_DETECT_FINISH ) )
       codeFd.flush()
       codeFileName = os.path.basename( codeFd.name )
-      contextFileName = "contextsafe_{}.pckl".format( RetrieveUniquePartFromPfx( codeFileName  ) )
+      contextFileName = os.path.join( dirForReplayFiles, "contextsafe_{}.pckl".format( RetrieveUniquePartFromPfx( codeFileName  ) ) )
       with open(contextFileName,"wb") as contextFd:
         pickle.dump( context, contextFd)
-      resFileName = "outcontextsafe_{}.pckl".format( RetrieveUniquePartFromPfx( codeFileName  ) )
-      mainExecFileName = os.path.abspath( "mainexecsafe_{}.py".format( RetrieveUniquePartFromPfx( codeFileName  ) ) )
+      resFileName = os.path.join( dirForReplayFiles, "outcontextsafe_{}.pckl".format( RetrieveUniquePartFromPfx( codeFileName  ) ) )
+      mainExecFileName = os.path.join( dirForReplayFiles, "mainexecsafe_{}.py".format( RetrieveUniquePartFromPfx( codeFileName  ) ) )
       with open(mainExecFileName,"w") as f:
         f.write( FinalCode.format( codeFileName, contextFileName, resFileName, outargsname, iorScriptLog ) )
       for iTry in range( KernelBasis.GetNumberOfRetry() ):
         if iTry > 0:
           print( "WARNING : Retry # {}. Following code has generated non zero return code ( {} ). Trying again ... \n{}".format( iTry, returnCode, code ) )
-        p = sp.Popen(["python3", mainExecFileName],stdout = sp.PIPE, stderr = sp.PIPE)
+        p = sp.Popen(["python3", mainExecFileName],cwd = dirForReplayFiles,stdout = sp.PIPE, stderr = sp.PIPE)
         stdout, stderr = p.communicate()
         returnCode = p.returncode
         if returnCode == 0:
index e494959d4ece0840fe52c53dc3303eb0065f2b06..00bc32b76d4fdc5902e32d45b797fd5b1bff7f12 100644 (file)
@@ -27,6 +27,7 @@ import SALOME_PyNode
 import KernelBasis
 import SALOME
 
+import tempfile
 import glob
 import pickle
 import tempfile
@@ -72,129 +73,137 @@ class testPerfLogManager1(unittest.TestCase):
         """
         EDF29852 : Kill container with OutOfProcessNoReplay mode and see if container still responds.
         """
-        salome.salome_init()
-        assert(isinstance(KernelBasis.GetAllPyExecutionModes(),tuple))
-        KernelBasis.SetPyExecutionMode("OutOfProcessNoReplay") # the aim of test is here
-        hostname = "localhost"
-        cp = pylauncher.GetRequestForGiveContainer(hostname,"container_crash_test")
-        salome.cm.SetBigObjOnDiskThreshold(1000)
-        salome.cm.SetOverrideEnvForContainersSimple(env = [])
-        cont = salome.cm.GiveContainer(cp)
-        poa = salome.orb.resolve_initial_references("RootPOA")
-        obj = SALOME_PyNode.SenderByte_i(poa,pickle.dumps( (["i"],{"i": 3} ) )) ; id_o = poa.activate_object(obj) ; refPtr = poa.id_to_reference(id_o)
-        pyscript2 = cont.createPyScriptNode("testScript2",killMeCode)
-        pyscript2.executeFirst(refPtr)
-        self.assertRaises(SALOME.SALOME_Exception,pyscript2.executeSecond,["j"]) # an agressive SIGKILL has been received and container is still alive :) - it throws an exception :)
-        pyscript2.UnRegister()
-        pyscript3 = cont.createPyScriptNode("testScript3",normalCode)
-        obj = SALOME_PyNode.SenderByte_i(poa,pickle.dumps( (["i"],{"i": 3} ) )) ; id_o = poa.activate_object(obj) ; refPtr = poa.id_to_reference(id_o)
-        pyscript3.executeFirst(refPtr)
-        ret = pyscript3.executeSecond(["j"])
-        ret = pickle.loads( SALOME_PyNode.SeqByteReceiver(ret[0]).data() )
-        self.assertEqual(ret,24) # container has received a SIGKILL but it kindly continue to respond :)
-        a = salome.logm.NaiveFetch()
-        self.assertEqual(a[0][2][0].get().freestyle,[('a',777)])
-        cont.Shutdown()
+        with tempfile.TemporaryDirectory() as tmpdirname:
+            salome.salome_init()
+            assert(isinstance(KernelBasis.GetAllPyExecutionModes(),tuple))
+            KernelBasis.SetPyExecutionMode("OutOfProcessNoReplay") # the aim of test is here
+            hostname = "localhost"
+            cp = pylauncher.GetRequestForGiveContainer(hostname,"container_crash_test")
+            salome.cm.SetBigObjOnDiskThreshold(1000)
+            salome.cm.SetOverrideEnvForContainersSimple(env = [])
+            salome.cm.SetDirectoryForReplayFiles( str( tmpdirname ) )
+            cont = salome.cm.GiveContainer(cp)
+            poa = salome.orb.resolve_initial_references("RootPOA")
+            obj = SALOME_PyNode.SenderByte_i(poa,pickle.dumps( (["i"],{"i": 3} ) )) ; id_o = poa.activate_object(obj) ; refPtr = poa.id_to_reference(id_o)
+            pyscript2 = cont.createPyScriptNode("testScript2",killMeCode)
+            pyscript2.executeFirst(refPtr)
+            self.assertRaises(SALOME.SALOME_Exception,pyscript2.executeSecond,["j"]) # an agressive SIGKILL has been received and container is still alive :) - it throws an exception :)
+            pyscript2.UnRegister()
+            pyscript3 = cont.createPyScriptNode("testScript3",normalCode)
+            obj = SALOME_PyNode.SenderByte_i(poa,pickle.dumps( (["i"],{"i": 3} ) )) ; id_o = poa.activate_object(obj) ; refPtr = poa.id_to_reference(id_o)
+            pyscript3.executeFirst(refPtr)
+            ret = pyscript3.executeSecond(["j"])
+            ret = pickle.loads( SALOME_PyNode.SeqByteReceiver(ret[0]).data() )
+            self.assertEqual(ret,24) # container has received a SIGKILL but it kindly continue to respond :)
+            a = salome.logm.NaiveFetch()
+            self.assertEqual(a[0][2][0].get().freestyle,[('a',777)])
+            cont.Shutdown()
 
     def test1(self):
         """
         EDF29852 : Same than test0 Kill container with OutOfProcessWithReplay mode and see if container still responds. But in addition we test if the python script is runnable !
         """
-        salome.salome_init()
-        assert(isinstance(KernelBasis.GetAllPyExecutionModes(),tuple))
-        KernelBasis.SetPyExecutionMode("OutOfProcessWithReplay") # the aim of test is here
-        hostname = "localhost"
-        cp = pylauncher.GetRequestForGiveContainer(hostname,"container_crash_test")
-        salome.cm.SetBigObjOnDiskThreshold(1000)
-        salome.cm.SetOverrideEnvForContainersSimple(env = [])
-        cont = salome.cm.GiveContainer(cp)
-        poa = salome.orb.resolve_initial_references("RootPOA")
-        obj = SALOME_PyNode.SenderByte_i(poa,pickle.dumps( (["i"],{"i": 3} ) )) ; id_o = poa.activate_object(obj) ; refPtr = poa.id_to_reference(id_o)
-        pyscript2 = cont.createPyScriptNode("testScript2",killMeCode)
-        pyscript2.executeFirst(refPtr)
-        self.assertRaises(SALOME.SALOME_Exception,pyscript2.executeSecond,["j"]) # an agressive SIGKILL has been received and container is still alive :) - it throws an exception :)
-        pyscript2.UnRegister()
-        pyscript3 = cont.createPyScriptNode("testScript3",normalCode)
-        obj = SALOME_PyNode.SenderByte_i(poa,pickle.dumps( (["i"],{"i": 3} ) )) ; id_o = poa.activate_object(obj) ; refPtr = poa.id_to_reference(id_o)
-        pyscript3.executeFirst(refPtr)
-        ret = pyscript3.executeSecond(["j"])
-        ret = pickle.loads( SALOME_PyNode.SeqByteReceiver(ret[0]).data() )
-        self.assertEqual(ret,24) # container has received a SIGKILL but it kindly continue to respond :)
-        a = salome.logm.NaiveFetch()
-        self.assertEqual(a[0][2][0].get().freestyle,[('a',777)])
-        grpsOfLogToKill = cont.getAllLogFileNameGroups()
-        self.assertEqual(1,len(grpsOfLogToKill))
-        replayInput = grpsOfLogToKill[0]
-        # now try to replay the failing case
-        p = sp.Popen(["python3",os.path.basename(replayInput[0])],cwd = os.path.dirname(replayInput[0]),stdout=sp.PIPE,stderr=sp.PIPE)
-        out,err = p.communicate()
-        self.assertNotEqual(p.returncode,0) # very important ! The failing case must continue to fail :)
-        self.assertEqual("21".encode(),out) # very important to check that the reported case is standalone enough to be replayable poste mortem
-        # cleanup
-        dn = os.path.dirname(replayInput[0])
-        for elt in replayInput:
-            zeFile = os.path.join( dn, os.path.basename(elt) )
-            if os.path.exists( zeFile ):
-                os.unlink( zeFile )
-        cont.Shutdown()
+        with tempfile.TemporaryDirectory() as tmpdirname:
+            salome.salome_init()
+            assert(isinstance(KernelBasis.GetAllPyExecutionModes(),tuple))
+            KernelBasis.SetPyExecutionMode("OutOfProcessWithReplay") # the aim of test is here
+            hostname = "localhost"
+            cp = pylauncher.GetRequestForGiveContainer(hostname,"container_crash_test")
+            salome.cm.SetBigObjOnDiskThreshold(1000)
+            salome.cm.SetOverrideEnvForContainersSimple(env = [])
+            salome.cm.SetDirectoryForReplayFiles(str( tmpdirname ))
+            cont = salome.cm.GiveContainer(cp)
+            poa = salome.orb.resolve_initial_references("RootPOA")
+            obj = SALOME_PyNode.SenderByte_i(poa,pickle.dumps( (["i"],{"i": 3} ) )) ; id_o = poa.activate_object(obj) ; refPtr = poa.id_to_reference(id_o)
+            pyscript2 = cont.createPyScriptNode("testScript2",killMeCode)
+            pyscript2.executeFirst(refPtr)
+            self.assertRaises(SALOME.SALOME_Exception,pyscript2.executeSecond,["j"]) # an agressive SIGKILL has been received and container is still alive :) - it throws an exception :)
+            pyscript2.UnRegister()
+            pyscript3 = cont.createPyScriptNode("testScript3",normalCode)
+            obj = SALOME_PyNode.SenderByte_i(poa,pickle.dumps( (["i"],{"i": 3} ) )) ; id_o = poa.activate_object(obj) ; refPtr = poa.id_to_reference(id_o)
+            pyscript3.executeFirst(refPtr)
+            ret = pyscript3.executeSecond(["j"])
+            ret = pickle.loads( SALOME_PyNode.SeqByteReceiver(ret[0]).data() )
+            self.assertEqual(ret,24) # container has received a SIGKILL but it kindly continue to respond :)
+            a = salome.logm.NaiveFetch()
+            self.assertEqual(a[0][2][0].get().freestyle,[('a',777)])
+            grpsOfLogToKill = cont.getAllLogFileNameGroups()
+            self.assertEqual(1,len(grpsOfLogToKill))
+            replayInput = grpsOfLogToKill[0]
+            # now try to replay the failing case
+            p = sp.Popen(["python3",os.path.basename(replayInput[0])],cwd = os.path.dirname(replayInput[0]),stdout=sp.PIPE,stderr=sp.PIPE)
+            out,err = p.communicate()
+            self.assertNotEqual(p.returncode,0) # very important ! The failing case must continue to fail :)
+            self.assertEqual("21".encode(),out) # very important to check that the reported case is standalone enough to be replayable poste mortem
+            # cleanup
+            dn = os.path.dirname(replayInput[0])
+            for elt in replayInput:
+                zeFile = os.path.join( dn, os.path.basename(elt) )
+                if os.path.exists( zeFile ):
+                    os.unlink( zeFile )
+            cont.Shutdown()
 
     def test2(self):
         """
         Aim of test is to check that CPU/mem retrieved in log is OK even in OutOfProcessNoReplay mode.
         """
-        salome.salome_init()
-        salome.logm.clear()
-        assert(isinstance(KernelBasis.GetAllPyExecutionModes(),tuple))
-        KernelBasis.SetPyExecutionMode("OutOfProcessNoReplay") # the aim of test is here
-        hostname = "localhost"
-        PROXY_THRES = -1
-        #
-        salome.cm.SetBigObjOnDiskThreshold(PROXY_THRES)
-        salome.cm.SetOverrideEnvForContainersSimple(env = [])
-        salome.cm.SetDeltaTimeBetweenCPUMemMeasureInMilliSecond( 250 )
-        cp = pylauncher.GetRequestForGiveContainer(hostname,"container_cpu_mem_out_process_test")
-        cont = salome.cm.GiveContainer(cp)
-        poa = salome.orb.resolve_initial_references("RootPOA")
-        obj = SALOME_PyNode.SenderByte_i(poa,pickle.dumps( (["i"],{"i": 3} ) )) ; id_o = poa.activate_object(obj) ; refPtr = poa.id_to_reference(id_o)
-        pyscript2 = cont.createPyScriptNode("testScript3",heatCPUCode)
-        pyscript2.executeFirst(refPtr)
-        ret = pyscript2.executeSecond(["j"])
-        ret = pickle.loads( SALOME_PyNode.SeqByteReceiver(ret[0]).data() )
-        self.assertEqual(ret,24)
-        pyscript2.UnRegister()
-        a = salome.logm.NaiveFetch()
-        cpu_mem_to_test = a[0][1][0].get()._cpu_mem_during_exec.data # normally even in OutOfProcessNoReplay mode the CPU must report somehing greater than 100
-        self.assertGreater(len(cpu_mem_to_test),10) # 5 second of run 250 ms of interval between measures -> 20. In case of problem in HeatMarcel -> 10
-        logging.debug("CPU mem measured (even in OutOfProcessNoReplay) : {}".format(cpu_mem_to_test))
-        greater_than_100 = [a for a,b in cpu_mem_to_test if a > 100]
-        self.assertGreater(len(greater_than_100),1) # At minimum one measure must report CPU load > 100%
-        cont.Shutdown()
+        with tempfile.TemporaryDirectory() as tmpdirname:
+            salome.salome_init()
+            salome.logm.clear()
+            assert(isinstance(KernelBasis.GetAllPyExecutionModes(),tuple))
+            KernelBasis.SetPyExecutionMode("OutOfProcessNoReplay") # the aim of test is here
+            hostname = "localhost"
+            PROXY_THRES = -1
+            #
+            salome.cm.SetBigObjOnDiskThreshold(PROXY_THRES)
+            salome.cm.SetOverrideEnvForContainersSimple(env = [])
+            salome.cm.SetDirectoryForReplayFiles(str( tmpdirname ))
+            salome.cm.SetDeltaTimeBetweenCPUMemMeasureInMilliSecond( 250 )
+            cp = pylauncher.GetRequestForGiveContainer(hostname,"container_cpu_mem_out_process_test")
+            cont = salome.cm.GiveContainer(cp)
+            poa = salome.orb.resolve_initial_references("RootPOA")
+            obj = SALOME_PyNode.SenderByte_i(poa,pickle.dumps( (["i"],{"i": 3} ) )) ; id_o = poa.activate_object(obj) ; refPtr = poa.id_to_reference(id_o)
+            pyscript2 = cont.createPyScriptNode("testScript3",heatCPUCode)
+            pyscript2.executeFirst(refPtr)
+            ret = pyscript2.executeSecond(["j"])
+            ret = pickle.loads( SALOME_PyNode.SeqByteReceiver(ret[0]).data() )
+            self.assertEqual(ret,24)
+            pyscript2.UnRegister()
+            a = salome.logm.NaiveFetch()
+            cpu_mem_to_test = a[0][1][0].get()._cpu_mem_during_exec.data # normally even in OutOfProcessNoReplay mode the CPU must report somehing greater than 100
+            self.assertGreater(len(cpu_mem_to_test),10) # 5 second of run 250 ms of interval between measures -> 20. In case of problem in HeatMarcel -> 10
+            logging.debug("CPU mem measured (even in OutOfProcessNoReplay) : {}".format(cpu_mem_to_test))
+            greater_than_100 = [a for a,b in cpu_mem_to_test if a > 100]
+            self.assertGreater(len(greater_than_100),1) # At minimum one measure must report CPU load > 100%
+            cont.Shutdown()
 
     def test3(self):
         """
         [EDF29150] : test that we can resist to a crash at exit
         """
-        salome.salome_init()
-        KernelBasis.SetPyExecutionMode("OutOfProcessWithReplayFT")
-        hostname = "localhost"
-        cp = pylauncher.GetRequestForGiveContainer(hostname,"container_crash_test")
-        salome.cm.SetNumberOfRetry( 3 )
-        salome.cm.SetCodeOnContainerStartUp("""a = 2""")
-        salome.cm.SetBigObjOnDiskThreshold(1000)
-        salome.cm.SetOverrideEnvForContainersSimple(env = [])
-        cont = salome.cm.GiveContainer(cp)
-        poa = salome.orb.resolve_initial_references("RootPOA")
-        obj = SALOME_PyNode.SenderByte_i(poa,pickle.dumps( (["i"],{"i": 3} ) )) ; id_o = poa.activate_object(obj) ; refPtr = poa.id_to_reference(id_o)
-        pyscript = cont.createPyScriptNode("testScript4",killMeAtTheEnd)
-        pyscript.executeFirst(refPtr)
-        ret = pyscript.executeSecond(["j"])
-        ret = pickle.loads( SALOME_PyNode.SeqByteReceiver(ret[0]).data() )
-        self.assertEqual(ret,54)
-        with open(cont.locallogfilename) as f:
-            logCont = f.read( )
-            self.assertTrue( "WARNING : Retry #" in logCont)
-            self.assertTrue( "WARNING : Following code has generated non zero return code" in logCont )# should report something into the container
-        cont.Shutdown()
+        with tempfile.TemporaryDirectory() as tmpdirname:
+            salome.salome_init()
+            KernelBasis.SetPyExecutionMode("OutOfProcessWithReplayFT")
+            hostname = "localhost"
+            cp = pylauncher.GetRequestForGiveContainer(hostname,"container_crash_test")
+            salome.cm.SetNumberOfRetry( 3 )
+            salome.cm.SetCodeOnContainerStartUp("""a = 2""")
+            salome.cm.SetBigObjOnDiskThreshold(1000)
+            salome.cm.SetOverrideEnvForContainersSimple(env = [])
+            salome.cm.SetDirectoryForReplayFiles(str( tmpdirname ))
+            cont = salome.cm.GiveContainer(cp)
+            poa = salome.orb.resolve_initial_references("RootPOA")
+            obj = SALOME_PyNode.SenderByte_i(poa,pickle.dumps( (["i"],{"i": 3} ) )) ; id_o = poa.activate_object(obj) ; refPtr = poa.id_to_reference(id_o)
+            pyscript = cont.createPyScriptNode("testScript4",killMeAtTheEnd)
+            pyscript.executeFirst(refPtr)
+            ret = pyscript.executeSecond(["j"])
+            ret = pickle.loads( SALOME_PyNode.SeqByteReceiver(ret[0]).data() )
+            self.assertEqual(ret,54)
+            with open(cont.locallogfilename) as f:
+                logCont = f.read( )
+                self.assertTrue( "WARNING : Retry #" in logCont)
+                self.assertTrue( "WARNING : Following code has generated non zero return code" in logCont )# should report something into the container
+            cont.Shutdown()
 
 if __name__ == '__main__':
     from salome_utils import positionVerbosityOfLoggerRegardingState,setVerboseLevel,setVerbose