From a94420743d5d88645552280b4fcbca53deb0d2f0 Mon Sep 17 00:00:00 2001 From: Ovidiu Mircescu Date: Tue, 15 Mar 2016 11:02:25 +0100 Subject: [PATCH] You can now add options to the "driver" command of a YACS job. --- src/engine/BL_Job.cxx | 14 ++++++++++++++ src/engine/BL_Job.hxx | 4 ++++ src/engine/BL_SALOMEServices.cxx | 13 +++++++++++++ src/genericgui/BL_CreateJobWizard.cxx | 13 +++++++++++-- src/genericgui/BL_CreateJobWizard.hxx | 1 + src/genericgui/BL_JobsManager_QT.cxx | 1 + 6 files changed, 44 insertions(+), 2 deletions(-) diff --git a/src/engine/BL_Job.cxx b/src/engine/BL_Job.cxx index 1f91cec..3f07358 100644 --- a/src/engine/BL_Job.cxx +++ b/src/engine/BL_Job.cxx @@ -39,6 +39,7 @@ BL::Job::Job() _thread_state = BL::Job::NOTHING; _salome_launcher_id = -1; _dump_yacs_state = 0; + _yacs_driver_options = ""; _ll_jobtype = ""; // Parameters for COORM @@ -66,6 +67,7 @@ BL::Job::Job(const std::string & name) _thread_state = BL::Job::NOTHING; _salome_launcher_id = -1; _dump_yacs_state = 0; + _yacs_driver_options = ""; _ll_jobtype = ""; // Parameters for COORM @@ -129,6 +131,18 @@ BL::Job::getDumpYACSState() return _dump_yacs_state; } +void +BL::Job::setYacsDriverOptions(const std::string& options) +{ + _yacs_driver_options = options; +} + +const std::string& +BL::Job::getYacsDriverOptions()const +{ + return _yacs_driver_options; +} + void BL::Job::setJobFile(const std::string & job_file) { diff --git a/src/engine/BL_Job.hxx b/src/engine/BL_Job.hxx index 417e0c4..db7a8ae 100644 --- a/src/engine/BL_Job.hxx +++ b/src/engine/BL_Job.hxx @@ -56,6 +56,9 @@ namespace BL{ void setDumpYACSState(const int & dump_yacs_state); int getDumpYACSState(); + void setYacsDriverOptions(const std::string& options); + const std::string& getYacsDriverOptions()const; + enum MemReqType {MEM_PER_NODE, MEM_PER_CPU}; struct BatchParam @@ -114,6 +117,7 @@ namespace BL{ BL::Job::State _state; BL::Job::ThreadState _thread_state; int _dump_yacs_state; + std::string _yacs_driver_options; std::string _name; diff --git a/src/engine/BL_SALOMEServices.cxx b/src/engine/BL_SALOMEServices.cxx index 4ac6b3a..0269492 100644 --- a/src/engine/BL_SALOMEServices.cxx +++ b/src/engine/BL_SALOMEServices.cxx @@ -277,6 +277,14 @@ BL::SALOMEServices::create_job(BL::Job * job) new_parameter->value = CORBA::string_dup(oss.str().c_str()); job_parameters->specific_parameters[job_parameters->specific_parameters.length() - 1] = new_parameter; } + if (not job->getYacsDriverOptions().empty()) + { + job_parameters->specific_parameters.length(job_parameters->specific_parameters.length() + 1); + Engines::Parameter_var new_parameter = new Engines::Parameter; + new_parameter->name = CORBA::string_dup("YACSDriverOptions"); + new_parameter->value = CORBA::string_dup(job->getYacsDriverOptions().c_str()); + job_parameters->specific_parameters[job_parameters->specific_parameters.length() - 1] = new_parameter; + } } if (job->getLoadLevelerJobType() != "") { @@ -670,6 +678,11 @@ BL::SALOMEServices::get_new_job(int job_number) iss >> value; job_return->setDumpYACSState(value); } + if (std::string(job_parameters->specific_parameters[i].name.in()) == "YACSDriverOptions") + { + std::string user_value = job_parameters->specific_parameters[i].value.in(); + job_return->setYacsDriverOptions(user_value); + } if (std::string(job_parameters->specific_parameters[i].name.in()) == "LoalLevelerJobType") { std::string user_value = job_parameters->specific_parameters[i].value.in(); diff --git a/src/genericgui/BL_CreateJobWizard.cxx b/src/genericgui/BL_CreateJobWizard.cxx index 3006cee..83d2dc6 100644 --- a/src/genericgui/BL_CreateJobWizard.cxx +++ b/src/genericgui/BL_CreateJobWizard.cxx @@ -77,6 +77,7 @@ BL::CreateJobWizard::CreateJobWizard(BL::JobsManager_QT * jobs_manager, BL::SALO start_job = false; dump_yacs_state = -1; + yacs_driver_options = ""; ll_jobtype = ""; setOptions(QWizard::NoBackButtonOnStartPage); @@ -138,6 +139,10 @@ BL::CreateJobWizard::clone(const std::string & name) value.setNum(job->getDumpYACSState()); setField("dump_yacs_state", value); } + if (not job->getYacsDriverOptions().empty()) + { + setField("yacs_driver_options", job->getYacsDriverOptions().c_str()); + } } else if (job->getType() == BL::Job::COMMAND) { @@ -263,6 +268,7 @@ BL::CreateJobWizard::end(int result) QString f_yacs_file = field("yacs_file").toString(); yacs_file = f_yacs_file.trimmed().toUtf8().constData(); dump_yacs_state = field("dump_yacs_state").toInt(); + yacs_driver_options = field("yacs_driver_options").toString().trimmed().toUtf8().constData(); // Command Panel QString f_command = field("command").toString(); @@ -558,15 +564,18 @@ BL::YACSSchemaPage::YACSSchemaPage(QWidget * parent) QGroupBox * spec_param_box = new QGroupBox("YACS specific parameters"); QLabel * label_dump = new QLabel("Dump YACS state each secs (0 disable this feature)"); - QLabel * label_dump_warning = new QLabel("(WARNING: can only be used with SALOME >= 6.3.0)"); + QLabel * label_driver_options = new QLabel("YACS driver options - see YACS driver documentation."); QSpinBox * spin_dump = new QSpinBox(this); spin_dump->setMinimum(0); spin_dump->setMaximum(1000000); registerField("dump_yacs_state", spin_dump); + QLineEdit* edit_yacs_driver_options = new QLineEdit(this); + registerField("yacs_driver_options", edit_yacs_driver_options); QGridLayout * specific_layout = new QGridLayout; specific_layout->addWidget(label_dump, 0, 0); specific_layout->addWidget(spin_dump, 0, 1); - specific_layout->addWidget(label_dump_warning, 1, 0); + specific_layout->addWidget(label_driver_options, 1, 0); + specific_layout->addWidget(edit_yacs_driver_options, 1, 1); spec_param_box->setLayout(specific_layout); QVBoxLayout * main_layout = new QVBoxLayout; diff --git a/src/genericgui/BL_CreateJobWizard.hxx b/src/genericgui/BL_CreateJobWizard.hxx index 6245773..e658d24 100644 --- a/src/genericgui/BL_CreateJobWizard.hxx +++ b/src/genericgui/BL_CreateJobWizard.hxx @@ -107,6 +107,7 @@ namespace BL { bool start_job; int dump_yacs_state; std::string ll_jobtype; + std::string yacs_driver_options; public: enum {Page_JobName, diff --git a/src/genericgui/BL_JobsManager_QT.cxx b/src/genericgui/BL_JobsManager_QT.cxx index 4b20741..42f82ea 100644 --- a/src/genericgui/BL_JobsManager_QT.cxx +++ b/src/genericgui/BL_JobsManager_QT.cxx @@ -291,6 +291,7 @@ BL::JobsManager_QT::create_job_with_wizard(BL::CreateJobWizard & wizard) new_job->setType(BL::Job::YACS_SCHEMA); new_job->setJobFile(wizard.yacs_file); new_job->setDumpYACSState(wizard.dump_yacs_state); + new_job->setYacsDriverOptions(wizard.yacs_driver_options); break; case BL::CreateJobWizard::COMMAND: // Command Job -- 2.39.2