Salome HOME
Work in progress : workload manager step 2
[modules/yacs.git] / src / runtime / PythonNode.cxx
index 03d17def580b0dce6cfdf9adf48e6755d0fbf325..4f7bd51170de67de5fb60448908a9dd2479b0840 100644 (file)
@@ -102,6 +102,9 @@ void PythonEntry::commonRemoteLoadPart1(InlineNode *reqNode)
         {
           try
           {
+            if(!_imposedResource.empty() && !_imposedContainer.empty())
+              container->start(reqNode, _imposedResource, _imposedContainer);
+            else
               container->start(reqNode);
           }
           catch(Exception& e)
@@ -345,7 +348,7 @@ PythonNode::~PythonNode()
     }
 }
 
-void PythonNode::checkBasicConsistency() const throw(YACS::Exception)
+void PythonNode::checkBasicConsistency() const 
 {
   DEBTRACE("checkBasicConsistency");
   InlineNode::checkBasicConsistency();
@@ -722,6 +725,21 @@ void PythonNode::shutdown(int level)
     }
 }
 
+void PythonNode::imposeResource(const std::string& resource_name,
+                                const std::string& container_name)
+{
+  if(!resource_name.empty() && !container_name.empty())
+  {
+    _imposedResource = resource_name;
+    _imposedContainer = container_name;
+  }
+}
+
+bool PythonNode::canAcceptImposedResource()
+{
+  return _container != nullptr && _container->canAcceptImposedResource();
+}
+
 Node *PythonNode::simpleClone(ComposedNode *father, bool editionOnly) const
 {
   return new PythonNode(*this,father);
@@ -894,7 +912,7 @@ void PyFuncNode::init(bool start)
     setState(YACS::TORECONNECT);
 }
 
-void PyFuncNode::checkBasicConsistency() const throw(YACS::Exception)
+void PyFuncNode::checkBasicConsistency() const 
 {
   DEBTRACE("checkBasicConsistency");
   InlineFuncNode::checkBasicConsistency();
@@ -1332,3 +1350,18 @@ void PyFuncNode::shutdown(int level)
     }
 }
 
+void PyFuncNode::imposeResource(const std::string& resource_name,
+                                const std::string& container_name)
+{
+  if(!resource_name.empty() && !container_name.empty())
+  {
+    _imposedResource = resource_name;
+    _imposedContainer = container_name;
+  }
+}
+
+bool PyFuncNode::canAcceptImposedResource()
+{
+  return _container != nullptr && _container->canAcceptImposedResource();
+}
+