]> SALOME platform Git repositories - modules/yacs.git/commitdiff
Salome HOME
WIP: workload manager final version of the API
authorOvidiu Mircescu <ovidiu.mircescu@edf.fr>
Sat, 30 May 2020 08:34:22 +0000 (10:34 +0200)
committerOvidiu Mircescu <ovidiu.mircescu@edf.fr>
Sat, 30 May 2020 08:34:22 +0000 (10:34 +0200)
The highest level API should not change any more.
Tests need to be added.

src/engine/ComposedNode.cxx
src/engine/ComposedNode.hxx
src/engine/Executor.cxx
src/engine/Executor.hxx
src/engine/Scheduler.hxx
src/runtime/PythonNode.cxx
src/runtime/PythonNode.hxx

index 70ab5b3042344d53578d1b2cd02d1a214d3fe1c6..626a8abfee10865276206a739923e48efd6539ca 100644 (file)
@@ -1501,6 +1501,17 @@ void ComposedNode::accept(Visitor *visitor)
     }
 }
 
+void ComposedNode::setProperty(const std::string& name,const std::string& value)
+{
+  Node::setProperty(name, value);
+}
+
+std::string ComposedNode::getProperty(const std::string& name)
+{
+  return Node::getProperty(name);
+}
+
+
 //! redefined on derived class of ComposedNode. by default a ComposedNode has no port by itself
 std::list<InputPort *> ComposedNode::getLocalInputPorts() const
 {
index 355ddf809a6c2d5acd1ad37091b2021200679b84..f0f53d5e3acc368a16b719c661dbd4ba65bd17ea 100644 (file)
@@ -124,6 +124,8 @@ namespace YACS
       void accept(Visitor *visitor);
       virtual void cleanNodes();
       virtual std::string getProgress() const { return "0"; }
+      void setProperty(const std::string& name,const std::string& value)override;
+      std::string getProperty(const std::string& name)override;
     protected:
       struct SortHierarc
       {
index 5f18fff1d75d3e5d3c9e9dde1eba9ab68957ba64..8af044080cf03e8ceeea95530cb5177606155fcb 100644 (file)
@@ -1881,3 +1881,15 @@ void Executor::newRun(Scheduler *graph,int debug, bool fromScratch)
   }
   DEBTRACE("End of RunB thread");  
 }
+
+void Executor::RunW(Scheduler *graph,int debug, bool fromScratch)
+{
+  std::string str_value = graph->getProperty("executor");
+  if(str_value == "WorkloadManager"
+     || str_value == "WORKLOADMANAGER"
+     || str_value == "workloadmanager"
+     || str_value == "WorkLoadManager")
+    newRun(graph, debug, fromScratch);
+  else
+    RunB(graph, debug, fromScratch);
+}
index acd78083339412aef610860c255daa81cc3ab3a5..c83b4159f36cd3efd1a7cd7011d471cbc752bbf1 100644 (file)
@@ -99,11 +99,7 @@ namespace YACS
       Executor();
       virtual ~Executor();
       void RunA(Scheduler *graph,int debug=0, bool fromScratch=true);
-      void RunW(Scheduler *graph,int debug=0, bool fromScratch=true)
-      {
-        //RunB(graph, debug, fromScratch);
-        newRun(graph, debug, fromScratch);
-      }
+      void RunW(Scheduler *graph,int debug=0, bool fromScratch=true);
       void RunB(Scheduler *graph,int debug=0, bool fromScratch=true);
       void newRun(Scheduler *graph,int debug=0, bool fromScratch=true);
       void setKeepGoingProperty(bool newVal) { _keepGoingOnFail=newVal; }
index f0a9d2cac03b61855746ee7d9f05c6c24e2b0c78..c41bbed57b21b114afcf0f2e9d880faec26dd30d 100644 (file)
@@ -49,6 +49,8 @@ namespace YACS
       virtual bool isPlacementPredictableB4Run() const = 0;
       virtual bool isMultiplicitySpecified(unsigned& value) const = 0;
       virtual void forceMultiplicity(unsigned value) = 0;
+      virtual void setProperty(const std::string& name,const std::string& value)=0;
+      virtual std::string getProperty(const std::string& name)=0;
       virtual ~Scheduler();
     };
   }
index 402e3f5688dc3982cdbf69a8ff58b790eda656ca..9ac3c61059542354f92464a37ebeb5ac0a82976d 100644 (file)
@@ -76,7 +76,7 @@ const char PyFuncNode::SCRIPT_FOR_SERIALIZATION[]="import pickle\n"
     "  args=pickle.loads(st)\n"
     "  return args\n";
 
-const char PythonNode::KEEP_CONTEXT_PROPERTY[]="KEEP_CONTEXT";
+const char PythonNode::KEEP_CONTEXT_PROPERTY[]="keep_context";
 
 PythonEntry::PythonEntry():_context(0),_pyfuncSer(0),_pyfuncUnser(0),_pyfuncSimpleSer(0)
 {
@@ -259,7 +259,6 @@ void PythonEntry::loadRemoteContext(InlineNode *reqNode, Engines::Container_ptr
     }
 }
 
-// TODO: verify removing
 std::string PythonEntry::GetContainerLog(const std::string& mode, Container *container, const Task *askingTask)
 {
   if(mode=="local")
@@ -755,27 +754,22 @@ std::string PythonNode::pythonEntryName()const
 
 bool PythonNode::keepContext()const
 {
-  std::string str_value = const_cast<PythonNode*>(this)->getProperty(KEEP_CONTEXT_PROPERTY);
-  const char* yes_values[] = {"YES", "Yes", "yes", "TRUE", "True", "true", "1",
-                              "ON", "on", "On"};
   bool found = false;
-  for(const char* v : yes_values)
-    if(str_value == v)
-    {
-      found = true;
-      break;
-    }
+  if(_container)
+  {
+    std::string str_value = _container->getProperty(KEEP_CONTEXT_PROPERTY);
+    const char* yes_values[] = {"YES", "Yes", "yes", "TRUE", "True", "true", "1",
+                                "ON", "on", "On"};
+    for(const char* v : yes_values)
+      if(str_value == v)
+      {
+        found = true;
+        break;
+      }
+  }
   return found;
 }
 
-void PythonNode::setKeepContext(bool keep)
-{
-  if(keep)
-    setProperty(KEEP_CONTEXT_PROPERTY, "true");
-  else
-    setProperty(KEEP_CONTEXT_PROPERTY, "false");
-}
-
 Node *PythonNode::simpleClone(ComposedNode *father, bool editionOnly) const
 {
   return new PythonNode(*this,father);
index e012539e66eff1314af5df85733ac5a4329341b6..a18409bd7eeb5184bee0bb41fa5d938ad552afb7 100644 (file)
@@ -92,7 +92,6 @@ namespace YACS
                           const std::string& container_name) override;
       bool canAcceptImposedResource()override;
       bool keepContext()const;
-      void setKeepContext(bool keep);
       std::string getContainerLog();
       PythonNode* cloneNode(const std::string& name);
       virtual std::string typeName() { return "YACS__ENGINE__PythonNode"; }