Salome HOME
Try to kill Salome application when a YACS Launcher job is killed
[modules/kernel.git] / src / Launcher / Launcher_Job.cxx
index 52622cd23ca83d97a451a5587c5e9d78d9791d1f..5728af45ee5a2a62bcca60bd9b12e4db4c18e7c7 100644 (file)
@@ -67,6 +67,27 @@ Launcher::Job::~Job()
 #endif
 }
 
+void
+Launcher::Job::stopJob()
+{
+  LAUNCHER_MESSAGE("Stop resquested for job number: " << _number);
+  setState("FAILED");
+#ifdef WITH_LIBBATCH
+  if (_batch_job_id.getReference() != "undefined")
+  {
+    try 
+    {
+      _batch_job_id.deleteJob();
+    }
+    catch (const Batch::EmulationException &ex)
+    {
+      LAUNCHER_INFOS("WARNING: exception when stopping the job: " << ex.message);
+    }
+  }
+#endif
+}
+
+
 void
 Launcher::Job::removeJob()
 {
@@ -404,8 +425,8 @@ std::string
 Launcher::Job::updateJobState()
 {
 
-  if (_state != "FINISHED" ||
-      _state != "ERROR"    ||
+  if (_state != "FINISHED" &&
+      _state != "ERROR"    &&
       _state != "FAILED")
   {
 #ifdef WITH_LIBBATCH