From 63efa9d2325b759b897c90b36600262dc6c113aa Mon Sep 17 00:00:00 2001 From: barate Date: Thu, 1 Dec 2011 08:23:57 +0000 Subject: [PATCH] Add Vishnu batch manager and Vishnu specific parameters --- src/engine/BL_Job.cxx | 55 ++++++++ src/engine/BL_Job.hxx | 17 +++ src/engine/BL_SALOMEServices.cxx | 52 ++++++++ src/genericgui/BL_CreateJobWizard.cxx | 155 +++++++++++++++++++++++ src/genericgui/BL_CreateJobWizard.hxx | 14 ++ src/genericgui/BL_JobTab.cxx | 23 ++++ src/genericgui/BL_JobTab.hxx | 8 ++ src/genericgui/BL_JobsManager_QT.cxx | 4 + src/genericgui/JM_EditSalomeResource.cxx | 3 + 9 files changed, 331 insertions(+) diff --git a/src/engine/BL_Job.cxx b/src/engine/BL_Job.cxx index 19b8084..f7b0b45 100644 --- a/src/engine/BL_Job.cxx +++ b/src/engine/BL_Job.cxx @@ -37,6 +37,10 @@ BL::Job::Job() _salome_launcher_id = -1; _dump_yacs_state = 0; _ll_jobtype = ""; + _vishnu_password = ""; + _vishnu_hostname = ""; + _vishnu_host_login = ""; + _vishnu_host_workdir = ""; } BL::Job::Job(const std::string & name) @@ -57,6 +61,10 @@ BL::Job::Job(const std::string & name) _salome_launcher_id = -1; _dump_yacs_state = 0; _ll_jobtype = ""; + _vishnu_password = ""; + _vishnu_hostname = ""; + _vishnu_host_login = ""; + _vishnu_host_workdir = ""; } BL::Job::~Job() @@ -204,6 +212,53 @@ BL::Job::getLoadLevelerJobType() return _ll_jobtype; } +void +BL::Job::setVishnuPassword(const std::string & vishnu_password) +{ + _vishnu_password = vishnu_password; +} + +const std::string & +BL::Job::getVishnuPassword() +{ + return _vishnu_password; +} + +void BL::Job::setVishnuHostname(const std::string & vishnu_hostname) +{ + _vishnu_hostname = vishnu_hostname; +} + +const std::string & +BL::Job::getVishnuHostname() +{ + return _vishnu_hostname; +} + +void +BL::Job::setVishnuHostLogin(const std::string & vishnu_host_login) +{ + _vishnu_host_login = vishnu_host_login; +} + +const std::string & +BL::Job::getVishnuHostLogin() +{ + return _vishnu_host_login; +} + +void +BL::Job::setVishnuHostWorkdir(const std::string & vishnu_host_workdir) +{ + _vishnu_host_workdir = vishnu_host_workdir; +} + +const std::string & +BL::Job::getVishnuHostWorkdir() +{ + return _vishnu_host_workdir; +} + void BL::Job::setState(BL::Job::State state) { diff --git a/src/engine/BL_Job.hxx b/src/engine/BL_Job.hxx index d1355b2..719831d 100644 --- a/src/engine/BL_Job.hxx +++ b/src/engine/BL_Job.hxx @@ -84,6 +84,18 @@ namespace BL{ void setLoadLevelerJobType(const std::string & jobtype); std::string & getLoadLevelerJobType(); + void setVishnuPassword(const std::string & vishnu_password); + const std::string & getVishnuPassword(); + + void setVishnuHostname(const std::string & vishnu_hostname); + const std::string & getVishnuHostname(); + + void setVishnuHostLogin(const std::string & vishnu_host_login); + const std::string & getVishnuHostLogin(); + + void setVishnuHostWorkdir(const std::string & vishnu_host_workdir); + const std::string & getVishnuHostWorkdir(); + enum State {CREATED, IN_PROCESS, QUEUED, RUNNING, PAUSED, FINISHED, ERROR, FAILED, NOT_CREATED}; void setState(BL::Job::State state); BL::Job::State getState(); @@ -113,6 +125,11 @@ namespace BL{ std::string _batch_queue; std::string _ll_jobtype; + std::string _vishnu_password; + std::string _vishnu_hostname; + std::string _vishnu_host_login; + std::string _vishnu_host_workdir; + int _salome_launcher_id; }; diff --git a/src/engine/BL_SALOMEServices.cxx b/src/engine/BL_SALOMEServices.cxx index 0fb24e0..80ed3c5 100644 --- a/src/engine/BL_SALOMEServices.cxx +++ b/src/engine/BL_SALOMEServices.cxx @@ -273,6 +273,38 @@ BL::SALOMEServices::create_job(BL::Job * job) new_parameter->value = CORBA::string_dup(job->getLoadLevelerJobType().c_str()); job_parameters->specific_parameters[job_parameters->specific_parameters.length() - 1] = new_parameter; } + if (job->getVishnuPassword() != "") + { + 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("VishnuPassword"); + new_parameter->value = CORBA::string_dup(job->getVishnuPassword().c_str()); + job_parameters->specific_parameters[job_parameters->specific_parameters.length() - 1] = new_parameter; + } + if (job->getVishnuHostname() != "") + { + 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("VishnuHostname"); + new_parameter->value = CORBA::string_dup(job->getVishnuHostname().c_str()); + job_parameters->specific_parameters[job_parameters->specific_parameters.length() - 1] = new_parameter; + } + if (job->getVishnuHostLogin() != "") + { + 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("VishnuHostLogin"); + new_parameter->value = CORBA::string_dup(job->getVishnuHostLogin().c_str()); + job_parameters->specific_parameters[job_parameters->specific_parameters.length() - 1] = new_parameter; + } + if (job->getVishnuHostWorkdir() != "") + { + 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("VishnuHostWorkdir"); + new_parameter->value = CORBA::string_dup(job->getVishnuHostWorkdir().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()); @@ -604,6 +636,26 @@ BL::SALOMEServices::get_new_job(int job_number) std::string user_value = job_parameters->specific_parameters[i].value.in(); job_return->setLoadLevelerJobType(user_value); } + if (std::string(job_parameters->specific_parameters[i].name.in()) == "VishnuPassword") + { + std::string user_value = job_parameters->specific_parameters[i].value.in(); + job_return->setVishnuPassword(user_value); + } + if (std::string(job_parameters->specific_parameters[i].name.in()) == "VishnuHostname") + { + std::string user_value = job_parameters->specific_parameters[i].value.in(); + job_return->setVishnuHostname(user_value); + } + if (std::string(job_parameters->specific_parameters[i].name.in()) == "VishnuHostLogin") + { + std::string user_value = job_parameters->specific_parameters[i].value.in(); + job_return->setVishnuHostLogin(user_value); + } + if (std::string(job_parameters->specific_parameters[i].name.in()) == "VishnuHostWorkdir") + { + std::string user_value = job_parameters->specific_parameters[i].value.in(); + job_return->setVishnuHostWorkdir(user_value); + } } // Get current state diff --git a/src/genericgui/BL_CreateJobWizard.cxx b/src/genericgui/BL_CreateJobWizard.cxx index a97c52d..dcebacf 100644 --- a/src/genericgui/BL_CreateJobWizard.cxx +++ b/src/genericgui/BL_CreateJobWizard.cxx @@ -57,6 +57,11 @@ BL::CreateJobWizard::CreateJobWizard(BL::JobsManager_QT * jobs_manager, BL::SALO dump_yacs_state = -1; ll_jobtype = ""; + vishnu_password = ""; + vishnu_hostname = ""; + vishnu_host_login = ""; + vishnu_host_workdir = ""; + setOptions(QWizard::IndependentPages | QWizard::NoBackButtonOnStartPage); // Common pages @@ -167,6 +172,11 @@ BL::CreateJobWizard::clone(const std::string & name) setField("resource_choosed", QString(job->getResource().c_str())); setField("batch_queue", QString(job->getBatchQueue().c_str())); setField("ll_jobtype", QString(job->getLoadLevelerJobType().c_str())); + + setField("vishnu_password", QString(job->getVishnuPassword().c_str())); + setField("vishnu_hostname", QString(job->getVishnuHostname().c_str())); + setField("vishnu_host_login", QString(job->getVishnuHostLogin().c_str())); + setField("vishnu_host_workdir", QString(job->getVishnuHostWorkdir().c_str())); } } @@ -271,6 +281,26 @@ BL::CreateJobWizard::end(int result) ll_jobtype = ""; } + // Vishnu parameters + if (batch == "vishnu") + { + QString f_vishnu_password = field("vishnu_password").toString(); + vishnu_password = f_vishnu_password.toStdString(); + QString f_vishnu_hostname = field("vishnu_hostname").toString(); + vishnu_hostname = f_vishnu_hostname.toStdString(); + QString f_vishnu_host_login = field("vishnu_host_login").toString(); + vishnu_host_login = f_vishnu_host_login.toStdString(); + QString f_vishnu_host_workdir = field("vishnu_host_workdir").toString(); + vishnu_host_workdir = f_vishnu_host_workdir.toStdString(); + } + else + { + vishnu_password = ""; + vishnu_hostname = ""; + vishnu_host_login = ""; + vishnu_host_workdir = ""; + } + start_job = field("start_job").toBool(); } } @@ -924,6 +954,35 @@ BL::ResourcePage::ResourcePage(BL::CreateJobWizard * parent, BL::SALOMEServices _ll_label->hide(); _ll_value->hide(); + _vishnu_password_label = new QLabel("Vishnu password (not secure!!!):", this); + _vishnu_password_value = new QLineEdit(this); + QString tt = "This password will be transmitted and stored without encryption. " + "This mechanism is absolutely not secure. " + "Do never use any of your \"real\" passwords here."; + _vishnu_password_label->setToolTip(tt); + _vishnu_password_value->setToolTip(tt); + registerField("vishnu_password", _vishnu_password_value); + _vishnu_password_label->hide(); + _vishnu_password_value->hide(); + + _vishnu_hostname_label = new QLabel("Vishnu hostname:", this); + _vishnu_hostname_value = new QLineEdit(this); + registerField("vishnu_hostname", _vishnu_hostname_value); + _vishnu_hostname_label->hide(); + _vishnu_hostname_value->hide(); + + _vishnu_host_login_label = new QLabel("Vishnu host login:", this); + _vishnu_host_login_value = new QLineEdit(this); + registerField("vishnu_host_login", _vishnu_host_login_value); + _vishnu_host_login_label->hide(); + _vishnu_host_login_value->hide(); + + _vishnu_host_workdir_label = new QLabel("Vishnu host working directory:", this); + _vishnu_host_workdir_value = new QLineEdit(this); + registerField("vishnu_host_workdir", _vishnu_host_workdir_value); + _vishnu_host_workdir_label->hide(); + _vishnu_host_workdir_value->hide(); + _main_layout = new QGridLayout; _main_layout->addWidget(resource_group_box, 0, 0, 1, -1); _main_layout->addWidget(resource_label, 1, 0); @@ -947,6 +1006,29 @@ BL::ResourcePage::initializePage() _ll_label->show(); _ll_value->show(); } + + if (field("vishnu_password").toString() != "") + { + _main_layout->addWidget(_vishnu_password_label, 3, 0); + _main_layout->addWidget(_vishnu_password_value, 3, 1); + _vishnu_password_label->show(); + _vishnu_password_value->show(); + + _main_layout->addWidget(_vishnu_hostname_label, 4, 0); + _main_layout->addWidget(_vishnu_hostname_value, 4, 1); + _vishnu_hostname_label->show(); + _vishnu_hostname_value->show(); + + _main_layout->addWidget(_vishnu_host_login_label, 5, 0); + _main_layout->addWidget(_vishnu_host_login_value, 5, 1); + _vishnu_host_login_label->show(); + _vishnu_host_login_value->show(); + + _main_layout->addWidget(_vishnu_host_workdir_label, 6, 0); + _main_layout->addWidget(_vishnu_host_workdir_value, 6, 1); + _vishnu_host_workdir_label->show(); + _vishnu_host_workdir_value->show(); + } } bool @@ -970,6 +1052,33 @@ BL::ResourcePage::validatePage() return false; } } + if (batch == "vishnu") + { + QString vishnu_password = field("vishnu_password").toString(); + if (vishnu_password == "") + { + QMessageBox::warning(NULL, "Vishnu Error", "Please define a Vishnu password"); + return false; + } + QString vishnu_hostname = field("vishnu_hostname").toString(); + if (vishnu_hostname == "") + { + QMessageBox::warning(NULL, "Vishnu Error", "Please define a Vishnu hostname"); + return false; + } + QString vishnu_host_login = field("vishnu_host_login").toString(); + if (vishnu_host_login == "") + { + QMessageBox::warning(NULL, "Vishnu Error", "Please define a login for Vishnu host"); + return false; + } + QString vishnu_host_workdir = field("vishnu_host_workdir").toString(); + if (vishnu_host_workdir == "") + { + QMessageBox::warning(NULL, "Vishnu Error", "Please define a working directory on Vishnu host"); + return false; + } + } return true; } @@ -997,6 +1106,52 @@ BL::ResourcePage::itemSelected(QListWidgetItem * item) _ll_label->hide(); _ll_value->hide(); } + + // Specific parameters for Vishnu + if (batch == "vishnu") + { + _main_layout->addWidget(_vishnu_password_label, 3, 0); + _main_layout->addWidget(_vishnu_password_value, 3, 1); + _vishnu_password_label->show(); + _vishnu_password_value->show(); + + _main_layout->addWidget(_vishnu_hostname_label, 4, 0); + _main_layout->addWidget(_vishnu_hostname_value, 4, 1); + _vishnu_hostname_label->show(); + _vishnu_hostname_value->show(); + + _main_layout->addWidget(_vishnu_host_login_label, 5, 0); + _main_layout->addWidget(_vishnu_host_login_value, 5, 1); + _vishnu_host_login_label->show(); + _vishnu_host_login_value->show(); + + _main_layout->addWidget(_vishnu_host_workdir_label, 6, 0); + _main_layout->addWidget(_vishnu_host_workdir_value, 6, 1); + _vishnu_host_workdir_label->show(); + _vishnu_host_workdir_value->show(); + } + else + { + _main_layout->removeWidget(_vishnu_password_label); + _main_layout->removeWidget(_vishnu_password_value); + _vishnu_password_label->hide(); + _vishnu_password_value->hide(); + + _main_layout->removeWidget(_vishnu_hostname_label); + _main_layout->removeWidget(_vishnu_hostname_value); + _vishnu_hostname_label->hide(); + _vishnu_hostname_value->hide(); + + _main_layout->removeWidget(_vishnu_host_login_label); + _main_layout->removeWidget(_vishnu_host_login_value); + _vishnu_host_login_label->hide(); + _vishnu_host_login_value->hide(); + + _main_layout->removeWidget(_vishnu_host_workdir_label); + _main_layout->removeWidget(_vishnu_host_workdir_value); + _vishnu_host_workdir_label->hide(); + _vishnu_host_workdir_value->hide(); + } } int diff --git a/src/genericgui/BL_CreateJobWizard.hxx b/src/genericgui/BL_CreateJobWizard.hxx index 6a0d096..1d78f31 100644 --- a/src/genericgui/BL_CreateJobWizard.hxx +++ b/src/genericgui/BL_CreateJobWizard.hxx @@ -84,6 +84,11 @@ namespace BL{ int dump_yacs_state; std::string ll_jobtype; + std::string vishnu_password; + std::string vishnu_hostname; + std::string vishnu_host_login; + std::string vishnu_host_workdir; + public: enum {Page_JobName, Page_YACSSchema, @@ -199,6 +204,15 @@ namespace BL{ QLabel * _ll_label; QLineEdit * _ll_value; QGridLayout * _main_layout; + + QLabel * _vishnu_password_label; + QLineEdit * _vishnu_password_value; + QLabel * _vishnu_hostname_label; + QLineEdit * _vishnu_hostname_value; + QLabel * _vishnu_host_login_label; + QLineEdit * _vishnu_host_login_value; + QLabel * _vishnu_host_workdir_label; + QLineEdit * _vishnu_host_workdir_value; }; class YACSSchemaPage: virtual public QWizardPage diff --git a/src/genericgui/BL_JobTab.cxx b/src/genericgui/BL_JobTab.cxx index 31ce3c1..d9f5cde 100644 --- a/src/genericgui/BL_JobTab.cxx +++ b/src/genericgui/BL_JobTab.cxx @@ -108,6 +108,14 @@ BL::JobTab::createJobSummaryTab() _batch_queue_value = new QLabel(""); _ll_jobtype_label = new QLabel("LoadLeveler JobType:"); _ll_jobtype_value = new QLabel(""); + _vishnu_password_label = new QLabel("Vishnu password:"); + _vishnu_password_value = new QLabel(""); + _vishnu_hostname_label = new QLabel("Vishnu hostname:"); + _vishnu_hostname_value = new QLabel(""); + _vishnu_host_login_label = new QLabel("Vishnu host login:"); + _vishnu_host_login_value = new QLabel(""); + _vishnu_host_workdir_label = new QLabel("Vishnu host working directory:"); + _vishnu_host_workdir_value = new QLabel(""); QGroupBox * run_values_box = new QGroupBox("Run values"); _run_values_form = new QFormLayout; @@ -251,6 +259,17 @@ BL::JobTab::job_selected(const QModelIndex & index) _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); } + if (job->getVishnuPassword() != "") + { + _vishnu_password_value->setText(QVariant(job->getVishnuPassword().c_str()).toString()); + _other_run_values_form->insertRow(_other_run_values_form->rowCount(), _vishnu_password_label, _vishnu_password_value); + _vishnu_hostname_value->setText(QVariant(job->getVishnuHostname().c_str()).toString()); + _other_run_values_form->insertRow(_other_run_values_form->rowCount(), _vishnu_hostname_label, _vishnu_hostname_value); + _vishnu_host_login_value->setText(QVariant(job->getVishnuHostLogin().c_str()).toString()); + _other_run_values_form->insertRow(_other_run_values_form->rowCount(), _vishnu_host_login_label, _vishnu_host_login_value); + _vishnu_host_workdir_value->setText(QVariant(job->getVishnuHostWorkdir().c_str()).toString()); + _other_run_values_form->insertRow(_other_run_values_form->rowCount(), _vishnu_host_workdir_label, _vishnu_host_workdir_value); + } } else DEBTRACE ("itemFromIndex returns 0 !"); @@ -313,5 +332,9 @@ BL::JobTab::reset(QString job_name) _yacs_dump_state_value->setText(""); _batch_queue_value->setText(""); _ll_jobtype_value->setText(""); + _vishnu_password_value->setText(""); + _vishnu_hostname_value->setText(""); + _vishnu_host_login_value->setText(""); + _vishnu_host_workdir_value->setText(""); } } diff --git a/src/genericgui/BL_JobTab.hxx b/src/genericgui/BL_JobTab.hxx index 7587d2f..0bd87c5 100644 --- a/src/genericgui/BL_JobTab.hxx +++ b/src/genericgui/BL_JobTab.hxx @@ -80,6 +80,14 @@ namespace BL QLabel * _batch_queue_value; QLabel * _ll_jobtype_label; QLabel * _ll_jobtype_value; + QLabel * _vishnu_password_label; + QLabel * _vishnu_password_value; + QLabel * _vishnu_hostname_label; + QLabel * _vishnu_hostname_value; + QLabel * _vishnu_host_login_label; + QLabel * _vishnu_host_login_value; + QLabel * _vishnu_host_workdir_label; + QLabel * _vishnu_host_workdir_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 8951cc6..b6cef72 100644 --- a/src/genericgui/BL_JobsManager_QT.cxx +++ b/src/genericgui/BL_JobsManager_QT.cxx @@ -301,6 +301,10 @@ BL::JobsManager_QT::create_job_with_wizard(BL::CreateJobWizard & wizard) new_job->setResource(wizard.resource_choosed); new_job->setBatchQueue(wizard.batch_queue); new_job->setLoadLevelerJobType(wizard.ll_jobtype); + new_job->setVishnuPassword(wizard.vishnu_password); + new_job->setVishnuHostname(wizard.vishnu_hostname); + new_job->setVishnuHostLogin(wizard.vishnu_host_login); + new_job->setVishnuHostWorkdir(wizard.vishnu_host_workdir); // End addJobToLauncher(wizard.job_name); diff --git a/src/genericgui/JM_EditSalomeResource.cxx b/src/genericgui/JM_EditSalomeResource.cxx index d6ec6a6..f8e439b 100644 --- a/src/genericgui/JM_EditSalomeResource.cxx +++ b/src/genericgui/JM_EditSalomeResource.cxx @@ -125,6 +125,7 @@ JM::EditSalomeResource::EditSalomeResource(QWidget *parent, BL::SALOMEServices * _batch_line->addItem("ccc"); _batch_line->addItem("slurm"); _batch_line->addItem("ll"); + _batch_line->addItem("vishnu"); _batch_line->setCurrentIndex(-1); QLabel * mpiImpl_label = new QLabel("MPI impl:"); @@ -226,6 +227,8 @@ JM::EditSalomeResource::get_infos() _batch_line->setCurrentIndex(5); else if (batch == "ll") _batch_line->setCurrentIndex(6); + else if (batch == "vishnu") + _batch_line->setCurrentIndex(7); else _batch_line->setCurrentIndex(-1); -- 2.39.2