Salome HOME
Correction of bug for HPContainers shared by different scripts.
authorAnthony Geay <anthony.geay@edf.fr>
Tue, 16 Sep 2014 09:00:53 +0000 (11:00 +0200)
committerAnthony Geay <anthony.geay@edf.fr>
Tue, 16 Sep 2014 09:00:53 +0000 (11:00 +0200)
src/runtime/PythonNode.cxx
src/runtime/PythonNode.hxx

index 8bbd9b7da195cedf9a88de9c78fe6e89edbe24e4..b762486e3151a66823d19f2718d33a1e0ebacfd1 100644 (file)
@@ -162,12 +162,9 @@ Engines::Container_var PythonEntry::commonRemoteLoadPart2(InlineNode *reqNode, b
   return objContainer;
 }
 
-void PythonEntry::commonRemoteLoad(InlineNode *reqNode)
+void PythonEntry::commonRemoteLoadPart3(InlineNode *reqNode, Engines::Container_ptr objContainer, bool isInitializeRequested)
 {
-  commonRemoteLoadPart1(reqNode);
   Container *container(reqNode->getContainer());
-  bool isInitializeRequested;
-  Engines::Container_var objContainer(commonRemoteLoadPart2(reqNode,isInitializeRequested));
   Engines::PyNodeBase_var pynode(getRemoteInterpreterHandle());
   ///
   {
@@ -213,24 +210,32 @@ void PythonEntry::commonRemoteLoad(InlineNode *reqNode)
     if(isInitializeRequested)
       {//This one is called only once at initialization in the container if an init-script is specified.
         try
-        {
+          {
             std::string zeInitScriptKey(container->getProperty(HomogeneousPoolContainer::INITIALIZE_SCRIPT_KEY));
             if(!zeInitScriptKey.empty())
               pynode->executeAnotherPieceOfCode(zeInitScriptKey.c_str());
-        }
+          }
         catch( const SALOME::SALOME_Exception& ex )
-        {
+          {
             std::string msg="Exception on PythonNode::loadRemote python invocation of initializisation py script !";
             msg += '\n';
             msg += ex.details.text.in();
             reqNode->setErrorDetails(msg);
             throw Exception(msg);
-        }
+          }
       }
     DEBTRACE( "---------------End PyNode::loadRemote function---------------" );
   }
 }
 
+void PythonEntry::commonRemoteLoad(InlineNode *reqNode)
+{
+  commonRemoteLoadPart1(reqNode);
+  bool isInitializeRequested;
+  Engines::Container_var objContainer(commonRemoteLoadPart2(reqNode,isInitializeRequested));
+  commonRemoteLoadPart3(reqNode,objContainer,isInitializeRequested);
+}
+
 PythonNode::PythonNode(const PythonNode& other, ComposedNode *father):InlineNode(other,father)
 {
   _implementation=IMPL_NAME;
@@ -327,12 +332,12 @@ void PythonNode::executeRemote()
   DEBTRACE( "++++++++++++++ PyNode::executeRemote: " << getName() << " ++++++++++++++++++++" );
   if(!_pyfuncSer)
     throw Exception("DistributedPythonNode badly loaded");
-
   //
   if(dynamic_cast<HomogeneousPoolContainer *>(getContainer()))
     {
       bool dummy;
       commonRemoteLoadPart2(this,dummy);
+      _pynode->assignNewCompiledCode(getScript().c_str());
     }
   //
   Engines::pickledArgs_var serializationInputCorba(new Engines::pickledArgs);
@@ -846,6 +851,7 @@ void PyFuncNode::executeRemote()
     {
       bool dummy;
       commonRemoteLoadPart2(this,dummy);
+      _pynode->executeAnotherPieceOfCode(getScript().c_str());
     }
   //
   Engines::pickledArgs_var serializationInputCorba(new Engines::pickledArgs);;
index b4ddea49727461ffa6c6f22c0e457680a47d2f76..8eef66b47372be94f0d28f05f55aba5e478bdf0f 100644 (file)
@@ -48,6 +48,7 @@ namespace YACS
       void commonRemoteLoad(InlineNode *reqNode);
       void commonRemoteLoadPart1(InlineNode *reqNode);
       Engines::Container_var commonRemoteLoadPart2(InlineNode *reqNode, bool& isInitializeRequested);
+      void commonRemoteLoadPart3(InlineNode *reqNode, Engines::Container_ptr objContainer, bool isInitializeRequested);
     protected:
       PyObject *_context;
       PyObject *_pyfuncSer;