Salome HOME
Fix regression in Launcher with ForEach-like batch jobs
[modules/yacs.git] / src / Launcher / Launcher.cxx
index cb883ffe7ad74cb8f2700ade9bace3b8226987c4..8471b2265615a38f3bfab27aae4bcfbf77875648 100644 (file)
@@ -184,6 +184,30 @@ Launcher_cpp::getJobState(int job_id)
   return state.c_str();
 }
 
+//=============================================================================
+/*!
+ * Get job assigned hostnames
+ */
+//=============================================================================
+const char *
+Launcher_cpp::getAssignedHostnames(int job_id)
+{
+  LAUNCHER_MESSAGE("Get job assigned hostnames");
+
+  // Check if job exist
+  std::map<int, Launcher::Job *>::const_iterator it_job = _launcher_job_map.find(job_id);
+  if (it_job == _launcher_job_map.end())
+  {
+    LAUNCHER_INFOS("Cannot find the job, is it created ? job number: " << job_id);
+    throw LauncherException("Cannot find the job, is it created ?");
+  }
+
+  Launcher::Job * job = it_job->second;
+  std::string assigned_hostnames = job->getAssignedHostnames();
+
+  return assigned_hostnames.c_str();
+}
+
 //=============================================================================
 /*!
  * Get Job result - the result directory could be changed
@@ -439,6 +463,12 @@ Launcher_cpp::FactoryBatchManager(ParserResourcesType& params)
     case vishnu:
       bmType = "VISHNU";
       break;
+    case oar:
+      bmType = "OAR";
+      break;
+    case coorm:
+      bmType = "COORM";
+      break;
     default:
       LAUNCHER_MESSAGE("Bad batch description of the resource: Batch = " << params.Batch);
       throw LauncherException("No batchmanager for that cluster - Bad batch description of the resource");
@@ -485,6 +515,14 @@ Launcher_cpp::getJobState(int job_id)
                           "(libBatch was not present at compilation time)");
 }
 
+const char *
+Launcher_cpp::getAssignedHostnames(int job_id)
+{
+  LAUNCHER_INFOS("Launcher compiled without LIBBATCH - cannot get job assigned hostnames!!!");
+  throw LauncherException("Method Launcher_cpp::getAssignedHostnames is not available "
+                          "(libBatch was not present at compilation time)");
+}
+
 void
 Launcher_cpp::getJobResults(int job_id, std::string directory)
 {