#ifndef _JOBMANAGER_IDL_
#define _JOBMANAGER_IDL_
-#include "SALOME_ContainerManager.idl"
+#include "SALOME_Launcher.idl"
module JOBMANAGER
{
}
std::list<std::string>
-BL::SALOMEServices::getResourceList()
+BL::SALOMEServices::getResourceList(bool batch_only)
{
std::list<std::string> resource_list;
{
Engines::ResourceParameters params;
_lcc->preSet(params);
+ params.can_launch_batch_jobs = batch_only;
Engines::ResourceList * resourceList = NULL;
try
{
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;
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());
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
std::string mpiImpl;
std::string iprotocol;
- bool is_cluster_head;
+ bool can_launch_batch_jobs;
+ bool can_run_containers;
std::string working_directory;
};
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);
// 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();
/* 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);
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);
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
_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")
_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);
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();
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");
-}
void add_component();
void remove_components();
void itemSelectionChanged();
- void toggle_is_cluster_head(bool checked);
protected:
QWidget* _parent;
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;
#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);
_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++)
{
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++)
{
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();
QPushButton * _add_button;
QPushButton * _remove_button;
QListWidget * _resource_files_list;
+ bool _batch_only;
};
}
_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);
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");
_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()
_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));
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");
-}
void get_infos();
- void toggle_is_cluster_head(bool checked);
-
protected:
QWidget* _parent;
BL::SALOMEServices * _salome_services;
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;