]> SALOME platform Git repositories - modules/jobmanager.git/blobdiff - src/genericgui/BL_JobTab.cxx
Salome HOME
Merge from V6_main_20120808 08Aug12
[modules/jobmanager.git] / src / genericgui / BL_JobTab.cxx
index 5f139cc7f0bf71e0cae8dc84b94dbaaed103b2bb..91fbfd66b0e8f4b35bc36de64ffaf229127b3de7 100644 (file)
@@ -1,25 +1,29 @@
-//  Copyright (C) 2009 CEA/DEN, EDF R&D
+// Copyright (C) 2009-2012  CEA/DEN, EDF R&D
 //
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
 //
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
 //
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
 #include "BL_JobTab.hxx"
 #include "BL_Traces.hxx"
 
+#ifdef WNT
+#undef ERROR
+#endif
+
 BL::JobTab::JobTab(QWidget *parent, BL::JobsManager_QT * jobs_manager) : QTabWidget(parent)
 {
   DEBTRACE("Creating BL::JobTab");
@@ -31,9 +35,6 @@ BL::JobTab::JobTab(QWidget *parent, BL::JobsManager_QT * jobs_manager) : QTabWid
 
   createJobSummaryTab();
   createJobFilesTab();
-
-  addTab(_summary_tab, "Job Summary");
-  addTab(_files_tab, "Job Files");
 }
 
 BL::JobTab::~JobTab()
@@ -61,19 +62,30 @@ BL::JobTab::createJobSummaryTab()
   _job_type_label_value = new QLabel("");
   QLabel * job_state_label = new QLabel("State:");
   _job_state_label_value = new QLabel("");
-  QLabel * job_machine_label = new QLabel("Machine:");
-  _job_machine_label_value = new QLabel("");
-  _job_command_label = new QLabel("Schema or Command:");
-  _job_command_label_value = new QLabel("");
+  QLabel * job_launcher_label = new QLabel("Launcher Id:");
+  _job_launcher_label_value = new QLabel("");
+  QLabel * job_resource_label = new QLabel("Resource:");
+  _job_resource_label_value = new QLabel("");
+  QLabel * job_jobfile_label = new QLabel("Job File:");
+  _job_jobfile_label_value = new QLabel("");
+  QLabel * job_envfile_label = new QLabel("Env File:");
+  _job_envfile_label_value = new QLabel("");
+
+
+  // Specific values
+  _yacs_dump_state_label = new QLabel("YACS dump state:");
+  _yacs_dump_state_value = new QLabel("");
 
   QGroupBox * main_values_box = new QGroupBox("Main values");
-  QFormLayout * values_form = new QFormLayout;
-  values_form->insertRow(0, job_name_label, _job_name_label_value);
-  values_form->insertRow(1, job_type_label, _job_type_label_value);
-  values_form->insertRow(2, job_state_label, _job_state_label_value);
-  values_form->insertRow(3, job_machine_label, _job_machine_label_value);
-  values_form->insertRow(4, _job_command_label, _job_command_label_value);
-  main_values_box->setLayout(values_form);
+  _main_values_form = new QFormLayout;
+  _main_values_form->insertRow(0, job_name_label, _job_name_label_value);
+  _main_values_form->insertRow(1, job_type_label, _job_type_label_value);
+  _main_values_form->insertRow(2, job_state_label, _job_state_label_value);
+  _main_values_form->insertRow(3, job_launcher_label, _job_launcher_label_value);
+  _main_values_form->insertRow(4, job_resource_label, _job_resource_label_value);
+  _main_values_form->insertRow(5, job_jobfile_label, _job_jobfile_label_value);
+  _main_values_form->insertRow(6, job_envfile_label, _job_envfile_label_value);
+  main_values_box->setLayout(_main_values_form);
 
   QLabel * job_nif_label = new QLabel("Number of Input Files:");
   _job_nif_label_value = new QLabel("");
@@ -84,39 +96,49 @@ BL::JobTab::createJobSummaryTab()
   QLabel * job_rd_label = new QLabel("Result directory:");
   _job_rd_label_value = new QLabel("");
 
-  QLabel * job_edt_label = new QLabel("Expected during time:");
-  _job_edt_label_value = new QLabel("");
+  QLabel * job_mdt_label = new QLabel("Maximum duration:");
+  _job_mdt_label_value = new QLabel("");
   QLabel * job_em_label = new QLabel("Expected memory:");
   _job_em_label_value = new QLabel("");
   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_edt_label, _job_edt_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();
   mainLayout->addWidget(main_values_box);
   mainLayout->addWidget(run_values_box);
   _summary_tab->setLayout(mainLayout);
+
+  removeTab(0);
+  insertTab(0, _summary_tab, "Job Summary");
+  setCurrentIndex(0);
 }
 
 void
 BL::JobTab::createJobFilesTab()
 {
   _files_tab = new QWidget(this);
-  
+
   _input_files_list = new QListWidget(this);
   _input_files_list->setSelectionMode(QAbstractItemView::NoSelection);
   QGroupBox * input_files_box = new QGroupBox("Input Files");
@@ -135,6 +157,8 @@ BL::JobTab::createJobFilesTab()
   mainLayout->addWidget(input_files_box);
   mainLayout->addWidget(output_files_box);
   _files_tab->setLayout(mainLayout);
+
+  insertTab(1, _files_tab, "Job Files");
 }
 
 void
@@ -147,6 +171,8 @@ BL::JobTab::job_selected(const QModelIndex & index)
   {
     BL::Job * job = _jobs_manager->getJob(item_name->text().toStdString());
 
+    reset("");
+
     _job_name_label_value->setText(QString(job->getName().c_str()));
 
     if (job->getState() == BL::Job::CREATED)
@@ -161,23 +187,24 @@ BL::JobTab::job_selected(const QModelIndex & index)
       _job_state_label_value->setText("Paused");
     else if (job->getState() == BL::Job::ERROR)
       _job_state_label_value->setText("Error");
+    else if (job->getState() == BL::Job::FAILED)
+      _job_state_label_value->setText("Failed");
+    else if (job->getState() == BL::Job::NOT_CREATED)
+      _job_state_label_value->setText("Not Created");
     else 
       _job_state_label_value->setText("Finished");
 
+    _job_launcher_label_value->setText(QVariant(job->getSalomeLauncherId()).toString());
+    _job_jobfile_label_value->setText(QString(job->getJobFile().c_str()));
+    _job_envfile_label_value->setText(QString(job->getEnvFile().c_str()));
     if (job->getType() == BL::Job::YACS_SCHEMA)
-    {
-      _job_command_label->setText("Schema:");
-      _job_command_label_value->setText(QString(job->getYACSFile().c_str()));
       _job_type_label_value->setText("YACS_Schema");
-    }
-    else
-    {
-      _job_command_label->setText("Command:");
-      _job_command_label_value->setText(QString(job->getCommand().c_str()));
+    else if (job->getType() == BL::Job::COMMAND)
       _job_type_label_value->setText("Command");
-    }
+    else if (job->getType() == BL::Job::PYTHON_SALOME)
+      _job_type_label_value->setText("Python_Salome");
 
-    _job_machine_label_value->setText(QString(job->getMachine().c_str()));
+    _job_resource_label_value->setText(QString(job->getResource().c_str()));
 
     BL::Job::BatchParam batch_params = job->getBatchParameters();
 
@@ -189,10 +216,12 @@ BL::JobTab::job_selected(const QModelIndex & index)
     _job_bd_label_value->setText(QString(batch_params.batch_directory.c_str()));
     _job_rd_label_value->setText(QString(files_params.result_directory.c_str()));
 
-    _job_edt_label_value->setText(QString(batch_params.expected_during_time.c_str()));
+    _job_mdt_label_value->setText(QString(batch_params.maximum_duration.c_str()));
     _job_em_label_value->setText(QString(batch_params.expected_memory.c_str()));
     _job_nop_label_value->setText(QVariant(batch_params.nb_proc).toString());
 
+    _input_files_list->clear();
+    _output_files_list->clear();
     std::list<std::string>::iterator it;
     for (it = files_params.input_files_list.begin(); it != files_params.input_files_list.end(); it++)
     {
@@ -205,6 +234,23 @@ BL::JobTab::job_selected(const QModelIndex & index)
       _output_files_list->addItem(QString(file.c_str()));
     }
 
+    // Specific parameters management
+    if (job->getDumpYACSState() > 0)
+    {
+      // Add widget in the layout
+      _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 !");
@@ -232,6 +278,10 @@ BL::JobTab::itemChanged(QStandardItem * item)
       _job_state_label_value->setText("Paused");
     else if (job->getState() == BL::Job::ERROR)
       _job_state_label_value->setText("Error");
+    else if (job->getState() == BL::Job::FAILED)
+      _job_state_label_value->setText("Failed");
+    else if (job->getState() == BL::Job::NOT_CREATED)
+      _job_state_label_value->setText("Not Created");
     else 
       _job_state_label_value->setText("Finished");
   }
@@ -240,20 +290,28 @@ BL::JobTab::itemChanged(QStandardItem * item)
 void
 BL::JobTab::reset(QString job_name)
 {
-  _job_name_label_value->setText("");
-  _job_type_label_value->setText("");
-  _job_state_label_value->setText("");
-  _job_machine_label_value->setText("");
-  _job_nif_label_value->setText("");
-  _job_nof_label_value->setText("");
-  _job_bd_label_value->setText("");
-  _job_rd_label_value->setText("");
-  _job_edt_label_value->setText("");
-  _job_em_label_value->setText("");
-  _job_nop_label_value->setText("");
-  _job_command_label->setText("Schema or Command:");
-  _job_command_label_value->setText("");
-
-  _input_files_list->clear();
-  _output_files_list->clear();
+  if (job_name == _job_name_label_value->text() || job_name == "")
+  {
+    _job_name_label_value->setText("");
+    _job_type_label_value->setText("");
+    _job_state_label_value->setText("");
+    _job_launcher_label_value->setText("");
+    _job_resource_label_value->setText("");
+    _job_nif_label_value->setText("");
+    _job_nof_label_value->setText("");
+    _job_bd_label_value->setText("");
+    _job_rd_label_value->setText("");
+    _job_mdt_label_value->setText("");
+    _job_em_label_value->setText("");
+    _job_nop_label_value->setText("");
+    _job_jobfile_label_value->setText("");
+    _job_envfile_label_value->setText("");
+
+    _input_files_list->clear();
+    _output_files_list->clear();
+
+    _yacs_dump_state_value->setText("");
+    _batch_queue_value->setText("");
+    _ll_jobtype_value->setText("");
+  }
 }