Salome HOME
getMaxLevelOfParallelism is now sensitive to the nb_proc_per_node property property...
authorAnthony Geay <anthony.geay@edf.fr>
Thu, 22 Oct 2015 16:24:57 +0000 (18:24 +0200)
committerAnthony Geay <anthony.geay@edf.fr>
Thu, 22 Oct 2015 16:24:57 +0000 (18:24 +0200)
src/engine/InlineNode.cxx
src/engine/InlineNode.hxx
src/yacsloader_swig/Test/testSaveLoadRun.py

index 2d229864585e742d323f25a65da7fcf3e99f08c1..bf3da9174fb990c9380b0ab7060fac77d924f779 100644 (file)
@@ -139,3 +139,20 @@ bool InlineNode::isDeployable() const
     return false;
 }
 
+int InlineNode::getMaxLevelOfParallelism() const
+{
+  if(!isDeployable())
+    return 1;
+  if(!_container)
+    return 1;
+  std::map<std::string,std::string> props(_container->getProperties());
+  std::map<std::string,std::string>::iterator it(props.find(std::string("nb_proc_per_node")));
+  if(it==props.end())
+    return 1;
+  if((*it).second.empty())
+    return 1;
+  std::istringstream iss((*it).second);
+  int ret(1); iss >> ret;
+  return ret;
+}
+
index f6582d599ceec6767be73c6cc946aadd071e3f7d..b69a0a21575ac83e2017d672fb43d778551969d5 100644 (file)
@@ -67,6 +67,7 @@ namespace YACS
       void performDuplicationOfPlacement(const Node& other);
       void performShallowDuplicationOfPlacement(const Node& other);
       bool isDeployable() const;
+      int getMaxLevelOfParallelism() const;
     public:
       static const char LOCAL_STR[];
       static const char REMOTE_STR[];
index a2c68da53016ea23c1f17a314c506489d7c23d2c..84001a792d064430ec3a61e7864e2c36bd5f6f64 100755 (executable)
@@ -1300,6 +1300,23 @@ for i in i8:
     ex.RunW(n0,0)
     self.assertEqual(n0.getState(),pilot.DONE)
     pass
+
+  def test18(self):
+    SALOMERuntime.RuntimeSALOME_setRuntime()
+    r=pilot.getRuntime()
+    p=r.createProc("prTest18")
+    n00=r.createScriptNode("Salome","n00")
+    self.assertEqual(n00.getMaxLevelOfParallelism(),1)
+    n00.setExecutionMode("remote")
+    self.assertEqual(n00.getMaxLevelOfParallelism(),1)
+    cont=p.createContainer("gg","Salome")
+    n00.setContainer(cont)
+    self.assertEqual(n00.getMaxLevelOfParallelism(),1)
+    cont.setProperty("nb_proc_per_nod","6")
+    self.assertEqual(n00.getMaxLevelOfParallelism(),1)
+    cont.setProperty("nb_proc_per_node","7")           # <- here
+    self.assertEqual(n00.getMaxLevelOfParallelism(),7) # <- here
+    pass
     
   pass