_state = BL::Job::CREATED;
_thread_state = BL::Job::NOTHING;
_salome_launcher_id = -1;
+ _dump_yacs_state = 0;
}
BL::Job::Job(const std::string & name)
_state = BL::Job::CREATED;
_thread_state = BL::Job::NOTHING;
_salome_launcher_id = -1;
+ _dump_yacs_state = 0;
}
BL::Job::~Job()
return _type;
}
+void
+BL::Job::setDumpYACSState(const int & dump_yacs_state)
+{
+ _dump_yacs_state = dump_yacs_state;
+}
+
+int
+BL::Job::getDumpYACSState()
+{
+ return _dump_yacs_state;
+}
+
void
BL::Job::setJobFile(const std::string & job_file)
{
void setEnvFile(const std::string & env_file);
std::string & getEnvFile();
+ void setDumpYACSState(const int & dump_yacs_state);
+ int getDumpYACSState();
+
struct BatchParam
{
std::string batch_directory;
private:
BL::Job::State _state;
BL::Job::ThreadState _thread_state;
+ int _dump_yacs_state;
std::string _name;
job_parameters->job_type = CORBA::string_dup("python_salome");
}
+ // Specific parameters
+ if (job->getType() == BL::Job::YACS_SCHEMA)
+ {
+ if (job->getDumpYACSState() > 0)
+ {
+ job_parameters->specific_parameters.length(job_parameters->specific_parameters.length() + 1);
+ std::ostringstream oss;
+ oss << job->getDumpYACSState();
+ Engines::Parameter_var new_parameter = new Engines::Parameter;
+ new_parameter->name = CORBA::string_dup("EnableDumpYACS");
+ new_parameter->value = CORBA::string_dup(oss.str().c_str());
+ job_parameters->specific_parameters[job_parameters->specific_parameters.length() - 1] = new_parameter;
+ }
+ }
+
// Files
job_parameters->job_name = CORBA::string_dup(job->getName().c_str());
job_parameters->job_file = CORBA::string_dup(job->getJobFile().c_str());
job_return->setResource(job_parameters->resource_required.name.in());
+ // Specific parameters
+ for (CORBA::ULong i = 0; i < job_parameters->specific_parameters.length(); i++)
+ {
+ if (std::string(job_parameters->specific_parameters[i].name.in()) == "EnableDumpYACS")
+ {
+ std::string user_value = job_parameters->specific_parameters[i].value.in();
+ std::istringstream iss(user_value);
+ int value;
+ iss >> value;
+ job_return->setDumpYACSState(value);
+ }
+ }
+
// Get current state
std::string result_job = job_return->setStringState(refresh_job(job_return));
if (result_job == "new_state") {}
batch_queue = "";
start_job = false;
+ dump_yacs_state = -1;
setOptions(QWizard::IndependentPages | QWizard::NoBackButtonOnStartPage);
setField("yacs_file", QString(job->getJobFile().c_str()));
_job_name_page->_yacs_schema_button->click();
setField("env_yacs_file", QString(job->getEnvFile().c_str()));
+ if (job->getDumpYACSState() != -1)
+ {
+ QString value;
+ value.setNum(job->getDumpYACSState());
+ setField("dump_yacs_state", value);
+ }
}
else if (job->getType() == BL::Job::COMMAND)
{
// YACS Schema Panel
QString f_yacs_file = field("yacs_file").toString();
yacs_file = f_yacs_file.toStdString();
-
+ dump_yacs_state = field("dump_yacs_state").toInt();
+
// Command Panel
QString f_command = field("command").toString();
command = f_command.toStdString();
-
+
// Command Panel
QString f_python_salome_file = field("PythonSalome").toString();
python_salome_file = f_python_salome_file.toStdString();
-
+
QString f_env_file;
if (yacs_file != "")
f_env_file = field("env_yacs_file").toString();
BL::YACSSchemaPage::YACSSchemaPage(QWidget * parent)
: QWizardPage(parent)
{
- setTitle("Choose YACS Schema");
+ setTitle("Configure YACS Execution");
- QLabel *label = new QLabel("In this step you have to choose what YACS Schema you want to execute");
+ QLabel *label = new QLabel("In this step you have to configure your YACS execution");
label->setWordWrap(true);
QPushButton * yacs_file_button = new QPushButton(tr("Choose YACS Schema file"));
registerField("env_yacs_file", _line_env_file);
_line_env_file->setReadOnly(true);
+ 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)");
+ QSpinBox * spin_dump = new QSpinBox(this);
+ spin_dump->setMinimum(0);
+ spin_dump->setMaximum(1000000);
+ registerField("dump_yacs_state", spin_dump);
+ 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);
+ spec_param_box->setLayout(specific_layout);
+
QVBoxLayout * main_layout = new QVBoxLayout;
main_layout->addWidget(label);
QGridLayout *layout = new QGridLayout;
layout->addWidget(command_env_file_button, 1, 0);
layout->addWidget(_line_env_file, 1, 1);
main_layout->insertLayout(-1, layout);
+ main_layout->addWidget(spec_param_box);
setLayout(main_layout);
};
public:
// Results
std::string job_name;
-
+
std::string yacs_file;
std::string command;
std::string python_salome_file;
std::string batch_queue;
bool start_job;
+ int dump_yacs_state;
public:
- enum {Page_JobName,
- Page_YACSSchema,
- Page_Command_Main_Definitions,
- Page_PythonSalome_Main_Definitions,
- Page_BatchParameters,
- Page_Files,
- Page_Resource,
- Page_Conclusion};
+ enum {Page_JobName,
+ Page_YACSSchema,
+ Page_Command_Main_Definitions,
+ Page_PythonSalome_Main_Definitions,
+ Page_BatchParameters,
+ Page_Files,
+ Page_Resource,
+ Page_Conclusion};
};
class JobNamePage: virtual public QWizardPage
createJobSummaryTab();
createJobFilesTab();
-
- addTab(_summary_tab, "Job Summary");
- addTab(_files_tab, "Job Files");
}
BL::JobTab::~JobTab()
QLabel * job_envfile_label = new QLabel("Env File:");
_job_envfile_label_value = new QLabel("");
+
+ // Specific values
+ _yacs_dump_state_label = new QLabel("YACS dump state:");
+ _yacs_dump_state_value = new QLabel("");
+
QGroupBox * main_values_box = new QGroupBox("Main values");
- QFormLayout * values_form = new QFormLayout;
- values_form->insertRow(0, job_name_label, _job_name_label_value);
- 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_launcher_label, _job_launcher_label_value);
- values_form->insertRow(4, job_resource_label, _job_resource_label_value);
- values_form->insertRow(5, job_jobfile_label, _job_jobfile_label_value);
- values_form->insertRow(6, job_envfile_label, _job_envfile_label_value);
- main_values_box->setLayout(values_form);
+ _main_values_form = new QFormLayout;
+ _main_values_form->insertRow(0, job_name_label, _job_name_label_value);
+ _main_values_form->insertRow(1, job_type_label, _job_type_label_value);
+ _main_values_form->insertRow(2, job_state_label, _job_state_label_value);
+ _main_values_form->insertRow(3, job_launcher_label, _job_launcher_label_value);
+ _main_values_form->insertRow(4, job_resource_label, _job_resource_label_value);
+ _main_values_form->insertRow(5, job_jobfile_label, _job_jobfile_label_value);
+ _main_values_form->insertRow(6, job_envfile_label, _job_envfile_label_value);
+ main_values_box->setLayout(_main_values_form);
QLabel * job_nif_label = new QLabel("Number of Input Files:");
_job_nif_label_value = new QLabel("");
mainLayout->addWidget(main_values_box);
mainLayout->addWidget(run_values_box);
_summary_tab->setLayout(mainLayout);
+
+ removeTab(0);
+ insertTab(0, _summary_tab, "Job Summary");
+ setCurrentIndex(0);
}
void
BL::JobTab::createJobFilesTab()
{
_files_tab = new QWidget(this);
-
+
_input_files_list = new QListWidget(this);
_input_files_list->setSelectionMode(QAbstractItemView::NoSelection);
QGroupBox * input_files_box = new QGroupBox("Input Files");
mainLayout->addWidget(input_files_box);
mainLayout->addWidget(output_files_box);
_files_tab->setLayout(mainLayout);
+
+ insertTab(1, _files_tab, "Job Files");
}
void
{
BL::Job * job = _jobs_manager->getJob(item_name->text().toStdString());
+ // create a new tab
+ // to be replaced if it is too long
+ createJobSummaryTab();
+
_job_name_label_value->setText(QString(job->getName().c_str()));
if (job->getState() == BL::Job::CREATED)
_output_files_list->addItem(QString(file.c_str()));
}
+ // Specific parameters management
+ if (job->getDumpYACSState() > 0)
+ {
+ // Add widget in the layout
+ _yacs_dump_state_value->setText(QVariant(job->getDumpYACSState()).toString());
+ _main_values_form->insertRow(7, _yacs_dump_state_label, _yacs_dump_state_value);
+ }
}
else
DEBTRACE ("itemFromIndex returns 0 !");
_input_files_list->clear();
_output_files_list->clear();
+
+ // Specific parameters management
+ DEBTRACE("_yacs_dump_state_value->text():--" << _yacs_dump_state_value->text().toStdString() << "--");
+ if (_yacs_dump_state_value->text() != "")
+ {
+ _yacs_dump_state_value->setText("");
+ createJobSummaryTab();
+ }
}
BL::JobsManager_QT * _jobs_manager;
QWidget * _summary_tab;
+ QWidget * _files_tab;
+
// Main Values
+ QGroupBox * _main_values_box;
+ QFormLayout * _main_values_form;
QLabel * _job_name_label_value;
QLabel * _job_type_label_value;
QLabel * _job_state_label_value;
QLabel * _job_em_label_value;
QLabel * _job_nop_label_value;
- QWidget * _files_tab;
+ // Specific Values
+ QLabel * _yacs_dump_state_label;
+ QLabel * _yacs_dump_state_value;
QListWidget * _input_files_list;
QListWidget * _output_files_list;
// YACS schema job
new_job->setType(BL::Job::YACS_SCHEMA);
new_job->setJobFile(wizard.yacs_file);
+ new_job->setDumpYACSState(wizard.dump_yacs_state);
}
else if (wizard.command != "")
{