]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
YACS job without session.
authorOvidiu MIRCESCU <ovidiu.mircescu@edf.fr>
Thu, 12 Aug 2021 15:48:48 +0000 (17:48 +0200)
committerOvidiu MIRCESCU <ovidiu.mircescu@edf.fr>
Thu, 12 Aug 2021 15:48:48 +0000 (17:48 +0200)
src/Launcher/Launcher_Job_SALOME.cxx
src/Launcher/Launcher_Job_SALOME.hxx
src/Launcher/Launcher_Job_YACSFile.cxx

index 27c371346557753715dd83471f2ad61915136dc7..394d3aac67d6358ea48c3be2cacf84a7b2730127 100644 (file)
@@ -35,7 +35,8 @@
 
 #include <sstream>
 
-Launcher::Job_SALOME::Job_SALOME() {}
+Launcher::Job_SALOME::Job_SALOME(bool activateSession)
+: _activateSession(activateSession){}
 
 Launcher::Job_SALOME::~Job_SALOME() {}
 
@@ -132,32 +133,35 @@ Launcher::Job_SALOME::buildSalomeScript(Batch::Parametre params)
     launch_script_stream << "} > $CATALOG_FILE" << std::endl;
     launch_script_stream << "fi" << std::endl;
   }
-  // Create file for ns-port-log
-  if (is_launcher_file)
-      // for a salome application file, we write NS_PORT_FILE_PATH in working directory
-      launch_script_stream << "NS_PORT_FILE_PATH=$(mktemp " << work_directory << "/nsport_" << _launch_date << "_XXXXXX) &&\n";
-  else
-      launch_script_stream << "NS_PORT_FILE_PATH=$(mktemp " << _resource_definition.AppliPath << "/USERS/nsport_XXXXXX) &&\n";
-
-  // Launch SALOME with an appli
-  if (is_launcher_file)
-      launch_script_stream << _resource_definition.AppliPath << " start --terminal --ns-port-log=\"$NS_PORT_FILE_PATH\" --server-launch-mode=fork ";
-  else
-      launch_script_stream << _resource_definition.AppliPath << "/salome start --terminal --ns-port-log=\"$NS_PORT_FILE_PATH\" --server-launch-mode=fork ";
-  launch_script_stream << "> logs/salome_" << _launch_date << ".log 2>&1 &&" << std::endl;
-  launch_script_stream << "current=0 &&\n"
-                       << "stop=20 &&\n"
-                       << "while ! test -s \"$NS_PORT_FILE_PATH\"\n"
-                       << "do\n"
-                       << "  sleep 2\n"
-                       << "  current=$((current+1))\n"
-                       << "  if [ \"$current\" -eq \"$stop\" ] ; then\n"
-                       << "    echo Error Naming Service failed ! >&2\n"
-                       << "    exit\n"
-                       << "  fi\n"
-                       << "done &&\n"
-                       << "appli_port=$(cat \"$NS_PORT_FILE_PATH\") &&\n"
-                       << "rm \"$NS_PORT_FILE_PATH\" &&\n";
+  if(_activateSession)
+  {
+    // Create file for ns-port-log
+    if (is_launcher_file)
+        // for a salome application file, we write NS_PORT_FILE_PATH in working directory
+        launch_script_stream << "NS_PORT_FILE_PATH=$(mktemp " << work_directory << "/nsport_" << _launch_date << "_XXXXXX) &&\n";
+    else
+        launch_script_stream << "NS_PORT_FILE_PATH=$(mktemp " << _resource_definition.AppliPath << "/USERS/nsport_XXXXXX) &&\n";
+
+    // Launch SALOME with an appli
+    if (is_launcher_file)
+        launch_script_stream << _resource_definition.AppliPath << " start --terminal --ns-port-log=\"$NS_PORT_FILE_PATH\" --server-launch-mode=fork ";
+    else
+        launch_script_stream << _resource_definition.AppliPath << "/salome start --terminal --ns-port-log=\"$NS_PORT_FILE_PATH\" --server-launch-mode=fork ";
+    launch_script_stream << "> logs/salome_" << _launch_date << ".log 2>&1 &&" << std::endl;
+    launch_script_stream << "current=0 &&\n"
+                        << "stop=20 &&\n"
+                        << "while ! test -s \"$NS_PORT_FILE_PATH\"\n"
+                        << "do\n"
+                        << "  sleep 2\n"
+                        << "  current=$((current+1))\n"
+                        << "  if [ \"$current\" -eq \"$stop\" ] ; then\n"
+                        << "    echo Error Naming Service failed ! >&2\n"
+                        << "    exit\n"
+                        << "  fi\n"
+                        << "done &&\n"
+                        << "appli_port=$(cat \"$NS_PORT_FILE_PATH\") &&\n"
+                        << "rm \"$NS_PORT_FILE_PATH\" &&\n";
+  }
 
   // Call real job type
   addJobTypeSpecificScript(launch_script_stream);
@@ -165,10 +169,13 @@ Launcher::Job_SALOME::buildSalomeScript(Batch::Parametre params)
   launch_script_stream << "echo $? > logs/exit_code.log" << std::endl;
 
   // End
-  if (is_launcher_file)
-      launch_script_stream << _resource_definition.AppliPath << " kill \"$appli_port\"" << std::endl;
-  else
-      launch_script_stream << _resource_definition.AppliPath << "/salome kill \"$appli_port\"" << std::endl;
+  if(_activateSession)
+  {
+    if (is_launcher_file)
+        launch_script_stream << _resource_definition.AppliPath << " kill \"$appli_port\"" << std::endl;
+    else
+        launch_script_stream << _resource_definition.AppliPath << "/salome kill \"$appli_port\"" << std::endl;
+  }
 
   // Return
   launch_script_stream.flush();
index a3f15de1d543432ea73b06da7b78702cf14fd2fc..85e74c62f2ca03d762b7791a78a130ee2db30ffc 100644 (file)
@@ -35,7 +35,7 @@ namespace Launcher
   class LAUNCHER_EXPORT Job_SALOME : virtual public Launcher::Job
   {
     public:
-      Job_SALOME();
+      Job_SALOME(bool activateSession=true);
       virtual ~Job_SALOME();
 
       virtual void setResourceDefinition(const ParserResourcesType & resource_definition);
@@ -46,6 +46,8 @@ namespace Launcher
       std::string buildSalomeScript(Batch::Parametre params);
       virtual void addJobTypeSpecificScript(std::ofstream & launch_script_stream) = 0;
 #endif
+  private:
+      bool _activateSession;
   };
 }
 
index 6d8b57cbe4da22daf1ca66691c47f4a46bb01dd2..bc0fbbf5d11b3bbb7a2d7fd253c7067046c2f005 100644 (file)
@@ -26,6 +26,7 @@
 const char Launcher::Job_YACSFile::TYPE_NAME[] = "yacs_file";
 
 Launcher::Job_YACSFile::Job_YACSFile()
+:Launcher::Job_SALOME(false)
 {
   _job_type = Launcher::Job_YACSFile::TYPE_NAME;
   _dumpState = -1;
@@ -46,9 +47,9 @@ Launcher::Job_YACSFile::addJobTypeSpecificScript(std::ofstream & launch_script_s
   struct stat statbuf;
   if(stat(getenv("APPLI"), &statbuf) ==0 &&  S_ISREG(statbuf.st_mode))
       // case of a salome launcher file
-      launch_script_stream << _resource_definition.AppliPath << " shell -p \"$appli_port\" -- driver -k\"$appli_port\" " << _job_file_name_complete;
+      launch_script_stream << _resource_definition.AppliPath << " shell -- driver " << _job_file_name_complete;
   else
-      launch_script_stream << _resource_definition.AppliPath << "/salome shell -p \"$appli_port\" -- driver -k\"$appli_port\" " << _job_file_name_complete;
+      launch_script_stream << _resource_definition.AppliPath << "/salome shell -- driver " << _job_file_name_complete;
   if (_dumpState > 0)
     launch_script_stream << " --dump=" << _dumpState;
   if(! _yacsDriverOptions.empty())