From 88bc62ff1baa412fd2d8232f4686787bff3e5dbe Mon Sep 17 00:00:00 2001 From: Anthony Geay Date: Thu, 29 Feb 2024 09:15:41 +0100 Subject: [PATCH] [EDF29576] : flush the latest version of monitoring before shutting down --- src/KERNEL_PY/__init__.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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() -- 2.39.2