From c7c51148d24fb21255c8abeb6547d1f58a80b0ee Mon Sep 17 00:00:00 2001 From: ribes Date: Thu, 28 Apr 2011 14:21:49 +0000 Subject: [PATCH] Adding the support LoadLeveler --- src/engine/BL_Job.cxx | 14 +++++ src/engine/BL_Job.hxx | 4 ++ src/engine/BL_SALOMEServices.cxx | 13 +++++ src/genericgui/BL_CreateJobWizard.cxx | 81 ++++++++++++++++++++++++--- src/genericgui/BL_CreateJobWizard.hxx | 7 +++ src/genericgui/BL_JobTab.cxx | 50 +++++++++++------ src/genericgui/BL_JobTab.hxx | 9 ++- src/genericgui/BL_JobsManager_QT.cxx | 1 + 8 files changed, 151 insertions(+), 28 deletions(-) diff --git a/src/engine/BL_Job.cxx b/src/engine/BL_Job.cxx index 2e5c22a..5ebbf2a 100644 --- a/src/engine/BL_Job.cxx +++ b/src/engine/BL_Job.cxx @@ -36,6 +36,7 @@ BL::Job::Job() _thread_state = BL::Job::NOTHING; _salome_launcher_id = -1; _dump_yacs_state = 0; + _ll_jobtype = ""; } BL::Job::Job(const std::string & name) @@ -55,6 +56,7 @@ BL::Job::Job(const std::string & name) _thread_state = BL::Job::NOTHING; _salome_launcher_id = -1; _dump_yacs_state = 0; + _ll_jobtype = ""; } BL::Job::~Job() @@ -190,6 +192,18 @@ BL::Job::getBatchQueue() return _batch_queue; } +void +BL::Job::setLoadLevelerJobType(const std::string & jobtype) +{ + _ll_jobtype = jobtype; +} + +std::string & +BL::Job::getLoadLevelerJobType() +{ + return _ll_jobtype; +} + void BL::Job::setState(BL::Job::State state) { diff --git a/src/engine/BL_Job.hxx b/src/engine/BL_Job.hxx index 7d39dcc..45ac352 100644 --- a/src/engine/BL_Job.hxx +++ b/src/engine/BL_Job.hxx @@ -76,6 +76,9 @@ namespace BL{ void setBatchQueue(const std::string & queue); std::string & getBatchQueue(); + void setLoadLevelerJobType(const std::string & jobtype); + std::string & getLoadLevelerJobType(); + enum State {CREATED, IN_PROCESS, QUEUED, RUNNING, PAUSED, FINISHED, ERROR, FAILED, NOT_CREATED}; void setState(BL::Job::State state); BL::Job::State getState(); @@ -103,6 +106,7 @@ namespace BL{ BL::Job::FilesParam _files_params; std::string _resource_choosed; std::string _batch_queue; + std::string _ll_jobtype; int _salome_launcher_id; }; diff --git a/src/engine/BL_SALOMEServices.cxx b/src/engine/BL_SALOMEServices.cxx index 6456831..c9a532f 100644 --- a/src/engine/BL_SALOMEServices.cxx +++ b/src/engine/BL_SALOMEServices.cxx @@ -265,6 +265,14 @@ BL::SALOMEServices::create_job(BL::Job * job) job_parameters->specific_parameters[job_parameters->specific_parameters.length() - 1] = new_parameter; } } + if (job->getLoadLevelerJobType() != "") + { + job_parameters->specific_parameters.length(job_parameters->specific_parameters.length() + 1); + Engines::Parameter_var new_parameter = new Engines::Parameter; + new_parameter->name = CORBA::string_dup("LoalLevelerJobType"); + new_parameter->value = CORBA::string_dup(job->getLoadLevelerJobType().c_str()); + job_parameters->specific_parameters[job_parameters->specific_parameters.length() - 1] = new_parameter; + } // Files job_parameters->job_name = CORBA::string_dup(job->getName().c_str()); @@ -565,6 +573,11 @@ BL::SALOMEServices::get_new_job(int job_number) iss >> value; job_return->setDumpYACSState(value); } + if (std::string(job_parameters->specific_parameters[i].name.in()) == "LoalLevelerJobType") + { + std::string user_value = job_parameters->specific_parameters[i].value.in(); + job_return->setLoadLevelerJobType(user_value); + } } // Get current state diff --git a/src/genericgui/BL_CreateJobWizard.cxx b/src/genericgui/BL_CreateJobWizard.cxx index 58cf6a1..e0d3e97 100644 --- a/src/genericgui/BL_CreateJobWizard.cxx +++ b/src/genericgui/BL_CreateJobWizard.cxx @@ -30,6 +30,7 @@ BL::CreateJobWizard::CreateJobWizard(BL::JobsManager_QT * jobs_manager, BL::SALO BL_ASSERT(jobs_manager); BL_ASSERT(salome_services); _jobs_manager = jobs_manager; + _salome_services = salome_services; job_name = ""; yacs_file = ""; @@ -48,6 +49,7 @@ BL::CreateJobWizard::CreateJobWizard(BL::JobsManager_QT * jobs_manager, BL::SALO start_job = false; dump_yacs_state = -1; + ll_jobtype = ""; setOptions(QWizard::IndependentPages | QWizard::NoBackButtonOnStartPage); @@ -158,6 +160,7 @@ BL::CreateJobWizard::clone(const std::string & name) setField("result_directory", QString(files_params.result_directory.c_str())); setField("resource_choosed", QString(job->getResource().c_str())); setField("batch_queue", QString(job->getBatchQueue().c_str())); + setField("ll_jobtype", QString(job->getLoadLevelerJobType().c_str())); } } @@ -247,7 +250,20 @@ BL::CreateJobWizard::end(int result) // Batch Queue QString f_batch_queue = field("batch_queue").toString(); - batch_queue = f_batch_queue.toStdString(); + batch_queue = f_batch_queue.toStdString(); + + // LoadLeveler JobType + BL::ResourceDescr resource_descr = _salome_services->getResourceDescr(resource_choosed); + std::string batch = resource_descr.batch.c_str(); + if (batch == "ll") + { + QString f_ll_jobtype = field("ll_jobtype").toString(); + ll_jobtype = f_ll_jobtype.toStdString(); + } + else + { + ll_jobtype = ""; + } start_job = field("start_job").toBool(); } @@ -892,18 +908,37 @@ BL::ResourcePage::ResourcePage(BL::CreateJobWizard * parent, BL::SALOMEServices QLineEdit * _bqLineEdit = new QLineEdit(this); registerField("batch_queue", _bqLineEdit); - QGridLayout * main_layout = new QGridLayout; - main_layout->addWidget(resource_group_box, 0, 0, 1, -1); - main_layout->addWidget(resource_label, 1, 0); - main_layout->addWidget(_resource_choosed, 1, 1); - main_layout->addWidget(bqLabel, 2, 0); - main_layout->addWidget(_bqLineEdit, 2, 1); - setLayout(main_layout); + _ll_label = new QLabel("LoadLeveler JobType:", this); + _ll_value = new QLineEdit(this); + registerField("ll_jobtype", _ll_value); + _ll_label->hide(); + _ll_value->hide(); + + _main_layout = new QGridLayout; + _main_layout->addWidget(resource_group_box, 0, 0, 1, -1); + _main_layout->addWidget(resource_label, 1, 0); + _main_layout->addWidget(_resource_choosed, 1, 1); + _main_layout->addWidget(bqLabel, 2, 0); + _main_layout->addWidget(_bqLineEdit, 2, 1); + setLayout(_main_layout); + }; BL::ResourcePage::~ResourcePage() {} +void +BL::ResourcePage::initializePage() +{ + if (field("ll_jobtype").toString() != "") + { + _main_layout->addWidget(_ll_label, 3, 0); + _main_layout->addWidget(_ll_value, 3, 1); + _ll_label->show(); + _ll_value->show(); + } +} + bool BL::ResourcePage::validatePage() { @@ -913,6 +948,18 @@ BL::ResourcePage::validatePage() QMessageBox::warning(NULL, "Resource Error", "Please choose a resource"); return false; } + + BL::ResourceDescr resource_descr = _salome_services->getResourceDescr(resource_choosed.toStdString()); + std::string batch = resource_descr.batch.c_str(); + if (batch == "ll") + { + QString ll_jobtype = field("ll_jobtype").toString(); + if (ll_jobtype == "") + { + QMessageBox::warning(NULL, "LoadLeveler Error", "Please define a LoadLeveler JobType"); + return false; + } + } return true; } @@ -922,6 +969,24 @@ BL::ResourcePage::itemSelected(QListWidgetItem * item) _resource_choosed->setReadOnly(false); _resource_choosed->setText(item->text()); _resource_choosed->setReadOnly(true); + + //Specific parameters for LoadLeveler + BL::ResourceDescr resource_descr = _salome_services->getResourceDescr(item->text().toStdString()); + std::string batch = resource_descr.batch.c_str(); + if (batch == "ll") + { + _main_layout->addWidget(_ll_label, 3, 0); + _main_layout->addWidget(_ll_value, 3, 1); + _ll_label->show(); + _ll_value->show(); + } + else + { + _main_layout->removeWidget(_ll_value); + _main_layout->removeWidget(_ll_label); + _ll_label->hide(); + _ll_value->hide(); + } } int diff --git a/src/genericgui/BL_CreateJobWizard.hxx b/src/genericgui/BL_CreateJobWizard.hxx index ded0a2d..2e1227e 100644 --- a/src/genericgui/BL_CreateJobWizard.hxx +++ b/src/genericgui/BL_CreateJobWizard.hxx @@ -56,6 +56,7 @@ namespace BL{ QListWidget * _output_files_list; BL::JobNamePage * _job_name_page; + BL::SALOMEServices * _salome_services; public: // Results @@ -81,6 +82,7 @@ namespace BL{ bool start_job; int dump_yacs_state; + std::string ll_jobtype; public: enum {Page_JobName, @@ -184,6 +186,7 @@ namespace BL{ virtual int nextId() const; virtual bool validatePage(); + virtual void initializePage(); public slots: void itemSelected(QListWidgetItem * item); @@ -192,6 +195,10 @@ namespace BL{ JM::ResourceCatalog * _resource_list; QLineEdit * _resource_choosed; BL::SALOMEServices * _salome_services; + + QLabel * _ll_label; + QLineEdit * _ll_value; + QGridLayout * _main_layout; }; class YACSSchemaPage: virtual public QWizardPage diff --git a/src/genericgui/BL_JobTab.cxx b/src/genericgui/BL_JobTab.cxx index 335f5d6..a2a13f6 100644 --- a/src/genericgui/BL_JobTab.cxx +++ b/src/genericgui/BL_JobTab.cxx @@ -99,19 +99,25 @@ BL::JobTab::createJobSummaryTab() QLabel * job_nop_label = new QLabel("Number of processors:"); _job_nop_label_value = new QLabel(""); + // Specific values + _batch_queue_label = new QLabel("Batch queue:"); + _batch_queue_value = new QLabel(""); + _ll_jobtype_label = new QLabel("LoadLeveler JobType:"); + _ll_jobtype_value = new QLabel(""); + QGroupBox * run_values_box = new QGroupBox("Run values"); - QFormLayout * run_values_form = new QFormLayout; - run_values_form->insertRow(0, job_nif_label, _job_nif_label_value); - run_values_form->insertRow(1, job_nof_label, _job_nof_label_value); - run_values_form->insertRow(2, job_bd_label, _job_bd_label_value); - run_values_form->insertRow(3, job_rd_label, _job_rd_label_value); - QFormLayout * other_run_values_form = new QFormLayout; - other_run_values_form->insertRow(0, job_mdt_label, _job_mdt_label_value); - other_run_values_form->insertRow(1, job_em_label, _job_em_label_value); - other_run_values_form->insertRow(2, job_nop_label, _job_nop_label_value); + _run_values_form = new QFormLayout; + _run_values_form->insertRow(0, job_nif_label, _job_nif_label_value); + _run_values_form->insertRow(1, job_nof_label, _job_nof_label_value); + _run_values_form->insertRow(2, job_bd_label, _job_bd_label_value); + _run_values_form->insertRow(3, job_rd_label, _job_rd_label_value); + _other_run_values_form = new QFormLayout; + _other_run_values_form->insertRow(0, job_mdt_label, _job_mdt_label_value); + _other_run_values_form->insertRow(1, job_em_label, _job_em_label_value); + _other_run_values_form->insertRow(2, job_nop_label, _job_nop_label_value); QHBoxLayout * box_layout = new QHBoxLayout(); - box_layout->addLayout(run_values_form); - box_layout->addLayout(other_run_values_form); + box_layout->addLayout(_run_values_form); + box_layout->addLayout(_other_run_values_form); run_values_box->setLayout(box_layout); QVBoxLayout * mainLayout = new QVBoxLayout(); @@ -233,6 +239,16 @@ BL::JobTab::job_selected(const QModelIndex & index) _yacs_dump_state_value->setText(QVariant(job->getDumpYACSState()).toString()); _main_values_form->insertRow(7, _yacs_dump_state_label, _yacs_dump_state_value); } + if (job->getBatchQueue() != "") + { + _batch_queue_value->setText(QVariant(job->getBatchQueue().c_str()).toString()); + _other_run_values_form->insertRow(_other_run_values_form->rowCount(), _batch_queue_label, _batch_queue_value); + } + if (job->getLoadLevelerJobType() != "") + { + _ll_jobtype_value->setText(QVariant(job->getLoadLevelerJobType().c_str()).toString()); + _other_run_values_form->insertRow(_other_run_values_form->rowCount(), _ll_jobtype_label, _ll_jobtype_value); + } } else DEBTRACE ("itemFromIndex returns 0 !"); @@ -290,11 +306,9 @@ BL::JobTab::reset(QString job_name) _input_files_list->clear(); _output_files_list->clear(); - // Specific parameters management - DEBTRACE("_yacs_dump_state_value->text():--" << _yacs_dump_state_value->text().toStdString() << "--"); - if (_yacs_dump_state_value->text() != "") - { - _yacs_dump_state_value->setText(""); - createJobSummaryTab(); - } + _yacs_dump_state_value->setText(""); + _batch_queue_value->setText(""); + _ll_jobtype_value->setText(""); + + createJobSummaryTab(); } diff --git a/src/genericgui/BL_JobTab.hxx b/src/genericgui/BL_JobTab.hxx index 72232bf..8024e99 100644 --- a/src/genericgui/BL_JobTab.hxx +++ b/src/genericgui/BL_JobTab.hxx @@ -24,7 +24,7 @@ #include "BL_JobsManager_QT.hxx" -namespace BL +namespace BL { class JobTab: public QTabWidget { @@ -53,7 +53,6 @@ namespace BL QWidget * _files_tab; // Main Values - QGroupBox * _main_values_box; QFormLayout * _main_values_form; QLabel * _job_name_label_value; QLabel * _job_type_label_value; @@ -64,6 +63,8 @@ namespace BL QLabel * _job_envfile_label_value; // Run Values + QFormLayout * _run_values_form; + QFormLayout * _other_run_values_form; QLabel * _job_nif_label_value; QLabel * _job_nof_label_value; QLabel * _job_bd_label_value; @@ -75,6 +76,10 @@ namespace BL // Specific Values QLabel * _yacs_dump_state_label; QLabel * _yacs_dump_state_value; + QLabel * _batch_queue_label; + QLabel * _batch_queue_value; + QLabel * _ll_jobtype_label; + QLabel * _ll_jobtype_value; QListWidget * _input_files_list; QListWidget * _output_files_list; diff --git a/src/genericgui/BL_JobsManager_QT.cxx b/src/genericgui/BL_JobsManager_QT.cxx index ec742af..b8c0de8 100644 --- a/src/genericgui/BL_JobsManager_QT.cxx +++ b/src/genericgui/BL_JobsManager_QT.cxx @@ -283,6 +283,7 @@ BL::JobsManager_QT::create_job_with_wizard(BL::CreateJobWizard & wizard) new_job->setFilesParameters(files_params); new_job->setResource(wizard.resource_choosed); new_job->setBatchQueue(wizard.batch_queue); + new_job->setLoadLevelerJobType(wizard.ll_jobtype); // End addJobToLauncher(wizard.job_name); -- 2.39.2