Salome HOME
GUI update for workload manager.
authorOvidiu Mircescu <ovidiu.mircescu@edf.fr>
Tue, 2 Jun 2020 10:58:07 +0000 (12:58 +0200)
committerOvidiu Mircescu <ovidiu.mircescu@edf.fr>
Tue, 2 Jun 2020 10:58:07 +0000 (12:58 +0200)
src/engine/Container.cxx
src/engine/Container.hxx
src/genericgui/FormContainer.cxx
src/genericgui/FormContainer.hxx
src/genericgui/FormParamContainer.ui
src/runtime/PythonNode.cxx
src/runtime/PythonNode.hxx

index 7dbbac6455d91022869b23624a0b243f1c80051b..2843aa57466ed599f724913f0bac9af9c831b181 100644 (file)
@@ -32,6 +32,8 @@ const char Container::KIND_ENTRY[]="container_kind";
 
 const char Container::AOC_ENTRY[]="attached_on_cloning";
 
+const char Container::STORE_CONTEXT_PROPERTY[]="store_context";
+
 Container::Container():_isAttachedOnCloning(false),_proc(0)
 {
 }
@@ -104,3 +106,27 @@ void Container::setProperties(const std::map<std::string,std::string>& propertie
     setProperty((*it).first,(*it).second);
 }
 
+bool Container::storeContext()
+{
+  bool found = false;
+  std::string str_value;
+  str_value = getProperty(STORE_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 Container::setStoreContext(bool v)
+{
+  if(v)
+    setProperty(STORE_CONTEXT_PROPERTY, "1");
+  else
+    setProperty(STORE_CONTEXT_PROPERTY, "0");
+}
+
index 9ec9e594dc49f2cf09c162a299ba4b5c8d2705c0..4f94da39051691951c61744e34d68ba2e48ad977 100644 (file)
@@ -55,6 +55,8 @@ namespace YACS
                          const std::string& resource_name,
                          const std::string& container_name);
       virtual bool canAcceptImposedResource();
+      virtual bool storeContext();
+      virtual void setStoreContext(bool v);
       virtual std::string getPlacementId(const Task *askingNode) const = 0;
       virtual std::string getFullPlacementId(const Task *askingNode) const = 0;
       //Edition only methods
@@ -84,6 +86,7 @@ namespace YACS
       virtual void shutdown(int level) = 0;
       static const char KIND_ENTRY[];
       static const char AOC_ENTRY[];
+      static const char STORE_CONTEXT_PROPERTY[];
     protected:
       std::string _name;
       mutable bool _isAttachedOnCloning;
index 00fb5b3ce6ca39e8b6b77de619a699aabdd2e100..e649ecfbb4b2c5ecee06f97620b51eafa9cf7dd4 100644 (file)
@@ -36,6 +36,7 @@ FormContainer::FormContainer(QWidget *parent):FormContainerBase(parent),cb_type(
   FormContainer::FillPanel(0); // --- set widgets before signal connexion to avoid false modif detection
   connect(cb_type, SIGNAL(activated(const QString&)),this, SLOT(onModifyType(const QString&)));
   connect(ch_aoc,SIGNAL(stateChanged(int)),this,SLOT(onModifyAOC(int)));
+  connect(ch_pycache,SIGNAL(stateChanged(int)),this,SLOT(onModifyStorePyCache(int)));
 }
 
 FormContainer::~FormContainer()
@@ -47,7 +48,10 @@ void FormContainer::FillPanel(YACS::ENGINE::Container *container)
   DEBTRACE("FormContainer::FillPanel");
   FormContainerBase::FillPanel(container);
   if(container)
+  {
     ch_aoc->setCheckState(container->isAttachedOnCloning()?Qt::Checked:Qt::Unchecked);
+    ch_pycache->setCheckState(container->storeContext()?Qt::Checked:Qt::Unchecked);
+  }
   cb_type->clear();
   cb_type->addItem("mono");
   cb_type->addItem("multi");
@@ -92,3 +96,21 @@ void FormContainer::onModifyAOC(int val)
   if(prop!=val2)
     onModified();
 }
+
+void FormContainer::onModifyStorePyCache(int val)
+{
+  if (!_container)
+    return;
+  bool val2(false);
+  if(val==Qt::Unchecked)
+    val2=false;
+  if(val==Qt::Checked)
+    val2=true;
+  bool prop = _container->storeContext();
+  int prop2((int)val2);
+  std::ostringstream oss; oss << prop2;
+  //_properties[YACS::ENGINE::Container::AOC_ENTRY]=oss.str();
+  _container->setStoreContext(val2);
+  if(prop!=val2)
+    onModified();
+}
index d7a601761d15a4afe289c3d369147505c0311a87..190048f39ce3d9c7475cb4f163c7b584ebc9b2df 100644 (file)
@@ -43,6 +43,7 @@ public:
 public slots:
   void onModifyType(const QString &text);
   void onModifyAOC(int val);
+  void onModifyStorePyCache(int val);
 private:
   QComboBox *cb_type;
 };
index 010589813abbee16a92b25c9cc5e3cc72b1fb981..52a8e539edc60c0c410c424d61433a9e784163bd 100644 (file)
           </property>
          </widget>
         </item>
+        <item>
+         <widget class="QCheckBox" name="ch_pycache">
+          <property name="text">
+           <string>Store python cache</string>
+          </property>
+         </widget>
+        </item>
        </layout>
       </item>
      </layout>
index 9ac3c61059542354f92464a37ebeb5ac0a82976d..33f7fb307bca0285d6fecba6d2b8e1c387ab4f2b 100644 (file)
@@ -76,8 +76,6 @@ 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";
-
 PythonEntry::PythonEntry():_context(0),_pyfuncSer(0),_pyfuncUnser(0),_pyfuncSimpleSer(0)
 {
 }
@@ -551,7 +549,7 @@ void PythonNode::executeRemote()
         squeezeMemoryRemote();
   }
   //
-  if(!keepContext())
+  if(!storeContext())
   {
     if(!CORBA::is_nil(_pynode))
       {
@@ -746,27 +744,17 @@ bool PythonNode::canAcceptImposedResource()
 
 std::string PythonNode::pythonEntryName()const
 {
-  if(keepContext())
+  if(storeContext())
     return "DEFAULT_NAME_FOR_UNIQUE_PYTHON_NODE_ENTRY";
   else
     return getName();
 }
 
-bool PythonNode::keepContext()const
+bool PythonNode::storeContext()const
 {
   bool found = false;
   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;
-      }
-  }
+    found = _container->storeContext();
   return found;
 }
 
index a18409bd7eeb5184bee0bb41fa5d938ad552afb7..9db3862b7b304d850db880e56b121690b2235170 100644 (file)
@@ -91,7 +91,7 @@ namespace YACS
       void imposeResource(const std::string& resource_name,
                           const std::string& container_name) override;
       bool canAcceptImposedResource()override;
-      bool keepContext()const;
+      bool storeContext()const;
       std::string getContainerLog();
       PythonNode* cloneNode(const std::string& name);
       virtual std::string typeName() { return "YACS__ENGINE__PythonNode"; }
@@ -108,7 +108,6 @@ namespace YACS
       static const char SCRIPT_FOR_SERIALIZATION[];
       static const char REMOTE_NAME[];
       static const char DPL_INFO_NAME[];
-      static const char KEEP_CONTEXT_PROPERTY[];
     protected:
       bool _autoSqueeze = false;
       Engines::PyScriptNode_var _pynode;