]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
add getJobDumpState function
authorsecher <secher>
Thu, 27 Jan 2011 10:45:35 +0000 (10:45 +0000)
committersecher <secher>
Thu, 27 Jan 2011 10:45:35 +0000 (10:45 +0000)
idl/SALOME_ContainerManager.idl
src/Launcher/Launcher.cxx
src/Launcher/Launcher.hxx
src/Launcher/SALOME_Launcher.cxx
src/Launcher/SALOME_Launcher.hxx

index 6b44687ab64f4be424818040124eba148591cec9..965c7b0e18c123f104cdf82dd3fc47753da5db23 100644 (file)
@@ -209,6 +209,7 @@ interface SalomeLauncher
   void   launchJob    (in long job_id)                           raises (SALOME::SALOME_Exception);
   string getJobState  (in long job_id)                           raises (SALOME::SALOME_Exception);
   void   getJobResults(in long job_id, in string directory)      raises (SALOME::SALOME_Exception);
+  boolean getJobDumpState(in long job_id, in string directory)   raises (SALOME::SALOME_Exception);
   void   removeJob    (in long job_id)                           raises (SALOME::SALOME_Exception);
 
   // Useful methods
index 3211ce253da2fff406c2b8f1223d7e90f5f26106..d4d3c116e81f10ae4aa99eee6ecaf39861fdc039 100644 (file)
@@ -269,6 +269,43 @@ Launcher_cpp::getJobResults(int job_id, std::string directory)
   LAUNCHER_MESSAGE("getJobResult ended");
 }
 
+//=============================================================================
+/*!
+ * Get Job dump state - the result directory could be changed
+ */ 
+//=============================================================================
+bool
+Launcher_cpp::getJobDumpState(int job_id, std::string directory)
+{
+  bool rtn;
+  LAUNCHER_MESSAGE("Get Job dump state");
+
+  // 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 resource_name = job->getResourceDefinition().Name;
+  try 
+  {
+    if (directory != "")
+      rtn = _batchmap[resource_name]->importDumpStateFile(*(job->getBatchJob()), directory);
+    else
+      rtn = _batchmap[resource_name]->importDumpStateFile(*(job->getBatchJob()), job->getResultDirectory());
+  }
+  catch(const Batch::EmulationException &ex)
+  {
+    LAUNCHER_INFOS("getJobResult is maybe incomplete, exception: " << ex.message);
+    throw LauncherException(ex.message.c_str());
+  }
+  LAUNCHER_MESSAGE("getJobResult ended");
+  return rtn;
+}
+
 //=============================================================================
 /*!
  * Remove the job - into the Launcher and its batch manager
index 57aabac596c0bb174f149d6cfad584edd1947f8e..0cc3c16f0c143cce9d6cacba632edeed33971d24 100644 (file)
@@ -62,6 +62,7 @@ public:
   void         launchJob(int job_id);
   const char * getJobState(int job_id);
   void         getJobResults(int job_id, std::string directory);
+  bool         getJobDumpState(int job_id, std::string directory);
   void         removeJob(int job_id);
 
   // Useful methods
index 3c832ebba291d5bd4caabf865086282f637e5fb5..abf1e2389eabd88565588e78d07dbc6cc1ed0e19 100644 (file)
@@ -229,6 +229,22 @@ SALOME_Launcher::getJobResults(CORBA::Long job_id, const char * directory)
   }
 }
 
+CORBA::Boolean
+SALOME_Launcher::getJobDumpState(CORBA::Long job_id, const char * directory)
+{
+  CORBA::Boolean rtn = false;
+  try
+  {
+    rtn = _l.getJobDumpState(job_id, directory);
+  }
+  catch(const LauncherException &ex)
+  {
+    INFOS(ex.msg.c_str());
+    THROW_SALOME_CORBA_EXCEPTION(ex.msg.c_str(),SALOME::BAD_PARAM);
+  }
+  return rtn;
+}
+
 void 
 SALOME_Launcher::removeJob(CORBA::Long job_id)
 {
index fff5515e25fb0355f9caa475636c42de741aaeef..cc12af42795b574f62180482dfde56a8d636251a 100644 (file)
@@ -50,6 +50,7 @@ public:
   void        launchJob    (CORBA::Long job_id);
   char *      getJobState  (CORBA::Long job_id);
   void        getJobResults(CORBA::Long job_id, const char * directory);
+  CORBA::Boolean getJobDumpState(CORBA::Long job_id, const char * directory);
   void        removeJob    (CORBA::Long job_id);
 
   // Useful methods