]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
[EDF29576] : flush the latest version of monitoring before shutting down agy/29576
authorAnthony Geay <anthony.geay@edf.fr>
Thu, 29 Feb 2024 08:15:41 +0000 (09:15 +0100)
committerAnthony Geay <anthony.geay@edf.fr>
Thu, 29 Feb 2024 08:15:41 +0000 (09:15 +0100)
src/KERNEL_PY/__init__.py

index 8e9e92b458d34eb91a74091f8cbc320e9b6522be..61533250055563a1a95e9fa39b7b7f632c71f182 100644 (file)
@@ -272,6 +272,7 @@ def salome_init_without_session(path=None, embedded=False, iorfakensfile=None):
     type(logm).Fetch = LogManagerFetch
     type(logm).DumpInFile = LogManagerDumpInFile
     type(logm).LaunchMonitoringDumpFile = LogManagerLaunchMonitoringDumpFile
+    type(logm).FinalFetchBeforeDying = LogManagerFinalFetchBeforeDying
     type(logm).GetLatestMonitoringDumpFile = LogManagerGetLatestMonitoringDumpFile
     type(logm).DumpIORInFile = LogManagerDumpIORInFile
     #
@@ -568,6 +569,12 @@ def LogManagerLoadFromIORFile( iorFile ):
         tempFileName = f.name
     return LoadAndWrite( logm, tempFileName )
 
+def LogManagerFinalFetchBeforeDying(self):
+    import shutil
+    a,b = self.getFileNamePairOfLogger()
+    self.DumpInFile( b )
+    shutil.move( b, a)
+
 def LogManagerGetLatestMonitoringDumpFile(self):
     import shutil
     import logging
@@ -581,14 +588,16 @@ def LogManagerGetLatestMonitoringDumpFile(self):
         logging.debug("LogManagerGetLatestMonitoringDumpFile SITUATION A")
         if os.path.exists( b ):
             os.remove( b )
+        self.FinalFetchBeforeDying()
         return a
     if lastVersion == b:
         logging.debug("LogManagerGetLatestMonitoringDumpFile SITUATION B")
         if os.path.exists( b ):
             shutil.move( b, a)
+        self.FinalFetchBeforeDying()
         return a
     logging.warning("in LogManagerGetLatestMonitoringDumpFile an unexpected situation araises.")
     return ""
 
 #to expose all objects to pydoc
-__all__=dir()
+__all__ = dir()