From: Anthony Geay Date: Thu, 29 Feb 2024 08:15:41 +0000 (+0100) Subject: [EDF29576] : flush the latest version of monitoring before shutting down X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=88bc62ff1baa412fd2d8232f4686787bff3e5dbe;p=modules%2Fkernel.git [EDF29576] : flush the latest version of monitoring before shutting down --- diff --git a/src/KERNEL_PY/__init__.py b/src/KERNEL_PY/__init__.py index 8e9e92b45..615332500 100644 --- a/src/KERNEL_PY/__init__.py +++ b/src/KERNEL_PY/__init__.py @@ -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()