From c169b88da5f8bab9639915a1006f89c131a12ebb Mon Sep 17 00:00:00 2001 From: Anthony Geay Date: Thu, 8 Feb 2024 08:02:36 +0100 Subject: [PATCH] [EDF29150] : deal with not finished execs --- src/Container/SALOME_ContainerHelper.py | 27 ++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/src/Container/SALOME_ContainerHelper.py b/src/Container/SALOME_ContainerHelper.py index d8663afbd..23dd6a516 100644 --- a/src/Container/SALOME_ContainerHelper.py +++ b/src/Container/SALOME_ContainerHelper.py @@ -198,7 +198,9 @@ class ScriptExecInfo: @property def execTime(self): - return self.endExecTime - self.startExecTime + if ( self.endExecTime is not None ) and (self.startExecTime is not None): + return self.endExecTime - self.startExecTime + return None @property def fullExecTime(self): @@ -633,6 +635,8 @@ def ListAllExecContainIn( listOfContainerLogInfo ): For all ContainerLogInfo contained in listOfContainerLogInfo extract all ScriptExecInfo contained recursively in it. This method filters all "side" executions like those positionning environment for exemple. + See also : ListAllExecFinishedContainIn + Args: ----- @@ -647,6 +651,27 @@ def ListAllExecContainIn( listOfContainerLogInfo ): allexecs = sum( [sum( [[myexec for myexec in ps] for ps in cont],[] ) for cont in listOfContainerLogInfo], [] ) return [elt for elt in allexecs if elt.get() is not None] +def ListAllExecFinishedContainIn( listOfContainerLogInfo ): + """ + For all ContainerLogInfo contained in listOfContainerLogInfo extract all ScriptExecInfo contained recursively + in it. This method filters all "side" executions like those positionning environment for exemple and those not finished. + + See also : ListAllExecContainIn + + Args: + ----- + + listOfContainerLogInfo (list) : instance typically returned by salome.LogManagerLoadFromFile + + Returns + ------- + + list : all ScriptExecInfoDeco instance contained recursively in all input ContainerLogInfo instances + + """ + beforeFiltering = ListAllExecContainIn( listOfContainerLogInfo ) + return [elt for elt in beforeFiltering if elt.get().execTime is not None] + def IsExecTimeHigherThan( execInstDeco, limitDuration ): """ Example of Usage : -- 2.39.2