Salome HOME
Update copyrights 2014.
[modules/jobmanager.git] / src / genericgui / BL_JobTab.cxx
index eaf9bbef96ec9a495c42bae42c52f3458120d70b..168e5fb3f1092e18f6370fa29e04c5cab3125c3d 100644 (file)
@@ -1,9 +1,9 @@
-// Copyright (C) 2009-2013  CEA/DEN, EDF R&D
+// Copyright (C) 2009-2014  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.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -24,6 +24,8 @@
 #undef ERROR
 #endif
 
+using namespace std;
+
 BL::JobTab::JobTab(QWidget *parent, BL::JobsManager_QT * jobs_manager) : QTabWidget(parent)
 {
   DEBTRACE("Creating BL::JobTab");
@@ -234,12 +236,31 @@ BL::JobTab::job_selected(const QModelIndex & index)
     _job_rd_label_value->setText(QString(files_params.result_directory.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());
     QString exclText = (batch_params.exclusive)? "yes" : "no";
     _job_excl_label_value->setText(exclText);
 
-       // Parameters for COORM
+    // Memory requirement
+    unsigned long long mem_mb = batch_params.mem_limit;
+    ostringstream mem_ss;
+    if (mem_mb % 1024 == 0)
+      mem_ss << mem_mb / 1024 << "GB";
+    else
+      mem_ss << mem_mb << "MB";
+    switch (batch_params.mem_req_type)
+    {
+    case BL::Job::MEM_PER_NODE:
+      mem_ss << " per node";
+      break;
+    case BL::Job::MEM_PER_CPU:
+      mem_ss << " per core";
+      break;
+    default:
+      throw Exception("Unknown memory requirement, unable to show selected job");
+    }
+    _job_em_label_value->setText(QString(mem_ss.str().c_str()));
+
+    // Parameters for COORM
     _job_lf_label_value->setText(QString(batch_params.launcher_file.c_str()));
     _job_la_label_value->setText(QString(batch_params.launcher_args.c_str()));