From d1d48143c67b27589856357719e7e2ae3fae6f13 Mon Sep 17 00:00:00 2001 From: ribes Date: Tue, 12 Jan 2010 16:42:10 +0000 Subject: [PATCH] - Add JobFile in BL_Job - Add JobFile in the resume of the job - Add EnvFile in the resume of the job --- src/engine/BL_Job.cxx | 26 ++++---------- src/engine/BL_Job.hxx | 9 ++--- src/engine/BL_SALOMEServices.cxx | 5 ++- src/genericgui/BL_CreateJobWizard.cxx | 11 ++++-- src/genericgui/BL_JobTab.cxx | 23 ++++++------ src/genericgui/BL_JobTab.hxx | 4 +-- src/genericgui/BL_JobsManager_QT.cxx | 50 +++++++++++---------------- 7 files changed, 51 insertions(+), 77 deletions(-) diff --git a/src/engine/BL_Job.cxx b/src/engine/BL_Job.cxx index 9581175..d49ce8f 100644 --- a/src/engine/BL_Job.cxx +++ b/src/engine/BL_Job.cxx @@ -23,8 +23,7 @@ BL::Job::Job() { DEBTRACE("Creating BL::Job"); _name = ""; - _yacs_file = ""; - _command = ""; + _job_file = ""; _env_file = ""; _batch_params.batch_directory = ""; _batch_params.maximum_duration = ""; @@ -42,8 +41,7 @@ BL::Job::Job(const std::string & name) { DEBTRACE("Creating BL::Job with name : " << name); _name = name; - _yacs_file = ""; - _command = ""; + _job_file = ""; _env_file = ""; _batch_params.batch_directory = ""; _batch_params.maximum_duration = ""; @@ -85,27 +83,15 @@ BL::Job::getType() } void -BL::Job::setYACSFile(std::string & yacs_file) +BL::Job::setJobFile(std::string & job_file) { - _yacs_file = yacs_file; + _job_file = job_file; } std::string & -BL::Job::getYACSFile() +BL::Job::getJobFile() { - return _yacs_file; -} - -void -BL::Job::setCommand(std::string & command) -{ - _command = command; -} - -std::string & -BL::Job::getCommand() -{ - return _command; + return _job_file; } void diff --git a/src/engine/BL_Job.hxx b/src/engine/BL_Job.hxx index df38b68..0f63344 100644 --- a/src/engine/BL_Job.hxx +++ b/src/engine/BL_Job.hxx @@ -41,11 +41,9 @@ namespace BL{ void setType(BL::Job::JobType type); BL::Job::JobType getType(); - void setYACSFile(std::string & yacs_file); - std::string & getYACSFile(); + void setJobFile(std::string & job_file); + std::string & getJobFile(); - void setCommand(std::string & command); - std::string & getCommand(); void setEnvFile(std::string & env_file); std::string & getEnvFile(); @@ -93,8 +91,7 @@ namespace BL{ std::string _name; BL::Job::JobType _type; - std::string _yacs_file; - std::string _command; + std::string _job_file; std::string _env_file; BL::Job::BatchParam _batch_params; diff --git a/src/engine/BL_SALOMEServices.cxx b/src/engine/BL_SALOMEServices.cxx index 16910da..157a5bb 100644 --- a/src/engine/BL_SALOMEServices.cxx +++ b/src/engine/BL_SALOMEServices.cxx @@ -94,15 +94,14 @@ BL::SALOMEServices::create_job(BL::Job * job) if (job->getType() == BL::Job::COMMAND) { job_parameters->job_type = CORBA::string_dup("command"); - job_parameters->job_file = CORBA::string_dup(job->getCommand().c_str()); } else if (job->getType() == BL::Job::YACS_SCHEMA) { job_parameters->job_type = CORBA::string_dup("yacs_file"); - job_parameters->job_file = CORBA::string_dup(job->getYACSFile().c_str()); } // Files + job_parameters->job_file = CORBA::string_dup(job->getJobFile().c_str()); job_parameters->env_file = CORBA::string_dup(job->getEnvFile().c_str()); BL::Job::FilesParam files = job->getFilesParameters(); std::list::iterator it; @@ -131,7 +130,7 @@ BL::SALOMEServices::create_job(BL::Job * job) // Resource 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_node = cpp_batch_params.nb_proc; + job_parameters->resource_required.nb_proc = cpp_batch_params.nb_proc; job_parameters->queue = CORBA::string_dup(job->getBatchQueue().c_str()); // Memory diff --git a/src/genericgui/BL_CreateJobWizard.cxx b/src/genericgui/BL_CreateJobWizard.cxx index 733a2cb..2839970 100644 --- a/src/genericgui/BL_CreateJobWizard.cxx +++ b/src/genericgui/BL_CreateJobWizard.cxx @@ -86,7 +86,12 @@ BL::CreateJobWizard::end(int result) QString f_command = field("command").toString(); command = f_command.toStdString(); - QString f_env_file = field("env_file").toString(); + QString f_env_file; + + if (yacs_file != "") + f_env_file = field("env_yacs_file").toString(); + else + f_env_file = field("env_command_file").toString(); env_file = f_env_file.toStdString(); // Batch Panel @@ -247,7 +252,7 @@ BL::YACSSchemaPage::YACSSchemaPage(QWidget * parent) command_env_file_button->show(); connect(command_env_file_button, SIGNAL(clicked()), this, SLOT(choose_env_file())); _line_env_file = new QLineEdit(this); - registerField("env_file", _line_env_file); + registerField("env_yacs_file", _line_env_file); _line_env_file->setReadOnly(true); QVBoxLayout * main_layout = new QVBoxLayout; @@ -329,7 +334,7 @@ BL::CommandMainPage::CommandMainPage(QWidget * parent) command_env_file_button->show(); connect(command_env_file_button, SIGNAL(clicked()), this, SLOT(choose_env_file())); _line_env_file = new QLineEdit(this); - registerField("env_file", _line_env_file); + registerField("env_command_file", _line_env_file); _line_env_file->setReadOnly(true); QGridLayout *layout = new QGridLayout; diff --git a/src/genericgui/BL_JobTab.cxx b/src/genericgui/BL_JobTab.cxx index c78d93c..cd23a9d 100644 --- a/src/genericgui/BL_JobTab.cxx +++ b/src/genericgui/BL_JobTab.cxx @@ -63,8 +63,10 @@ BL::JobTab::createJobSummaryTab() _job_state_label_value = new QLabel(""); QLabel * job_resource_label = new QLabel("Resource:"); _job_resource_label_value = new QLabel(""); - _job_command_label = new QLabel("Schema or Command:"); - _job_command_label_value = new QLabel(""); + QLabel * job_jobfile_label = new QLabel("Job File:"); + _job_jobfile_label_value = new QLabel(""); + QLabel * job_envfile_label = new QLabel("Env File:"); + _job_envfile_label_value = new QLabel(""); QGroupBox * main_values_box = new QGroupBox("Main values"); QFormLayout * values_form = new QFormLayout; @@ -72,7 +74,8 @@ BL::JobTab::createJobSummaryTab() values_form->insertRow(1, job_type_label, _job_type_label_value); values_form->insertRow(2, job_state_label, _job_state_label_value); values_form->insertRow(3, job_resource_label, _job_resource_label_value); - values_form->insertRow(4, _job_command_label, _job_command_label_value); + values_form->insertRow(4, job_jobfile_label, _job_jobfile_label_value); + values_form->insertRow(5, job_envfile_label, _job_envfile_label_value); main_values_box->setLayout(values_form); QLabel * job_nif_label = new QLabel("Number of Input Files:"); @@ -164,18 +167,12 @@ BL::JobTab::job_selected(const QModelIndex & index) else _job_state_label_value->setText("Finished"); + _job_jobfile_label_value->setText(QString(job->getJobFile().c_str())); + _job_envfile_label_value->setText(QString(job->getEnvFile().c_str())); if (job->getType() == BL::Job::YACS_SCHEMA) - { - _job_command_label->setText("Schema:"); - _job_command_label_value->setText(QString(job->getYACSFile().c_str())); _job_type_label_value->setText("YACS_Schema"); - } else - { - _job_command_label->setText("Command:"); - _job_command_label_value->setText(QString(job->getCommand().c_str())); _job_type_label_value->setText("Command"); - } _job_resource_label_value->setText(QString(job->getResource().c_str())); @@ -251,8 +248,8 @@ BL::JobTab::reset(QString job_name) _job_mdt_label_value->setText(""); _job_em_label_value->setText(""); _job_nop_label_value->setText(""); - _job_command_label->setText("Schema or Command:"); - _job_command_label_value->setText(""); + _job_jobfile_label_value->setText(""); + _job_envfile_label_value->setText(""); _input_files_list->clear(); _output_files_list->clear(); diff --git a/src/genericgui/BL_JobTab.hxx b/src/genericgui/BL_JobTab.hxx index cd40316..58097ea 100644 --- a/src/genericgui/BL_JobTab.hxx +++ b/src/genericgui/BL_JobTab.hxx @@ -55,8 +55,8 @@ namespace BL QLabel * _job_type_label_value; QLabel * _job_state_label_value; QLabel * _job_resource_label_value; - QLabel * _job_command_label; - QLabel * _job_command_label_value; + QLabel * _job_jobfile_label_value; + QLabel * _job_envfile_label_value; // Run Values QLabel * _job_nif_label_value; diff --git a/src/genericgui/BL_JobsManager_QT.cxx b/src/genericgui/BL_JobsManager_QT.cxx index c9d642b..3c0db89 100644 --- a/src/genericgui/BL_JobsManager_QT.cxx +++ b/src/genericgui/BL_JobsManager_QT.cxx @@ -160,42 +160,32 @@ BL::JobsManager_QT::create_job_wizard() { // YACS schema job new_job->setType(BL::Job::YACS_SCHEMA); - new_job->setYACSFile(wizard.yacs_file); - new_job->setEnvFile(wizard.env_file); - BL::Job::BatchParam param; - param.batch_directory = wizard.batch_directory; - param.maximum_duration = wizard.maximum_duration; - param.expected_memory = wizard.expected_memory; - param.nb_proc = wizard.nb_proc; - new_job->setBatchParameters(param); - BL::Job::FilesParam files_params; - files_params.result_directory = wizard.result_directory; - files_params.input_files_list = wizard.input_files_list; - files_params.output_files_list = wizard.output_files_list; - new_job->setFilesParameters(files_params); - new_job->setResource(wizard.resource_choosed); - new_job->setBatchQueue(wizard.batch_queue); + new_job->setJobFile(wizard.yacs_file); } else { // Command Job new_job->setType(BL::Job::COMMAND); - new_job->setCommand(wizard.command); - new_job->setEnvFile(wizard.env_file); - BL::Job::BatchParam param; - param.batch_directory = wizard.batch_directory; - param.maximum_duration = wizard.maximum_duration; - param.expected_memory = wizard.expected_memory; - param.nb_proc = wizard.nb_proc; - new_job->setBatchParameters(param); - BL::Job::FilesParam files_params; - files_params.result_directory = wizard.result_directory; - files_params.input_files_list = wizard.input_files_list; - files_params.output_files_list = wizard.output_files_list; - new_job->setFilesParameters(files_params); - new_job->setResource(wizard.resource_choosed); - new_job->setBatchQueue(wizard.batch_queue); + new_job->setJobFile(wizard.command); } + + // For all jobs + new_job->setEnvFile(wizard.env_file); + BL::Job::BatchParam param; + param.batch_directory = wizard.batch_directory; + param.maximum_duration = wizard.maximum_duration; + param.expected_memory = wizard.expected_memory; + param.nb_proc = wizard.nb_proc; + new_job->setBatchParameters(param); + BL::Job::FilesParam files_params; + files_params.result_directory = wizard.result_directory; + files_params.input_files_list = wizard.input_files_list; + files_params.output_files_list = wizard.output_files_list; + new_job->setFilesParameters(files_params); + new_job->setResource(wizard.resource_choosed); + new_job->setBatchQueue(wizard.batch_queue); + + // End addJobToLauncher(wizard.job_name); emit new_job_added(QString::fromStdString(wizard.job_name)); if (wizard.start_job) -- 2.39.2