]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
[EDF29138] : Ease usage of replay mode
authorAnthony Geay <anthony.geay@edf.fr>
Fri, 19 Apr 2024 13:32:22 +0000 (15:32 +0200)
committerAnthony Geay <anthony.geay@edf.fr>
Fri, 19 Apr 2024 13:32:22 +0000 (15:32 +0200)
src/Container/SALOME_PyNode.py

index 26493bf8145eccf234e0c7d1f425e49be5bb728b..06c958fb338e6d3551cb9fb5e4da2f645c416cb4 100644 (file)
@@ -873,21 +873,38 @@ def ExecLocal( code, context, outargsname, containerRef, instanceOfLogOfCurrentS
   exec( code, context )
   return instanceOfLogOfCurrentSession._current_instance
 
-class LogOfCurrentExecutionSession:
+class LogOfCurrentExecutionSessionAbs(Generic,abc.ABC):
+  def __init__(self):
+    self._current_instance = ScriptExecInfo()
+
+  def addInfoOnLevel2(self, key, value):
+    setattr(self._current_instance,key,value)
+
+  @abc.abstractmethod
+  def addFreestyleAndFlush(self, outargsname):
+    raise RuntimeError("Must be overloaded")
+
+class LogOfCurrentExecutionSession(LogOfCurrentExecutionSessionAbs):
   def __init__(self, handleToCentralizedInst):
+    super().__init__()
     self._remote_handle = handleToCentralizedInst
-    self._current_instance = ScriptExecInfo()
 
   def addFreestyleAndFlush(self, value):
     self._current_instance.freestyle = value
     self.finalizeAndPushToMaster()
 
-  def addInfoOnLevel2(self, key, value):
-    setattr(self._current_instance,key,value)
-
   def finalizeAndPushToMaster(self):
     self._remote_handle.assign( pickle.dumps( self._current_instance ) )
 
+class LogOfCurrentExecutionSessionStub(LogOfCurrentExecutionSessionAbs):
+  """
+  This class is to stub LogOfCurrentExecutionSession in context of replay where the server (handleToCentralizedInst) has vanished
+  """
+  def __init__(self, handleToCentralizedInst = None):
+    super().__init__()
+  def addFreestyleAndFlush(self):
+    pass
+
 class PyScriptNode_Abstract_i(Engines__POA.PyScriptNode,Generic,abc.ABC):
   """The implementation of the PyScriptNode CORBA IDL that executes a script"""
   def __init__(self, nodeName, code, poa, my_container, logscript):