]> SALOME platform Git repositories - modules/jobmanager.git/commitdiff
Salome HOME
Add Vishnu batch manager and Vishnu specific parameters
authorbarate <barate>
Thu, 1 Dec 2011 08:23:57 +0000 (08:23 +0000)
committerbarate <barate>
Thu, 1 Dec 2011 08:23:57 +0000 (08:23 +0000)
src/engine/BL_Job.cxx
src/engine/BL_Job.hxx
src/engine/BL_SALOMEServices.cxx
src/genericgui/BL_CreateJobWizard.cxx
src/genericgui/BL_CreateJobWizard.hxx
src/genericgui/BL_JobTab.cxx
src/genericgui/BL_JobTab.hxx
src/genericgui/BL_JobsManager_QT.cxx
src/genericgui/JM_EditSalomeResource.cxx

index 19b80847a3f799d618049495089f02290e914682..f7b0b454c402b6d9fae01713a461af2f94867722 100644 (file)
@@ -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)
 {
index d1355b2a0b2ec426604ab08c0fcf685efe6caf0f..719831d9398766bfb014adae9c1cbff12860b891 100644 (file)
@@ -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;
   };
 
index 0fb24e01c4d135d09146c2e90301dda9f63b69f7..80ed3c5e224d1d113dc6175e876ce532ebdb402e 100644 (file)
@@ -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
index a97c52d8b180aec7afa863d6274c110e34a0d280..dcebacfc6183c93f108ca6f8b962f59d5920d090 100644 (file)
@@ -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 
index 6a0d096afe898604515ebf64b5c0caf4ad5304a9..1d78f3138dc54f58729a67d9ca5e85272cdc4462 100644 (file)
@@ -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
index 31ce3c120af5980d885a7c0731ad55fded7e723d..d9f5cde8c8606f915a4e711428df90e51055619a 100644 (file)
@@ -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("");
   }
 }
index 7587d2f2d02d63b79c7a3f46120e2c726d1fd289..0bd87c5a9774564e9e479aeddf38db67313b59d0 100644 (file)
@@ -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;
index 8951cc61878fe198e0b8ac8a67a8a82539cdb0cc..b6cef7235e68865bb98c513c5328264dc7f10dc9 100644 (file)
@@ -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);
index d6ec6a6845b82c092abfd1cd5ad74b8aca20dd49..f8e439b62ac76690298a088836abff53d6e686b1 100644 (file)
@@ -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);