From 2de77efd252c09cee37d592e319fb5b425125026 Mon Sep 17 00:00:00 2001 From: Ovidiu Mircescu Date: Tue, 23 Jan 2018 15:18:21 +0100 Subject: [PATCH] Add parameters 'partition' and 'nodes' for slurm jobs. --- src/engine/BL_Job.cxx | 16 ++++++++++++++ src/engine/BL_Job.hxx | 11 +++++++--- src/engine/BL_SALOMEServices.cxx | 5 ++++- src/genericgui/BL_CreateJobWizard.cxx | 19 +++++++++++++++++ src/genericgui/BL_CreateJobWizard.hxx | 2 ++ src/genericgui/BL_JobTab.cxx | 17 +++++++++++++-- src/genericgui/BL_JobTab.hxx | 3 +++ src/genericgui/BL_JobsManager_QT.cxx | 2 ++ .../ResourceRequirementsWizardPage.ui | 21 +++++++++++++++++++ 9 files changed, 90 insertions(+), 6 deletions(-) diff --git a/src/engine/BL_Job.cxx b/src/engine/BL_Job.cxx index 11ed0a1..01c7d3d 100644 --- a/src/engine/BL_Job.cxx +++ b/src/engine/BL_Job.cxx @@ -32,10 +32,12 @@ BL::Job::Job() _batch_params.mem_limit = 0; _batch_params.mem_req_type = MEM_PER_NODE; _batch_params.nb_proc = 0; + _batch_params.nb_node = 0; _batch_params.exclusive = false; _files_params.result_directory = ""; _resource_choosed = ""; _batch_queue = ""; + _batch_partition = ""; _state = BL::Job::CREATED; _thread_state = BL::Job::NOTHING; _salome_launcher_id = -1; @@ -61,10 +63,12 @@ BL::Job::Job(const std::string & name) _batch_params.mem_limit = 0; _batch_params.mem_req_type = MEM_PER_NODE; _batch_params.nb_proc = 0; + _batch_params.nb_node = 0; _batch_params.exclusive = false; _files_params.result_directory = ""; _resource_choosed = ""; _batch_queue = ""; + _batch_partition = ""; _state = BL::Job::CREATED; _thread_state = BL::Job::NOTHING; _salome_launcher_id = -1; @@ -231,6 +235,18 @@ BL::Job::getBatchQueue() return _batch_queue; } +void +BL::Job::setBatchPartition(const std::string & partition) +{ + _batch_partition = partition; +} + +std::string & +BL::Job::getBatchPartition() +{ + return _batch_partition; +} + void BL::Job::setWCKey(const std::string & wckey) { diff --git a/src/engine/BL_Job.hxx b/src/engine/BL_Job.hxx index 532b31d..cbc972d 100644 --- a/src/engine/BL_Job.hxx +++ b/src/engine/BL_Job.hxx @@ -71,11 +71,12 @@ namespace BL{ long mem_limit; MemReqType mem_req_type; int nb_proc; + int nb_node; bool exclusive; - // Parameters for COORM - std::string launcher_file; - std::string launcher_args; + // Parameters for COORM + std::string launcher_file; + std::string launcher_args; }; void setBatchParameters(const BL::Job::BatchParam & param); const BL::Job::BatchParam & getBatchParameters(); @@ -95,6 +96,9 @@ namespace BL{ void setBatchQueue(const std::string & queue); std::string & getBatchQueue(); + void setBatchPartition(const std::string & partition); + std::string & getBatchPartition(); + void setWCKey(const std::string & wckey); const std::string & getWCKey(); @@ -133,6 +137,7 @@ namespace BL{ BL::Job::FilesParam _files_params; std::string _resource_choosed; std::string _batch_queue; + std::string _batch_partition; std::string _wckey; std::string _extra_params; std::string _ll_jobtype; diff --git a/src/engine/BL_SALOMEServices.cxx b/src/engine/BL_SALOMEServices.cxx index 1a1e0d6..19b0377 100644 --- a/src/engine/BL_SALOMEServices.cxx +++ b/src/engine/BL_SALOMEServices.cxx @@ -328,7 +328,9 @@ BL::SALOMEServices::create_job(BL::Job * job) job_parameters->maximum_duration = CORBA::string_dup(cpp_batch_params.maximum_duration.c_str()); 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->resource_required.nb_node = cpp_batch_params.nb_node; job_parameters->queue = CORBA::string_dup(job->getBatchQueue().c_str()); + job_parameters->partition = CORBA::string_dup(job->getBatchPartition().c_str()); job_parameters->exclusive = cpp_batch_params.exclusive; job_parameters->wckey = CORBA::string_dup(job->getWCKey().c_str()); job_parameters->extra_params = CORBA::string_dup(job->getExtraParams().c_str()); @@ -349,7 +351,6 @@ BL::SALOMEServices::create_job(BL::Job * job) } // Unused parameters - job_parameters->resource_required.nb_node = -1; job_parameters->resource_required.nb_proc_per_node = -1; job_parameters->resource_required.cpu_clock = -1; @@ -633,6 +634,7 @@ BL::SALOMEServices::get_new_job(int job_number) job_return->setEnvFile(job_parameters->env_file.in()); job_return->setPreCommand(job_parameters->pre_command.in()); job_return->setBatchQueue(job_parameters->queue.in()); + job_return->setBatchPartition(job_parameters->partition.in()); job_return->setWCKey(job_parameters->wckey.in()); job_return->setExtraParams(job_parameters->extra_params.in()); @@ -648,6 +650,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.nb_node = job_parameters->resource_required.nb_node; batch_param.exclusive = job_parameters->exclusive; if (job_parameters->mem_per_cpu != 0) diff --git a/src/genericgui/BL_CreateJobWizard.cxx b/src/genericgui/BL_CreateJobWizard.cxx index ed7acdf..6d46e40 100644 --- a/src/genericgui/BL_CreateJobWizard.cxx +++ b/src/genericgui/BL_CreateJobWizard.cxx @@ -67,6 +67,7 @@ BL::CreateJobWizard::CreateJobWizard(BL::JobsManager_QT * jobs_manager, BL::SALO mem_limit = 0; mem_req_type = BL::Job::MEM_PER_NODE; nb_proc = 1; + nb_node = 0; // Parameters for COORM launcher_file = ""; @@ -76,6 +77,7 @@ BL::CreateJobWizard::CreateJobWizard(BL::JobsManager_QT * jobs_manager, BL::SALO resource_choosed = ""; batch_queue = ""; + batch_partition = ""; start_job = false; dump_yacs_state = -1; @@ -182,6 +184,10 @@ BL::CreateJobWizard::clone(const std::string & name) proc_value.setNum(batch_params.nb_proc); setField("proc_value", proc_value); + QString node_value; + node_value.setNum(batch_params.nb_node); + setField("node_value", node_value); + setField("exclusive", batch_params.exclusive); if (batch_params.maximum_duration == "") @@ -240,6 +246,7 @@ BL::CreateJobWizard::clone(const std::string & name) setField("result_directory", QString(files_params.result_directory.c_str())); setField("resource_choosed", QString(job->getResource().c_str())); setField("batch_queue", QString(job->getBatchQueue().c_str())); + setField("batch_partition", QString(job->getBatchPartition().c_str())); setField("ll_jobtype", QString(job->getLoadLevelerJobType().c_str())); setField("wckey", QString(job->getWCKey().c_str())); setField("extra_params", QString(job->getExtraParams().c_str())); @@ -358,6 +365,7 @@ BL::CreateJobWizard::end(int result) } nb_proc = field("proc_value").toInt(); + nb_node = field("node_value").toInt(); exclusive = field("exclusive").toBool(); // Files Panel @@ -384,6 +392,10 @@ BL::CreateJobWizard::end(int result) QString f_batch_queue = field("batch_queue").toString(); batch_queue = f_batch_queue.trimmed().toUtf8().constData(); + // Batch Partition + QString f_batch_partition = field("batch_partition").toString(); + batch_partition = f_batch_partition.trimmed().toUtf8().constData(); + // LoadLeveler JobType BL::ResourceDescr resource_descr = _salome_services->getResourceDescr(resource_choosed); std::string batch = resource_descr.batch.c_str(); @@ -775,6 +787,7 @@ BatchParametersPage::BatchParametersPage(QWidget * parent, SALOMEServices * salo registerField("duration_min", ui->spin_duration_min); registerField("mem_value", ui->spin_memory); registerField("proc_value", ui->spin_proc); + registerField("node_value", ui->spin_node); registerField("exclusive", ui->check_exclusive); registerField("default_time", ui->rb_default_time); registerField("user_time", ui->rb_user_time); @@ -1244,6 +1257,10 @@ BL::ResourcePage::ResourcePage(BL::CreateJobWizard * parent, BL::SALOMEServices QLineEdit * _bqLineEdit = new QLineEdit(this); registerField("batch_queue", _bqLineEdit); + QLabel * bpLabel = new QLabel("Batch Partition (could be optional):"); + QLineEdit * _bpLineEdit = new QLineEdit(this); + registerField("batch_partition", _bpLineEdit); + _ll_label = new QLabel("LoadLeveler JobType:", this); _ll_value = new QLineEdit(this); registerField("ll_jobtype", _ll_value); @@ -1256,6 +1273,8 @@ BL::ResourcePage::ResourcePage(BL::CreateJobWizard * parent, BL::SALOMEServices _main_layout->addWidget(_resource_choosed, 1, 1); _main_layout->addWidget(bqLabel, 2, 0); _main_layout->addWidget(_bqLineEdit, 2, 1); + _main_layout->addWidget(bpLabel, 3, 0); + _main_layout->addWidget(_bpLineEdit, 3, 1); setLayout(_main_layout); }; diff --git a/src/genericgui/BL_CreateJobWizard.hxx b/src/genericgui/BL_CreateJobWizard.hxx index 84f8960..532a90f 100644 --- a/src/genericgui/BL_CreateJobWizard.hxx +++ b/src/genericgui/BL_CreateJobWizard.hxx @@ -90,6 +90,7 @@ namespace BL { long mem_limit; BL::Job::MemReqType mem_req_type; int nb_proc; + int nb_node; bool exclusive; // Parameters for COORM @@ -102,6 +103,7 @@ namespace BL { std::string resource_choosed; std::string batch_queue; + std::string batch_partition; std::string wckey; std::string extra_params; diff --git a/src/genericgui/BL_JobTab.cxx b/src/genericgui/BL_JobTab.cxx index 5c93b55..ae31c58 100644 --- a/src/genericgui/BL_JobTab.cxx +++ b/src/genericgui/BL_JobTab.cxx @@ -112,6 +112,8 @@ BL::JobTab::createJobSummaryTab() _job_req_mem_label_value = new QLabel(""); QLabel * job_nop_label = new QLabel("Number of processors:"); _job_nop_label_value = new QLabel(""); + QLabel * job_nono_label = new QLabel("Number of nodes:"); + _job_nono_label_value = new QLabel(""); QLabel * job_excl_label = new QLabel("Exclusive:"); _job_excl_label_value = new QLabel(""); @@ -124,6 +126,8 @@ BL::JobTab::createJobSummaryTab() // Specific values _batch_queue_label = new QLabel("Batch queue:"); _batch_queue_value = new QLabel(""); + _batch_partition_label = new QLabel("Batch partition:"); + _batch_partition_value = new QLabel(""); _ll_jobtype_label = new QLabel("LoadLeveler JobType:"); _ll_jobtype_value = new QLabel(""); @@ -141,10 +145,11 @@ BL::JobTab::createJobSummaryTab() _other_run_values_form->insertRow(0, job_mdt_label, _job_mdt_label_value); _other_run_values_form->insertRow(1, job_req_mem_label, _job_req_mem_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); + _other_run_values_form->insertRow(3, job_nono_label, _job_nono_label_value); + _other_run_values_form->insertRow(4, job_excl_label, _job_excl_label_value); // Parameters for COORM - _other_run_values_form->insertRow(4, job_la_label, _job_la_label_value); + _other_run_values_form->insertRow(5, job_la_label, _job_la_label_value); QHBoxLayout * box_layout = new QHBoxLayout(); box_layout->addLayout(_run_values_form); @@ -247,6 +252,7 @@ BL::JobTab::job_selected(const QModelIndex & index) batch_params.maximum_duration.c_str(); _job_mdt_label_value->setText(time); _job_nop_label_value->setText(QVariant(batch_params.nb_proc).toString()); + _job_nono_label_value->setText(QVariant(batch_params.nb_node).toString()); QString exclText = (batch_params.exclusive)? "yes" : "no"; _job_excl_label_value->setText(exclText); @@ -305,6 +311,11 @@ BL::JobTab::job_selected(const QModelIndex & index) _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->getBatchPartition() != "") + { + _batch_partition_value->setText(QVariant(job->getBatchPartition().c_str()).toString()); + _other_run_values_form->insertRow(_other_run_values_form->rowCount(), _batch_partition_label, _batch_partition_value); + } if (job->getLoadLevelerJobType() != "") { _ll_jobtype_value->setText(QVariant(job->getLoadLevelerJobType().c_str()).toString()); @@ -363,6 +374,7 @@ BL::JobTab::reset(QString job_name) _job_mdt_label_value->setText(""); _job_req_mem_label_value->setText(""); _job_nop_label_value->setText(""); + _job_nono_label_value->setText(""); _job_excl_label_value->setText(""); _job_jobfile_label_value->setText(""); _job_envfile_label_value->setText(""); @@ -372,6 +384,7 @@ BL::JobTab::reset(QString job_name) _yacs_dump_state_value->setText(""); _batch_queue_value->setText(""); + _batch_partition_value->setText(""); _ll_jobtype_value->setText(""); // Parameters for COORM diff --git a/src/genericgui/BL_JobTab.hxx b/src/genericgui/BL_JobTab.hxx index 5d1118e..87a4ce5 100644 --- a/src/genericgui/BL_JobTab.hxx +++ b/src/genericgui/BL_JobTab.hxx @@ -79,6 +79,7 @@ namespace BL QLabel * _job_mdt_label_value; QLabel * _job_req_mem_label_value; QLabel * _job_nop_label_value; + QLabel * _job_nono_label_value; QLabel * _job_excl_label_value; // Specific Values @@ -86,6 +87,8 @@ namespace BL QLabel * _yacs_dump_state_value; QLabel * _batch_queue_label; QLabel * _batch_queue_value; + QLabel * _batch_partition_label; + QLabel * _batch_partition_value; QLabel * _ll_jobtype_label; QLabel * _ll_jobtype_value; diff --git a/src/genericgui/BL_JobsManager_QT.cxx b/src/genericgui/BL_JobsManager_QT.cxx index 7fee384..8ff1128 100644 --- a/src/genericgui/BL_JobsManager_QT.cxx +++ b/src/genericgui/BL_JobsManager_QT.cxx @@ -326,6 +326,7 @@ BL::JobsManager_QT::create_job_with_wizard(BL::CreateJobWizard & wizard) param.mem_limit = wizard.mem_limit; param.mem_req_type = wizard.mem_req_type; param.nb_proc = wizard.nb_proc; + param.nb_node = wizard.nb_node; param.exclusive = wizard.exclusive; // Parameters for COORM @@ -340,6 +341,7 @@ BL::JobsManager_QT::create_job_with_wizard(BL::CreateJobWizard & wizard) new_job->setFilesParameters(files_params); new_job->setResource(wizard.resource_choosed); new_job->setBatchQueue(wizard.batch_queue); + new_job->setBatchPartition(wizard.batch_partition); new_job->setLoadLevelerJobType(wizard.ll_jobtype); new_job->setWCKey(wizard.wckey); new_job->setExtraParams(wizard.extra_params); diff --git a/src/genericgui/ResourceRequirementsWizardPage.ui b/src/genericgui/ResourceRequirementsWizardPage.ui index e25a98f..c6f11c3 100644 --- a/src/genericgui/ResourceRequirementsWizardPage.ui +++ b/src/genericgui/ResourceRequirementsWizardPage.ui @@ -44,6 +44,27 @@ + + + + + + Number of nodes (0 for unspecified) : + + + + + + + 0 + + + 1000000000 + + + + + -- 2.39.2