Salome HOME
Correction of bug for HPContainers shared by different scripts. agy/ParallelContainerLaunch
authorAnthony Geay <anthony.geay@edf.fr>
Tue, 16 Sep 2014 08:56:02 +0000 (10:56 +0200)
committerAnthony Geay <anthony.geay@edf.fr>
Tue, 16 Sep 2014 08:56:02 +0000 (10:56 +0200)
idl/SALOME_PyNode.idl
src/Container/SALOME_PyNode.py

index ba3bfaadb665a60a2b15c2d328c6eaa9da97f6e6..5faf372ac3ca3438794f0386f38fea947a8ffbb5 100644 (file)
@@ -61,6 +61,13 @@ module Engines
 
   interface PyScriptNode : PyNodeBase
   {
+    /*!
+      This method compiles, but NOT EXECUTE, the code \a codeStr. The result of the compiled code will be used then
+      on execute step.
+      \param codeStr - the python code (without statement) to be executed, that can modify the context initialized at initialization.
+     */
+    void assignNewCompiledCode(in string codeStr) raises (SALOME::SALOME_Exception);
+
     /*! \brief execute a python script defined in the node
 
       \param outargsname output argument names 
index 9cbc8a615f1f17f8ddceacc0786c790d1a341cd5..07f1f7baed934b01e21cd9244b86069575d91251 100644 (file)
@@ -106,6 +106,13 @@ class PyScriptNode_i (Engines__POA.PyScriptNode,Generic):
     except:
       raise SALOME.SALOME_Exception(SALOME.ExceptionStruct(SALOME.BAD_PARAM,"","PyScriptNode (%s) : code to be executed \"%s\"" %(self.nodeName,code),0))
 
+  def assignNewCompiledCode(self,codeStr):
+    try:
+      self.code=codeStr
+      self.ccode=compile(codeStr,self.nodeName,'exec')
+    except:
+      raise SALOME.SALOME_Exception(SALOME.ExceptionStruct(SALOME.BAD_PARAM,"","PyScriptNode.assignNewCompiledCode (%s) : code to be executed \"%s\"" %(self.nodeName,codeStr),0))
+
   def execute(self,outargsname,argsin):
     """Execute the script stored in attribute ccode with pickled args (argsin)"""
     try: