From 1753990888b3a5b047f646e5641854ba5656b744 Mon Sep 17 00:00:00 2001 From: ribes Date: Tue, 17 Nov 2009 09:25:13 +0000 Subject: [PATCH] Adding queue support --- src/engine/BL_Job.cxx | 14 ++++++++++++++ src/engine/BL_Job.hxx | 4 ++++ src/engine/BL_SALOMEServices.cxx | 1 + src/genericgui/BL_CreateJobWizard.cxx | 11 +++++++++++ src/genericgui/BL_CreateJobWizard.hxx | 1 + src/genericgui/BL_JobsManager_QT.cxx | 2 ++ 6 files changed, 33 insertions(+) diff --git a/src/engine/BL_Job.cxx b/src/engine/BL_Job.cxx index 3d92445..7aab92f 100644 --- a/src/engine/BL_Job.cxx +++ b/src/engine/BL_Job.cxx @@ -32,6 +32,7 @@ BL::Job::Job() _batch_params.nb_proc = 0; _files_params.result_directory = ""; _machine_choosed = ""; + _batch_queue = ""; _state = BL::Job::CREATED; _thread_state = BL::Job::NOTHING; _salome_launcher_id = -1; @@ -50,6 +51,7 @@ BL::Job::Job(const std::string & name) _batch_params.nb_proc = 0; _files_params.result_directory = ""; _machine_choosed = ""; + _batch_queue = ""; _state = BL::Job::CREATED; _thread_state = BL::Job::NOTHING; _salome_launcher_id = -1; @@ -159,6 +161,18 @@ BL::Job::getMachine() return _machine_choosed; } +void +BL::Job::setBatchQueue(std::string & queue) +{ + _batch_queue = queue; +} + +std::string & +BL::Job::getBatchQueue() +{ + return _batch_queue; +} + void BL::Job::setState(BL::Job::State state) { diff --git a/src/engine/BL_Job.hxx b/src/engine/BL_Job.hxx index 2525a96..7d99b8f 100644 --- a/src/engine/BL_Job.hxx +++ b/src/engine/BL_Job.hxx @@ -71,6 +71,9 @@ namespace BL{ void setMachine(std::string & machine); std::string & getMachine(); + void setBatchQueue(std::string & queue); + std::string & getBatchQueue(); + enum State {CREATED, IN_PROCESS, QUEUED, RUNNING, PAUSED, FINISHED, ERROR}; void setState(BL::Job::State state); BL::Job::State getState(); @@ -97,6 +100,7 @@ namespace BL{ BL::Job::BatchParam _batch_params; BL::Job::FilesParam _files_params; std::string _machine_choosed; + std::string _batch_queue; int _salome_launcher_id; }; diff --git a/src/engine/BL_SALOMEServices.cxx b/src/engine/BL_SALOMEServices.cxx index 7ec3342..21d24b2 100644 --- a/src/engine/BL_SALOMEServices.cxx +++ b/src/engine/BL_SALOMEServices.cxx @@ -132,6 +132,7 @@ BL::SALOMEServices::create_job(BL::Job * job) job_parameters->maximum_during_time = CORBA::string_dup(cpp_batch_params.maximum_during_time.c_str()); job_parameters->resource_required.hostname = CORBA::string_dup(job->getMachine().c_str()); job_parameters->resource_required.nb_node = cpp_batch_params.nb_proc; + job_parameters->queue = CORBA::string_dup(job->getBatchQueue().c_str()); // Memory CORBA::Long memory; diff --git a/src/genericgui/BL_CreateJobWizard.cxx b/src/genericgui/BL_CreateJobWizard.cxx index 2d05ae3..bee52f0 100644 --- a/src/genericgui/BL_CreateJobWizard.cxx +++ b/src/genericgui/BL_CreateJobWizard.cxx @@ -38,6 +38,7 @@ BL::CreateJobWizard::CreateJobWizard(BL::JobsManager_QT * jobs_manager, BL::SALO result_directory = ""; machine_choosed = ""; + batch_queue = ""; start_job = false; @@ -132,6 +133,10 @@ BL::CreateJobWizard::end(int result) QString f_machine_choosed = field("machine_choosed").toString(); machine_choosed = f_machine_choosed.toStdString(); + // Batch Queue + QString f_batch_queue = field("batch_queue").toString(); + batch_queue = f_batch_queue.toStdString(); + start_job = field("start_job").toBool(); } } @@ -684,10 +689,16 @@ BL::MachinePage::MachinePage(BL::CreateJobWizard * parent, BL::SALOMEServices * _machine_choosed->setReadOnly(true); registerField("machine_choosed", _machine_choosed); + QLabel * bqLabel = new QLabel("Batch Queue (optional):"); + QLineEdit * _bqLineEdit = new QLineEdit(this); + registerField("batch_queue", _bqLineEdit); + QGridLayout * main_layout = new QGridLayout; main_layout->addWidget(machine_group_box, 0, 0, 1, -1); main_layout->addWidget(machine_label, 1, 0); main_layout->addWidget(_machine_choosed, 1, 1); + main_layout->addWidget(bqLabel, 2, 0); + main_layout->addWidget(_bqLineEdit, 2, 1); setLayout(main_layout); }; diff --git a/src/genericgui/BL_CreateJobWizard.hxx b/src/genericgui/BL_CreateJobWizard.hxx index 4f1a776..f19c116 100644 --- a/src/genericgui/BL_CreateJobWizard.hxx +++ b/src/genericgui/BL_CreateJobWizard.hxx @@ -71,6 +71,7 @@ namespace BL{ std::list output_files_list; std::string machine_choosed; + std::string batch_queue; bool start_job; diff --git a/src/genericgui/BL_JobsManager_QT.cxx b/src/genericgui/BL_JobsManager_QT.cxx index 3bc5f4e..471a9af 100644 --- a/src/genericgui/BL_JobsManager_QT.cxx +++ b/src/genericgui/BL_JobsManager_QT.cxx @@ -173,6 +173,7 @@ BL::JobsManager_QT::create_job_wizard() files_params.output_files_list = wizard.output_files_list; new_job->setFilesParameters(files_params); new_job->setMachine(wizard.machine_choosed); + new_job->setBatchQueue(wizard.batch_queue); } else { @@ -192,6 +193,7 @@ BL::JobsManager_QT::create_job_wizard() files_params.output_files_list = wizard.output_files_list; new_job->setFilesParameters(files_params); new_job->setMachine(wizard.machine_choosed); + new_job->setBatchQueue(wizard.batch_queue); } addJobToLauncher(wizard.job_name); emit new_job_added(QString::fromStdString(wizard.job_name)); -- 2.39.2