Salome HOME
Merge from BR_LIBBATCH_2_0
authorbarate <barate>
Fri, 15 Feb 2013 13:40:41 +0000 (13:40 +0000)
committerbarate <barate>
Fri, 15 Feb 2013 13:40:41 +0000 (13:40 +0000)
idl/JOBMANAGER_IDL.idl
src/engine/BL_SALOMEServices.cxx
src/engine/BL_SALOMEServices.hxx
src/genericgui/BL_CreateJobWizard.cxx
src/genericgui/BL_GenericGui.cxx
src/genericgui/JM_EditSalomeResource.cxx
src/genericgui/JM_EditSalomeResource.hxx
src/genericgui/JM_ResourceCatalog.cxx
src/genericgui/JM_ResourceCatalog.hxx
src/genericgui/JM_SalomeResource.cxx
src/genericgui/JM_SalomeResource.hxx

index 2b72d619b117ab25a54365069baf1bcea49e6adf..f3692ccf243bf4a0a0e137c07cc1e0a99bf1e603 100644 (file)
@@ -20,7 +20,7 @@
 #ifndef _JOBMANAGER_IDL_
 #define _JOBMANAGER_IDL_
 
-#include "SALOME_ContainerManager.idl"
+#include "SALOME_Launcher.idl"
 
 module JOBMANAGER
 {
index 273c51737bc815fb8542c89ad42f14faf066ebe5..06e1a1d522a245bfabc063810cb2128969a3477a 100644 (file)
@@ -87,7 +87,7 @@ BL::SALOMEServices::initNS()
 }
 
 std::list<std::string> 
-BL::SALOMEServices::getResourceList()
+BL::SALOMEServices::getResourceList(bool batch_only)
 {
   std::list<std::string> resource_list;
   
@@ -95,6 +95,7 @@ BL::SALOMEServices::getResourceList()
   {
     Engines::ResourceParameters params;
     _lcc->preSet(params);
+    params.can_launch_batch_jobs = batch_only;
     Engines::ResourceList * resourceList = NULL;
     try
     {
@@ -162,7 +163,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.can_launch_batch_jobs = resource_definition->can_launch_batch_jobs;
+    resource_descr.can_run_containers = resource_definition->can_run_containers;
     resource_descr.working_directory = resource_definition->working_directory.in();
 
     delete resource_definition;
@@ -177,6 +179,10 @@ BL::SALOMEServices::addResource(BL::ResourceDescr & new_resource)
 
   resource_definition->name = CORBA::string_dup(new_resource.name.c_str());
   resource_definition->hostname = CORBA::string_dup(new_resource.hostname.c_str());
+  if (new_resource.batch == "" || new_resource.batch == "ssh_batch")
+    resource_definition->type = CORBA::string_dup("single_machine");
+  else
+    resource_definition->type = CORBA::string_dup("cluster");
   resource_definition->protocol = CORBA::string_dup(new_resource.protocol.c_str());
   resource_definition->username = CORBA::string_dup(new_resource.username.c_str());
   resource_definition->applipath = CORBA::string_dup(new_resource.applipath.c_str());
@@ -198,7 +204,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->can_launch_batch_jobs = new_resource.can_launch_batch_jobs;
+  resource_definition->can_run_containers = new_resource.can_run_containers;
   resource_definition->working_directory = CORBA::string_dup(new_resource.working_directory.c_str());
 
   try
index f3500cc06e0f0854572a6046c4f3bf7c73bd424f..217fd64bd6409c331a29f66818bcc84abe095a6c 100644 (file)
@@ -58,7 +58,8 @@ namespace BL{
     std::string mpiImpl;
     std::string iprotocol;
 
-    bool is_cluster_head;
+    bool can_launch_batch_jobs;
+    bool can_run_containers;
     std::string working_directory;
   };
 
@@ -74,7 +75,7 @@ namespace BL{
 
       void set_manager(BL::JobsManager * manager) {_manager = manager;}
 
-      std::list<std::string> getResourceList();
+      std::list<std::string> getResourceList(bool batch_only);
       BL::ResourceDescr getResourceDescr(const std::string& name);
       void addResource(BL::ResourceDescr & new_resource);
       void removeResource(const std::string & name);
index 8b24f65120b27909eae078fd9c9ab135052ed32b..1e951b573b425095b912822aecd53afc80346c20 100644 (file)
@@ -943,7 +943,7 @@ BL::ResourcePage::ResourcePage(BL::CreateJobWizard * parent, BL::SALOMEServices
 
   // input_Resource
   QGroupBox * resource_group_box = new QGroupBox("Resource List");
-  _resource_list = new JM::ResourceCatalog(this, _salome_services);
+  _resource_list = new JM::ResourceCatalog(this, _salome_services, true);
   connect(_resource_list->getQListWidget(), SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(itemSelected(QListWidgetItem*)));
 
   QVBoxLayout * resource_list_layout = new QVBoxLayout();
index b195661b38ffd6ef73232f0fc2e1c4503a8b3d17..a9bc1f7d1578d3f484cefcd1735fad971e3c63aa 100644 (file)
@@ -64,7 +64,7 @@ BL::GenericGui::createDockWidgets()
   /* ResourceCatalog */
   _dw_resource_catalog = new QDockWidget(_dock_parent);
   _dw_resource_catalog->setWindowTitle("Resource Catalog");
-  _resource_catalog = new JM::ResourceCatalog(_dw_resource_catalog, _salome_services);
+  _resource_catalog = new JM::ResourceCatalog(_dw_resource_catalog, _salome_services, false);
   QScrollArea * scroll_widget_resource = new QScrollArea(_dw_resource_catalog);
   scroll_widget_resource->setWidget(_resource_catalog);
   scroll_widget_resource->setWidgetResizable(true);
index 9d1edf64c006d48378fb8e03e474776ff5c24c4e..030d4340c3f5247f74cb89663e455de0b16c3479 100644 (file)
@@ -72,11 +72,8 @@ JM::EditSalomeResource::EditSalomeResource(QWidget *parent, BL::SALOMEServices *
 
   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
+  _can_launch_batch_jobs = new QCheckBox("This resource can be used to launch batch jobs", this);
+  _can_run_containers = new QCheckBox("This resource can be used to run interactive containers", this);
 
   QGridLayout * m_layout = new QGridLayout;
   m_layout->addWidget(name_label, 0, 0);
@@ -91,10 +88,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);
+  m_layout->addWidget(working_directory_label, 6, 0);
+  m_layout->addWidget(_working_directory, 6, 1);
+  m_layout->addWidget(_can_launch_batch_jobs, 7, 1);
+  m_layout->addWidget(_can_run_containers, 8, 1);
   main_groupBox->setLayout(m_layout);
 
   // Part 2
@@ -208,7 +205,16 @@ JM::EditSalomeResource::get_infos()
   _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);
+
+  if (resource_descr.can_launch_batch_jobs)
+    _can_launch_batch_jobs->setCheckState(Qt::Checked);
+  else
+    _can_launch_batch_jobs->setCheckState(Qt::Unchecked);
+
+  if (resource_descr.can_run_containers)
+    _can_run_containers->setCheckState(Qt::Checked);
+  else
+    _can_run_containers->setCheckState(Qt::Unchecked);
 
   std::string protocol = resource_descr.protocol.c_str();
   if (protocol == "ssh")
@@ -245,7 +251,7 @@ JM::EditSalomeResource::get_infos()
     _batch_line->setCurrentIndex(1);
   else if (batch == "sge")  
     _batch_line->setCurrentIndex(2);
-  else if (batch == "ssh")
+  else if (batch == "ssh_batch")
     _batch_line->setCurrentIndex(3);
   else if (batch == "ccc")
     _batch_line->setCurrentIndex(4);
@@ -344,10 +350,8 @@ JM::EditSalomeResource::accept()
   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;
+  resource.can_launch_batch_jobs = (_can_launch_batch_jobs->checkState() == Qt::Checked);
+  resource.can_run_containers = (_can_run_containers->checkState() == Qt::Checked);
 
   // Components
   int count = _componentList->count();
@@ -380,12 +384,3 @@ 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 0938ca89ec6b85f56e4d63fffbb111c0e7b7c653..c36f5922368acc077f6b075ac6b542a698fbdcc4 100644 (file)
@@ -43,7 +43,6 @@ namespace JM
       void add_component();
       void remove_components();
       void itemSelectionChanged();
-      void toggle_is_cluster_head(bool checked);
 
     protected:
       QWidget* _parent;
@@ -69,7 +68,8 @@ namespace JM
       QSpinBox * _nb_proc_per_node_line;
 
       QLineEdit * _working_directory;
-      QPushButton * _is_cluster_head;
+      QCheckBox * _can_launch_batch_jobs;
+      QCheckBox * _can_run_containers;
 
       QPushButton * _add_button;
       QPushButton * _remove_button;
index 749f0af22862b68148da14e0144f14fa46119eee..6017d9bf683ab80200c6295e1b189bca8c8d8680 100644 (file)
@@ -22,7 +22,9 @@
 #include "JM_SalomeResource.hxx"
 #include "JM_EditSalomeResource.hxx"
 
-JM::ResourceCatalog::ResourceCatalog(QWidget *parent, BL::SALOMEServices * salome_services) : QWidget(parent)
+JM::ResourceCatalog::ResourceCatalog(QWidget *parent, BL::SALOMEServices * salome_services, bool batch_only)
+: QWidget(parent),
+  _batch_only(batch_only)
 {
   DEBTRACE("Creating JM::ResourceCatalog");
   BL_ASSERT(parent);
@@ -34,7 +36,7 @@ JM::ResourceCatalog::ResourceCatalog(QWidget *parent, BL::SALOMEServices * salom
   _refresh_button->show();
   _resource_files_list = new QListWidget(this);
   _resource_files_list->setSelectionMode(QAbstractItemView::SingleSelection);
-  std::list<std::string> resource_list = _salome_services->getResourceList();
+  std::list<std::string> resource_list = _salome_services->getResourceList(_batch_only);
   std::list<std::string>::iterator it;
   for (it = resource_list.begin(); it != resource_list.end(); it++)
   {
@@ -91,7 +93,7 @@ void
 JM::ResourceCatalog::refresh_resource_list()
 {
   _resource_files_list->clear();
-  std::list<std::string> resource_list = _salome_services->getResourceList();
+  std::list<std::string> resource_list = _salome_services->getResourceList(_batch_only);
   std::list<std::string>::iterator it;
   for (it = resource_list.begin(); it != resource_list.end(); it++)
   {
index 2d1b2f53630008154113f148acde26abbf43d72f..c66cd0dc891cd08ad86e0e5c510d73641cfbe5fd 100644 (file)
@@ -34,7 +34,7 @@ namespace JM
     Q_OBJECT
 
     public:
-      ResourceCatalog(QWidget *parent, BL::SALOMEServices * salome_services);
+      ResourceCatalog(QWidget *parent, BL::SALOMEServices * salome_services, bool batch_only);
       virtual ~ResourceCatalog();
 
       void get_infos();
@@ -60,6 +60,7 @@ namespace JM
       QPushButton * _add_button;
       QPushButton * _remove_button;
       QListWidget * _resource_files_list;
+      bool _batch_only;
   };
 }
 
index 6c2cb9ccff4e882d75f6ef17dd040d52c5713d00..c124ad5785c77d12cd622e508f12a34f0f6c465f 100644 (file)
@@ -47,9 +47,8 @@ JM::SalomeResource::SalomeResource(QWidget *parent, BL::SALOMEServices * salome_
   _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
+  _can_launch_batch_jobs = new QCheckBox("This resource can be used to launch batch jobs", this);
+  _can_run_containers = new QCheckBox("This resource can be used to run interactive containers", this);
   QGridLayout * m_layout = new QGridLayout;
   m_layout->addWidget(name_label, 0, 0);
   m_layout->addWidget(_name_line, 0, 1);
@@ -63,10 +62,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);
+  m_layout->addWidget(working_directory_label, 6, 0);
+  m_layout->addWidget(_working_directory, 6, 1);
+  m_layout->addWidget(_can_launch_batch_jobs, 7, 1);
+  m_layout->addWidget(_can_run_containers, 8, 1);
   main_groupBox->setLayout(m_layout);
 
   QGroupBox * config_groupBox = new QGroupBox("Configuration values");
@@ -144,6 +143,8 @@ JM::SalomeResource::SalomeResource(QWidget *parent, BL::SALOMEServices * salome_
   _mpiImpl_line->setReadOnly(true);
   _iprotocol_line->setReadOnly(true);
   _working_directory->setReadOnly(true);
+  _can_launch_batch_jobs->setEnabled(false);
+  _can_run_containers->setEnabled(false);
 }
 
 JM::SalomeResource::~SalomeResource()
@@ -166,7 +167,16 @@ JM::SalomeResource::get_infos()
   _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);
+
+  if (resource_descr.can_launch_batch_jobs)
+    _can_launch_batch_jobs->setCheckState(Qt::Checked);
+  else
+    _can_launch_batch_jobs->setCheckState(Qt::Unchecked);
+
+  if (resource_descr.can_run_containers)
+    _can_run_containers->setCheckState(Qt::Checked);
+  else
+    _can_run_containers->setCheckState(Qt::Unchecked);
 
   QString value;
   _mem_mb_line->setText(value.setNum(resource_descr.mem_mb));
@@ -178,12 +188,3 @@ 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 dc80b1c60ebff527d94f559c3c83144c0ee33ffb..62f5589013b9699858eacf81d0bd5bd60b31fe5d 100644 (file)
@@ -38,8 +38,6 @@ namespace JM
 
       void get_infos();
 
-      void toggle_is_cluster_head(bool checked);
-
     protected:
       QWidget* _parent;
       BL::SALOMEServices * _salome_services;
@@ -52,7 +50,8 @@ namespace JM
       QLineEdit * _username_line;
       QLineEdit * _applipath_line;
       QListWidget * _componentList;
-      QPushButton * _is_cluster_head;
+      QCheckBox * _can_launch_batch_jobs;
+      QCheckBox * _can_run_containers;
       QLineEdit * _working_directory;
       QLineEdit * _os_line;
       QLineEdit * _mem_mb_line;