]> SALOME platform Git repositories - modules/jobmanager.git/commitdiff
Salome HOME
Working on PAL# 2078
authorribes <ribes>
Mon, 19 Mar 2012 16:55:59 +0000 (16:55 +0000)
committerribes <ribes>
Mon, 19 Mar 2012 16:55:59 +0000 (16:55 +0000)
Adding is_cluster_head and working_directory support

src/engine/BL_SALOMEServices.cxx
src/engine/BL_SALOMEServices.hxx
src/genericgui/JM_EditSalomeResource.cxx
src/genericgui/JM_EditSalomeResource.hxx
src/genericgui/JM_SalomeResource.cxx
src/genericgui/JM_SalomeResource.hxx

index 0fb24e01c4d135d09146c2e90301dda9f63b69f7..e64ce12bc5f4110a9976506e15162878149bd4db 100644 (file)
@@ -162,6 +162,8 @@ BL::SALOMEServices::getResourceDescr(const std::string& name)
     resource_descr.batch = resource_definition->batch.in();
     resource_descr.mpiImpl = resource_definition->mpiImpl.in();
     resource_descr.iprotocol = resource_definition->iprotocol.in();
+    resource_descr.is_cluster_head = resource_definition->is_cluster_head;
+    resource_descr.working_directory = resource_definition->working_directory.in();
 
     delete resource_definition;
   }
@@ -196,6 +198,8 @@ BL::SALOMEServices::addResource(BL::ResourceDescr & new_resource)
   resource_definition->batch = CORBA::string_dup(new_resource.batch.c_str());
   resource_definition->mpiImpl = CORBA::string_dup(new_resource.mpiImpl.c_str());
   resource_definition->iprotocol = CORBA::string_dup(new_resource.iprotocol.c_str());
+  resource_definition->is_cluster_head = new_resource.is_cluster_head;
+  resource_definition->working_directory = CORBA::string_dup(new_resource.working_directory.c_str());
 
   try
   {
index a69a3c11f313d7e2805abadd564fa62d6d9f001a..8f35383a5a85c11db79e0a6cc2476a9179f37231 100644 (file)
@@ -57,6 +57,9 @@ namespace BL{
     std::string batch;
     std::string mpiImpl;
     std::string iprotocol;
+
+    bool is_cluster_head;
+    std::string working_directory;
   };
 
   class BL_Engine_EXPORT SALOMEServices :
index 1014717ae64aedd7ea0d9c264625b8753dc72076..19b29bb9b44982f2212d3130c17e49e28acf508d 100644 (file)
@@ -70,6 +70,14 @@ JM::EditSalomeResource::EditSalomeResource(QWidget *parent, BL::SALOMEServices *
   connect(_remove_button, SIGNAL(clicked()), this, SLOT(remove_components()));
   connect(_componentList, SIGNAL(itemSelectionChanged()), this, SLOT(itemSelectionChanged()));
 
+  QLabel * working_directory_label = new QLabel("Working Directory:");
+  _working_directory = new QLineEdit(this);
+  QLabel * is_cluster_head_label = new QLabel("Is Cluster Head:");
+  _is_cluster_head = new QPushButton(this);
+  _is_cluster_head->setCheckable(true);
+  connect(_is_cluster_head, SIGNAL(toggled(bool)), this, SLOT(toggle_is_cluster_head(bool)));
+  toggle_is_cluster_head(false); // Default is false
+
   QGridLayout * m_layout = new QGridLayout;
   m_layout->addWidget(name_label, 0, 0);
   m_layout->addWidget(_name_line, 0, 1);
@@ -83,6 +91,10 @@ JM::EditSalomeResource::EditSalomeResource(QWidget *parent, BL::SALOMEServices *
   m_layout->addWidget(_applipath_line, 4, 1);
   m_layout->addWidget(componentList_label, 5, 0);
   m_layout->addWidget(component_widget, 5, 1);
+  m_layout->addWidget(is_cluster_head_label, 6, 0);
+  m_layout->addWidget(_is_cluster_head, 6, 1);
+  m_layout->addWidget(working_directory_label, 7, 0);
+  m_layout->addWidget(_working_directory, 7, 1);
   main_groupBox->setLayout(m_layout);
 
   // Part 2
@@ -162,7 +174,7 @@ JM::EditSalomeResource::EditSalomeResource(QWidget *parent, BL::SALOMEServices *
 
   // Part 3
   QDialogButtonBox * buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok
-                                                     | QDialogButtonBox::Cancel);
+                                                      | QDialogButtonBox::Cancel);
 
   connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
   connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
@@ -188,12 +200,14 @@ void
 JM::EditSalomeResource::get_infos()
 {
   BL::ResourceDescr resource_descr = _salome_services->getResourceDescr(_resource_name);
-  
+
   _name_line->setText(QString(resource_descr.name.c_str()));
   _hostname_line->setText(QString(resource_descr.hostname.c_str()));
   _username_line->setText(QString(resource_descr.username.c_str()));
   _applipath_line->setText(QString(resource_descr.applipath.c_str()));
   _os_line->setText(QString(resource_descr.OS.c_str()));
+  _working_directory->setText(QString(resource_descr.working_directory.c_str()));
+  _is_cluster_head->setChecked(resource_descr.is_cluster_head);
 
   std::string protocol = resource_descr.protocol.c_str();
   if (protocol == "ssh")
@@ -238,9 +252,9 @@ JM::EditSalomeResource::get_infos()
     _batch_line->setCurrentIndex(5);
   else if (batch == "ll")
     _batch_line->setCurrentIndex(6);
-  else  
+  else
     _batch_line->setCurrentIndex(-1);
-  
+
   std::string mpiImpl = resource_descr.mpiImpl.c_str();
   if (mpiImpl == "lam")
     _mpiImpl_line->setCurrentIndex(0);
@@ -280,6 +294,7 @@ JM::EditSalomeResource::get_infos()
   _username_line->setCursorPosition(0);
   _applipath_line->setCursorPosition(0);
   _os_line->setCursorPosition(0);
+  _working_directory->setCursorPosition(0);
 }
 
 
@@ -325,6 +340,11 @@ JM::EditSalomeResource::accept()
   resource.username = _username_line->text().toStdString();
   resource.applipath = _applipath_line->text().toStdString();
   resource.OS = _os_line->text().toStdString();
+  resource.working_directory = _working_directory->text().toStdString();
+  if (_is_cluster_head->isChecked())
+    resource.is_cluster_head = true;
+  else
+    resource.is_cluster_head = false;
 
   // Components
   int count = _componentList->count();
@@ -357,3 +377,12 @@ JM::EditSalomeResource::accept()
     QMessageBox::warning(NULL, "Values missing", "name, hostname and protocol are mandatory! Cancel or add values!");
   }
 }
+
+void
+JM::EditSalomeResource::toggle_is_cluster_head(bool checked)
+{
+  if (checked)
+    _is_cluster_head->setText("true");
+  else
+    _is_cluster_head->setText("false");
+}
index 5dc418b8f59ef3724c41fb20b499a5408d2a0b62..8ef2fa05d1fb4e0968382b50370c6d243934f8d2 100644 (file)
@@ -31,9 +31,9 @@ namespace JM
     Q_OBJECT
 
     public:
-      EditSalomeResource(QWidget *parent, 
-                        BL::SALOMEServices * salome_services, 
-                        const std::string & resource_name = "");
+      EditSalomeResource(QWidget *parent,
+                         BL::SALOMEServices * salome_services,
+                         const std::string & resource_name = "");
       virtual ~EditSalomeResource();
 
       void get_infos();
@@ -43,6 +43,7 @@ namespace JM
       void add_component();
       void remove_components();
       void itemSelectionChanged();
+      void toggle_is_cluster_head(bool checked);
 
     protected:
       QWidget* _parent;
@@ -67,6 +68,9 @@ namespace JM
       QSpinBox * _nb_node_line;
       QSpinBox * _nb_proc_per_node_line;
 
+      QLineEdit * _working_directory;
+      QPushButton * _is_cluster_head;
+
       QPushButton * _add_button;
       QPushButton * _remove_button;
   };
index f2ada7fd0b8571caa0375927baf5297f2d220bdd..500de29cc097764fea406e1226e99b52b48858ee 100644 (file)
@@ -45,6 +45,11 @@ JM::SalomeResource::SalomeResource(QWidget *parent, BL::SALOMEServices * salome_
   QLabel * componentList_label = new QLabel("Component List:");
   _componentList = new QListWidget(this);
   _componentList->setViewMode(QListView::ListMode);
+  QLabel * working_directory_label = new QLabel("Working Directory:");
+  _working_directory = new QLineEdit(this);
+  QLabel * is_cluster_head_label = new QLabel("Is Cluster Head:");
+  _is_cluster_head = new QPushButton(this);
+  toggle_is_cluster_head(false); // Default is false
   QGridLayout * m_layout = new QGridLayout;
   m_layout->addWidget(name_label, 0, 0);
   m_layout->addWidget(_name_line, 0, 1);
@@ -58,6 +63,10 @@ JM::SalomeResource::SalomeResource(QWidget *parent, BL::SALOMEServices * salome_
   m_layout->addWidget(_applipath_line, 4, 1);
   m_layout->addWidget(componentList_label, 5, 0);
   m_layout->addWidget(_componentList, 5, 1);
+  m_layout->addWidget(is_cluster_head_label, 6, 0);
+  m_layout->addWidget(_is_cluster_head, 6, 1);
+  m_layout->addWidget(working_directory_label, 7, 0);
+  m_layout->addWidget(_working_directory, 7, 1);
   main_groupBox->setLayout(m_layout);
   
 
@@ -120,6 +129,7 @@ JM::SalomeResource::SalomeResource(QWidget *parent, BL::SALOMEServices * salome_
   _batch_line->setCursorPosition(0);
   _mpiImpl_line->setCursorPosition(0);
   _iprotocol_line->setCursorPosition(0);
+  _working_directory->setCursorPosition(0);
 
   _name_line->setReadOnly(true);
   _hostname_line->setReadOnly(true);
@@ -134,6 +144,7 @@ JM::SalomeResource::SalomeResource(QWidget *parent, BL::SALOMEServices * salome_
   _batch_line->setReadOnly(true);
   _mpiImpl_line->setReadOnly(true);
   _iprotocol_line->setReadOnly(true);
+  _working_directory->setReadOnly(true);
 }
 
 JM::SalomeResource::~SalomeResource()
@@ -155,6 +166,8 @@ JM::SalomeResource::get_infos()
   _batch_line->setText(QString(resource_descr.batch.c_str()));
   _mpiImpl_line->setText(QString(resource_descr.mpiImpl.c_str()));
   _iprotocol_line->setText(QString(resource_descr.iprotocol.c_str()));
+  _working_directory->setText(QString(resource_descr.working_directory.c_str()));
+  toggle_is_cluster_head(resource_descr.is_cluster_head);
 
   QString value;
   _mem_mb_line->setText(value.setNum(resource_descr.mem_mb));
@@ -166,3 +179,12 @@ JM::SalomeResource::get_infos()
    for(; it != resource_descr.componentList.end(); it++)
      _componentList->addItem(QString((*it).c_str()));
 }
+
+void
+JM::SalomeResource::toggle_is_cluster_head(bool checked)
+{
+  if (checked)
+    _is_cluster_head->setText("true");
+  else
+    _is_cluster_head->setText("false");
+}
index 9b0d3f399c1bee405743dbbbddbf4fa645a53b0f..19f0a2e4047f3525da3b9e6642ccf75f779795e7 100644 (file)
@@ -38,6 +38,8 @@ namespace JM
 
       void get_infos();
 
+      void toggle_is_cluster_head(bool checked);
+
     protected:
       QWidget* _parent;
       BL::SALOMEServices * _salome_services;
@@ -50,6 +52,8 @@ namespace JM
       QLineEdit * _username_line;
       QLineEdit * _applipath_line;
       QListWidget * _componentList;
+      QPushButton * _is_cluster_head;
+      QLineEdit * _working_directory;
       QLineEdit * _os_line;
       QLineEdit * _mem_mb_line;
       QLineEdit * _cpu_clock_line;