Salome HOME
Add command_salome job type. omu/preprocess
authorOvidiu Mircescu <ovidiu.mircescu@edf.fr>
Wed, 24 Jan 2018 16:28:27 +0000 (17:28 +0100)
committerOvidiu Mircescu <ovidiu.mircescu@edf.fr>
Wed, 24 Jan 2018 16:28:27 +0000 (17:28 +0100)
src/engine/BL_Job.cxx
src/engine/BL_Job.hxx
src/engine/BL_SALOMEServices.cxx
src/genericgui/BL_CreateJobWizard.cxx
src/genericgui/BL_CreateJobWizard.hxx
src/genericgui/BL_JobTab.cxx
src/genericgui/BL_JobsManager_QT.cxx
src/genericgui/BL_QModelManager.cxx

index 01c7d3dce55449c4d7c0ae0ee98fda9cce613454..ccfd48ff38af71b3ae7ec1b44ec10bcdcba3b4da 100644 (file)
@@ -117,6 +117,10 @@ BL::Job::setType(const std::string & type)
   {
     setType(BL::Job::PYTHON_SALOME);
   }
+  else if (type == "command_salome")
+  {
+    setType(BL::Job::COMMAND_SALOME);
+  }
 }
 
 BL::Job::JobType
index cbc972d910cd0e4e8f85aabf71ac9f485eed84df..243b2f890b64024cc72fe82de0d4aab11fea6863 100644 (file)
@@ -42,7 +42,7 @@ namespace BL{
       void setName(const std::string & name);
       std::string getName();
 
-      enum JobType {YACS_SCHEMA, COMMAND, PYTHON_SALOME};
+      enum JobType {YACS_SCHEMA, COMMAND, PYTHON_SALOME, COMMAND_SALOME};
       void setType(BL::Job::JobType type);
       void setType(const std::string & type);
       BL::Job::JobType getType();
index 19b0377b1607c40d9b009bf8d08b4428cff190f2..ab6dac15755beb2fa24a1f89037f38021d4432d0 100644 (file)
@@ -263,6 +263,10 @@ BL::SALOMEServices::create_job(BL::Job * job)
   {
     job_parameters->job_type = CORBA::string_dup("python_salome");
   }
+  else if (job->getType() == BL::Job::COMMAND_SALOME)
+  {
+    job_parameters->job_type = CORBA::string_dup("command_salome");
+  }
 
   // Specific parameters
   if (job->getType() == BL::Job::YACS_SCHEMA)
index 6d46e40cfc127d3b57ec3a96f2750661e91a2d42..28b97f99bafc89dcd4abfa1b1c1a1a8ed7483615 100644 (file)
@@ -156,6 +156,13 @@ BL::CreateJobWizard::clone(const std::string & name)
       setField("env_command_file", QString(job->getEnvFile().c_str()));
       setField("pre_command_file", QString(job->getPreCommand().c_str()));
     }
+    else if (job->getType() == BL::Job::COMMAND_SALOME)
+    {
+      setField("command", QString(job->getJobFile().c_str()));
+      setField("job_type_command_salome", true);
+      setField("env_command_file", QString(job->getEnvFile().c_str()));
+      setField("pre_command_file", QString(job->getPreCommand().c_str()));
+    }
     else if (job->getType() == BL::Job::PYTHON_SALOME)
     {
       setField("PythonSalome", QString(job->getJobFile().c_str()));
@@ -273,6 +280,8 @@ BL::CreateJobWizard::end(int result)
       job_type = YACS;
     else if (field("job_type_command").toBool())
       job_type = COMMAND;
+    else if (field("job_type_command_salome").toBool())
+      job_type = COMMAND_SALOME;
     else
       job_type = PYTHON_SALOME;
 
@@ -293,7 +302,7 @@ BL::CreateJobWizard::end(int result)
     QString f_env_file;
     if (job_type == YACS)
       f_env_file = field("env_yacs_file").toString();
-    else if (job_type == COMMAND)
+    else if (job_type == COMMAND || job_type == COMMAND_SALOME)
       f_env_file = field("env_command_file").toString();
     else if (job_type == PYTHON_SALOME)
       f_env_file = field("env_PythonSalome_file").toString();
@@ -302,7 +311,7 @@ BL::CreateJobWizard::end(int result)
     QString f_pre_command_file;
     if (job_type == YACS)
       f_pre_command_file = field("pre_yacs_file").toString();
-    else if (job_type == COMMAND)
+    else if (job_type == COMMAND || job_type == COMMAND_SALOME)
       f_pre_command_file = field("pre_command_file").toString();
     else if (job_type == PYTHON_SALOME)
       f_pre_command_file = field("pre_PythonSalome_file").toString();
@@ -440,15 +449,18 @@ BL::JobNamePage::JobNamePage(QWidget * parent, BL::JobsManager_QT * jobs_manager
   QRadioButton * _yacs_schema_button = new QRadioButton(tr("YACS Schema"));
   _yacs_schema_button->setChecked(true);
   QRadioButton * _command_button = new QRadioButton(tr("Command"));
+  QRadioButton * _command_salome_button = new QRadioButton(tr("Command in salome shell"));
   QRadioButton * _python_salome_button = new QRadioButton(tr("Python script in SALOME"));
   QVBoxLayout *vbox = new QVBoxLayout;
   vbox->addWidget(_yacs_schema_button);
   vbox->addWidget(_command_button);
+  vbox->addWidget(_command_salome_button);
   vbox->addWidget(_python_salome_button);
   vbox->addStretch(1);
   groupBox->setLayout(vbox);
   registerField("job_type_yacs", _yacs_schema_button);
   registerField("job_type_command", _command_button);
+  registerField("job_type_command_salome", _command_salome_button);
   registerField("job_type_python_salome", _python_salome_button);
 
   QGroupBox * explanationBox = new QGroupBox("Explanation");
@@ -473,6 +485,7 @@ BL::JobNamePage::JobNamePage(QWidget * parent, BL::JobsManager_QT * jobs_manager
 
   connect(_yacs_schema_button, SIGNAL(toggled(bool)), this, SLOT(yacs_schema_button(bool)));
   connect(_command_button, SIGNAL(toggled(bool)), this, SLOT(command_button(bool)));
+  connect(_command_salome_button, SIGNAL(toggled(bool)), this, SLOT(command_salome_button(bool)));
   connect(_python_salome_button, SIGNAL(toggled(bool)), this, SLOT(python_salome_button(bool)));
 
   // Default button
@@ -487,7 +500,7 @@ BL::JobNamePage::yacs_schema_button(bool checked)
 {
   if (checked)
   {
-    _explanation->setText("This job permits to launch a YACS schema into a SALOME application");
+    _explanation->setText("Launch a YACS schema.");
     setField("exclusive", true);
   }
 }
@@ -497,7 +510,19 @@ BL::JobNamePage::command_button(bool checked)
 {
   if (checked)
   {
-    _explanation->setText("This job permits to launch a script into a distributed resource. This script is not launched into a SALOME application");
+    _explanation->setText("Launch a script on a remote resource without using "
+                          "SALOME environment.");
+    setField("exclusive", false);
+  }
+}
+
+void
+BL::JobNamePage::command_salome_button(bool checked)
+{
+  if (checked)
+  {
+    _explanation->setText("Launch a script on a remote resource within SALOME "
+                          "environment but whitout the SALOME application.");
     setField("exclusive", false);
   }
 }
@@ -507,7 +532,7 @@ BL::JobNamePage::python_salome_button(bool checked)
 {
   if (checked)
   {
-    _explanation->setText("This job permits to launch a python script into a SALOME application");
+    _explanation->setText("Launch a python script into a SALOME application.");
     setField("exclusive", true);
   }
 }
@@ -551,7 +576,8 @@ BL::JobNamePage::nextId() const
   {
     return BL::CreateJobWizard::Page_YACSSchema;
   } 
-  else if (field("job_type_command").toBool())
+  else if (field("job_type_command").toBool() ||
+           field("job_type_command_salome").toBool())
   {
     return BL::CreateJobWizard::Page_Command_Main_Definitions;
   }
index 532a90f89d4905b3f2b6a0c5d0ef32761e5aa9b8..2a40c369b12a576e9f2bb0256be640a2c13f8499 100644 (file)
@@ -72,7 +72,7 @@ namespace BL {
     public:
       // Results
       std::string job_name;
-      enum {YACS, COMMAND, PYTHON_SALOME} job_type;
+      enum {YACS, COMMAND, PYTHON_SALOME, COMMAND_SALOME} job_type;
 
       std::string yacs_file;
       std::string command;
@@ -140,6 +140,7 @@ namespace BL {
     public slots:
       void yacs_schema_button(bool checked);
       void command_button(bool checked);
+      void command_salome_button(bool checked);
       void python_salome_button(bool checked);
 
     private:
index ffc9ed6c2bc7054c1a6cf512d5865b66a96a2d32..557b06550b452ffae04e62de60e6c81f70fbf0cb 100644 (file)
@@ -237,6 +237,8 @@ BL::JobTab::job_selected(const QModelIndex & index)
       _job_type_label_value->setText("YACS_Schema");
     else if (job->getType() == BL::Job::COMMAND)
       _job_type_label_value->setText("Command");
+    else if (job->getType() == BL::Job::COMMAND_SALOME)
+      _job_type_label_value->setText("Command_Salome");
     else if (job->getType() == BL::Job::PYTHON_SALOME)
       _job_type_label_value->setText("Python_Salome");
 
index 8ff11280896fe190125446470e08562cb00b54ab..c36862fcc9023561471e3980eceec730bbc0bd39 100644 (file)
@@ -298,6 +298,11 @@ BL::JobsManager_QT::create_job_with_wizard(BL::CreateJobWizard & wizard)
     new_job->setType(BL::Job::COMMAND);
     new_job->setJobFile(wizard.command);
     break;
+  case BL::CreateJobWizard::COMMAND_SALOME:
+    // Command Job
+    new_job->setType(BL::Job::COMMAND_SALOME);
+    new_job->setJobFile(wizard.command);
+    break;
   case BL::CreateJobWizard::PYTHON_SALOME:
     // Python Salome Job
     new_job->setType(BL::Job::PYTHON_SALOME);
index 67a71d7b9e663ced857cc1c2939abdd03d5cb89a..37348e5402dce0651b567cb9715e3e15f94c5805 100644 (file)
@@ -64,6 +64,8 @@ BL::QModelManager::new_job_added(const QString & name)
     new_job_type = new QStandardItem("YACS_Schema");
   else if (job->getType() == BL::Job::COMMAND)
     new_job_type = new QStandardItem("Command");
+  else if (job->getType() == BL::Job::COMMAND_SALOME)
+    new_job_type = new QStandardItem("Command_Salome");
   else if (job->getType() == BL::Job::PYTHON_SALOME)
     new_job_type = new QStandardItem("Python_Salome");