From 72ddf50a9554170f4f1d21d540efc6ed5e24d12f Mon Sep 17 00:00:00 2001 From: barate Date: Wed, 28 Aug 2013 15:53:23 +0000 Subject: [PATCH] Add job parameter 'exclusive' to let the user choose to share nodes or not (EDF issue #2700) --- src/engine/BL_Job.cxx | 15 +++++---------- src/engine/BL_Job.hxx | 5 +++-- src/engine/BL_SALOMEServices.cxx | 2 ++ src/genericgui/BL_CreateJobWizard.cxx | 26 +++++++++++++++++++++++--- src/genericgui/BL_CreateJobWizard.hxx | 1 + src/genericgui/BL_JobTab.cxx | 8 +++++++- src/genericgui/BL_JobTab.hxx | 1 + src/genericgui/BL_JobsManager_QT.cxx | 1 + 8 files changed, 43 insertions(+), 16 deletions(-) diff --git a/src/engine/BL_Job.cxx b/src/engine/BL_Job.cxx index b179ba6..ba78cef 100644 --- a/src/engine/BL_Job.cxx +++ b/src/engine/BL_Job.cxx @@ -29,6 +29,7 @@ BL::Job::Job() _batch_params.maximum_duration = ""; _batch_params.expected_memory = ""; _batch_params.nb_proc = 0; + _batch_params.exclusive = false; _files_params.result_directory = ""; _resource_choosed = ""; _batch_queue = ""; @@ -53,6 +54,7 @@ BL::Job::Job(const std::string & name) _batch_params.maximum_duration = ""; _batch_params.expected_memory = ""; _batch_params.nb_proc = 0; + _batch_params.exclusive = false; _files_params.result_directory = ""; _resource_choosed = ""; _batch_queue = ""; @@ -148,19 +150,12 @@ BL::Job::getEnvFile() } void -BL::Job::setBatchParameters(BL::Job::BatchParam & param) +BL::Job::setBatchParameters(const BL::Job::BatchParam & param) { - _batch_params.batch_directory = param.batch_directory; - _batch_params.maximum_duration = param.maximum_duration; - _batch_params.expected_memory = param.expected_memory; - _batch_params.nb_proc = param.nb_proc; - - // Parameters for COORM - _batch_params.launcher_file = param.launcher_file; - _batch_params.launcher_args = param.launcher_args; + _batch_params = param; } -BL::Job::BatchParam & +const BL::Job::BatchParam & BL::Job::getBatchParameters() { return _batch_params; diff --git a/src/engine/BL_Job.hxx b/src/engine/BL_Job.hxx index 576ee8c..464abb3 100644 --- a/src/engine/BL_Job.hxx +++ b/src/engine/BL_Job.hxx @@ -62,13 +62,14 @@ namespace BL{ std::string maximum_duration; std::string expected_memory; int nb_proc; + bool exclusive; // Parameters for COORM std::string launcher_file; std::string launcher_args; }; - void setBatchParameters(BL::Job::BatchParam & param); - BL::Job::BatchParam & getBatchParameters(); + void setBatchParameters(const BL::Job::BatchParam & param); + const BL::Job::BatchParam & getBatchParameters(); struct FilesParam { diff --git a/src/engine/BL_SALOMEServices.cxx b/src/engine/BL_SALOMEServices.cxx index 0eb772e..911e564 100644 --- a/src/engine/BL_SALOMEServices.cxx +++ b/src/engine/BL_SALOMEServices.cxx @@ -320,6 +320,7 @@ BL::SALOMEServices::create_job(BL::Job * job) job_parameters->resource_required.name = CORBA::string_dup(job->getResource().c_str()); job_parameters->resource_required.nb_proc = cpp_batch_params.nb_proc; job_parameters->queue = CORBA::string_dup(job->getBatchQueue().c_str()); + job_parameters->exclusive = cpp_batch_params.exclusive; // Memory CORBA::Long memory; @@ -623,6 +624,7 @@ BL::SALOMEServices::get_new_job(int job_number) batch_param.batch_directory = job_parameters->work_directory.in(); batch_param.maximum_duration = job_parameters->maximum_duration.in(); batch_param.nb_proc = job_parameters->resource_required.nb_proc; + batch_param.exclusive = job_parameters->exclusive; std::ostringstream mem_stream; mem_stream << job_parameters->resource_required.mem_mb << "mb"; batch_param.expected_memory = mem_stream.str(); diff --git a/src/genericgui/BL_CreateJobWizard.cxx b/src/genericgui/BL_CreateJobWizard.cxx index a59b944..646d253 100644 --- a/src/genericgui/BL_CreateJobWizard.cxx +++ b/src/genericgui/BL_CreateJobWizard.cxx @@ -157,6 +157,8 @@ BL::CreateJobWizard::clone(const std::string & name) proc_value.setNum(batch_params.nb_proc); setField("proc_value", proc_value); + setField("exclusive", batch_params.exclusive); + if (batch_params.maximum_duration == "") { setField("duration_hour", 0); @@ -285,6 +287,7 @@ BL::CreateJobWizard::end(int result) expected_memory = mem.trimmed().toStdString() + mem_type.toStdString(); nb_proc = field("proc_value").toInt(); + exclusive = field("exclusive").toBool(); // Files Panel QString f_result_directory = field("result_directory").toString(); @@ -389,21 +392,30 @@ void BL::JobNamePage::yacs_schema_button(bool checked) { if (checked) + { _explanation->setText("This job permits to launch a YACS schema into a SALOME application"); + setField("exclusive", true); + } } void BL::JobNamePage::command_button(bool checked) { if (checked) + { _explanation->setText("This job permits to launch a script into a distributed resource. This script is not launched into a SALOME application"); + setField("exclusive", false); + } } void BL::JobNamePage::python_salome_button(bool checked) { if (checked) + { _explanation->setText("This job permits to launch a python script into a SALOME application"); + setField("exclusive", true); + } } bool @@ -647,7 +659,7 @@ BL::BatchParametersPage::BatchParametersPage(QWidget * parent, BL::SALOMEService registerField("batch_directory", line_directory); // exected during time - QLabel * label_duration = new QLabel("Maximum during time: "); + QLabel * label_duration = new QLabel("Time limit: "); QSpinBox * spin_duration_hour = new QSpinBox(this); QLabel * label_duration_hour = new QLabel("Hours"); spin_duration_hour->setMinimum(0); @@ -660,7 +672,7 @@ BL::BatchParametersPage::BatchParametersPage(QWidget * parent, BL::SALOMEService registerField("duration_min", spin_duration_min); // memory - QLabel * label_memory = new QLabel("Memory per nodes expected: "); + QLabel * label_memory = new QLabel("Memory per node: "); QSpinBox * spin_memory = new QSpinBox(this); spin_memory->setMinimum(0); spin_memory->setMaximum(1000000); @@ -672,12 +684,18 @@ BL::BatchParametersPage::BatchParametersPage(QWidget * parent, BL::SALOMEService registerField("mem_type", combo_memory); // proc - QLabel * label_proc = new QLabel("Number of proc expected: "); + QLabel * label_proc = new QLabel("Number of cores: "); QSpinBox * spin_proc = new QSpinBox(this); spin_proc->setMinimum(1); spin_proc->setMaximum(1000000); registerField("proc_value", spin_proc); + // exclusive + QLabel * label_exclusive = new QLabel("Exclusive (do not share nodes with other jobs): "); + QCheckBox * check_exclusive = new QCheckBox(this); + check_exclusive->setChecked(true); + registerField("exclusive", check_exclusive); + QGridLayout *layout = new QGridLayout; layout->addWidget(label_directory, 0, 0); layout->addWidget(line_directory, 0, 1, 1, -1); @@ -691,6 +709,8 @@ BL::BatchParametersPage::BatchParametersPage(QWidget * parent, BL::SALOMEService layout->addWidget(combo_memory, 2, 2); layout->addWidget(label_proc, 3, 0); layout->addWidget(spin_proc, 3, 1); + layout->addWidget(label_exclusive, 4, 0); + layout->addWidget(check_exclusive, 4, 1); main_layout->insertLayout(-1, layout); diff --git a/src/genericgui/BL_CreateJobWizard.hxx b/src/genericgui/BL_CreateJobWizard.hxx index a509604..cbdcdbe 100644 --- a/src/genericgui/BL_CreateJobWizard.hxx +++ b/src/genericgui/BL_CreateJobWizard.hxx @@ -76,6 +76,7 @@ namespace BL{ std::string maximum_duration; std::string expected_memory; int nb_proc; + bool exclusive; // Parameters for COORM std::string launcher_file; diff --git a/src/genericgui/BL_JobTab.cxx b/src/genericgui/BL_JobTab.cxx index 7fa6322..eaf9bbe 100644 --- a/src/genericgui/BL_JobTab.cxx +++ b/src/genericgui/BL_JobTab.cxx @@ -102,6 +102,8 @@ BL::JobTab::createJobSummaryTab() _job_em_label_value = new QLabel(""); QLabel * job_nop_label = new QLabel("Number of processors:"); _job_nop_label_value = new QLabel(""); + QLabel * job_excl_label = new QLabel("Exclusive:"); + _job_excl_label_value = new QLabel(""); // Parameters for COORM QLabel * job_lf_label = new QLabel("Launcher file:"); @@ -129,9 +131,10 @@ BL::JobTab::createJobSummaryTab() _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); + _other_run_values_form->insertRow(3, job_excl_label, _job_excl_label_value); // Parameters for COORM - _other_run_values_form->insertRow(3, job_la_label, _job_la_label_value); + _other_run_values_form->insertRow(4, job_la_label, _job_la_label_value); QHBoxLayout * box_layout = new QHBoxLayout(); box_layout->addLayout(_run_values_form); @@ -233,6 +236,8 @@ BL::JobTab::job_selected(const QModelIndex & index) _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 _job_lf_label_value->setText(QString(batch_params.launcher_file.c_str())); @@ -322,6 +327,7 @@ BL::JobTab::reset(QString job_name) _job_mdt_label_value->setText(""); _job_em_label_value->setText(""); _job_nop_label_value->setText(""); + _job_excl_label_value->setText(""); _job_jobfile_label_value->setText(""); _job_envfile_label_value->setText(""); diff --git a/src/genericgui/BL_JobTab.hxx b/src/genericgui/BL_JobTab.hxx index 3f9226b..1b8f229 100644 --- a/src/genericgui/BL_JobTab.hxx +++ b/src/genericgui/BL_JobTab.hxx @@ -72,6 +72,7 @@ namespace BL QLabel * _job_mdt_label_value; QLabel * _job_em_label_value; QLabel * _job_nop_label_value; + QLabel * _job_excl_label_value; // Specific Values QLabel * _yacs_dump_state_label; diff --git a/src/genericgui/BL_JobsManager_QT.cxx b/src/genericgui/BL_JobsManager_QT.cxx index 74820cc..987f1f8 100644 --- a/src/genericgui/BL_JobsManager_QT.cxx +++ b/src/genericgui/BL_JobsManager_QT.cxx @@ -308,6 +308,7 @@ BL::JobsManager_QT::create_job_with_wizard(BL::CreateJobWizard & wizard) param.maximum_duration = wizard.maximum_duration; param.expected_memory = wizard.expected_memory; param.nb_proc = wizard.nb_proc; + param.exclusive = wizard.exclusive; // Parameters for COORM param.launcher_file = wizard.launcher_file; -- 2.39.2