]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
[EDF30875] : Fix lost entries in logging in case of insulated python process
authorAnthony Geay <anthony.geay@edf.fr>
Mon, 9 Sep 2024 16:22:00 +0000 (18:22 +0200)
committerAnthony Geay <anthony.geay@edf.fr>
Mon, 9 Sep 2024 16:22:00 +0000 (18:22 +0200)
src/Container/SALOME_ContainerHelper.py
src/Container/SALOME_PyNode.py
src/Launcher/SALOME_LogManager.py
src/Launcher/Test/testCrashProofContainer.py

index da46cd6ed7ec2321244b00384c56d8ec2df4ae2c..eddce54eabe292209b8055b14b7494212e921358 100644 (file)
@@ -81,6 +81,9 @@ class ScriptExecInfo:
     def preappendFreestyle(self, value):
        self._freestyle_log = value + self._freestyle_log
 
+    def appendFreestyle(self, value):
+       self._freestyle_log += value
+
     @property
     def measureTimeResolution(self):
       return self._measure_time_resolution_ms
index 4f4129efe5b2e63e2fc74b0e811e69a942daea37..4ed8fd958a3b37f83c09e7ae38de758820f89e23 100644 (file)
@@ -1414,6 +1414,7 @@ class PyScriptNode_Abstract_i(Engines__POA.PyScriptNode,Generic,abc.ABC):
       self.addTimeInfoOnLevel2("startExecTime")
       ##
       self.addInfoOnLevel2("measureTimeResolution",self.my_container_py.monitoringtimeresms())
+      self._current_execution_session.finalizeAndPushToMaster() # flush it to the server (scheduler hosting ContainerManager) in order to retrieve it in Python server
       cpumeminfo, self._current_execution_session._current_instance = executeSecondInternal( self.my_container_py.monitoringtimeresms() )
       ##
       self.addInfoOnLevel2("CPUMemDuringExec",cpumeminfo)
index 58114fc413be3453069c667f74d276da0f534c37..7404a35cfbed23199cfa2d95a3606517b55cc89d 100644 (file)
@@ -45,16 +45,20 @@ class SALOME_ContainerScriptExecPerfLog:
     :param alreadyOnSiteBytes: pickle of instance of ScriptExecInfo of previous value (if any) [bytes]
     :param instanceRemoteBytes: pickle of current instance of ScriptExecInfo (if any) [bytes]
     """
+    instanceRemote = pickle.loads(instanceRemoteBytes)
     alreadyOnSite = None
     if len( alreadyOnSiteBytes ) > 0:
       alreadyOnSite = pickle.loads(alreadyOnSiteBytes)
-    instanceRemote = pickle.loads(instanceRemoteBytes)
     self._stop_pos = os.path.getsize( self.father.father.logfilename )
-    setattr(instanceRemote,"tracePosStop",self._stop_pos)
-    setattr(instanceRemote,"tracePosStart",self._start_pos)
     if alreadyOnSite:
-      instanceRemote.preappendFreestyle( alreadyOnSite._freestyle_log )
-    return pickle.dumps(instanceRemote)
+      setattr(alreadyOnSite,"tracePosStop",self._stop_pos)
+      setattr(alreadyOnSite,"tracePosStart",self._start_pos)
+      alreadyOnSite.appendFreestyle( instanceRemote._freestyle_log )
+      return pickle.dumps(alreadyOnSite)
+    else:
+      setattr(instanceRemote,"tracePosStop",self._stop_pos)
+      setattr(instanceRemote,"tracePosStart",self._start_pos)
+      return pickle.dumps(instanceRemote)
 
   def start(self):
     self._start_pos = os.path.getsize( self.father.father.logfilename )
index eb30ec1cc442e0dc528393b4a05dd76385f877a3..044a62c38bf19ae42e56e9c8e7207fef33c2a847 100644 (file)
@@ -309,6 +309,7 @@ class testPerfLogManager1(unittest.TestCase):
                 logInfoForCont = [elt for elt in a if "container_crash_test_5" in elt.ns_entry]
                 self.assertEqual( len(logInfoForCont), 1 )
                 logInfoForCont = logInfoForCont[0]
+                self.assertTrue( logInfoForCont[1][0].startExecTime is not None )
                 self.assertEqual( [elt[0] for elt in logInfoForCont[1][0].get().freestyle] , ['b4loadctx', 'afterloadctx', 'bforeexec', 'b4loadctx', 'afterloadctx', 'bforeexec', 'afterexec', 'strtdumpout', 'afterdump'] ) # <- aim of test is here. First 3 entries ('b4loadctx', 'afterloadctx', 'bforeexec') prove that first attempt fails to return within 10 sececonds as requested by KernelBasis.SetExecutionTimeOut(10)
                 pass
             pass