Salome HOME
Add a remove working directory feature to the Launcher.
authorOvidiu Mircescu <ovidiu.mircescu@edf.fr>
Wed, 25 Oct 2017 09:44:22 +0000 (11:44 +0200)
committerOvidiu Mircescu <ovidiu.mircescu@edf.fr>
Wed, 25 Oct 2017 09:44:22 +0000 (11:44 +0200)
idl/SALOME_Launcher.idl
src/Launcher/Launcher.cxx
src/Launcher/Launcher.hxx
src/Launcher/SALOME_Launcher.cxx
src/Launcher/SALOME_Launcher.hxx

index fe3738a5d7e95a37fbda2f1d651b7d331a8b00f2..bebe60d4387ee3509ec4be41b8b5be6accec2ad4 100644 (file)
@@ -243,6 +243,12 @@ interface SalomeLauncher
   */
   boolean getJobDumpState(in long job_id, in string directory)   raises (SALOME::SALOME_Exception);
 
+  //! Remove the working directory on the remote file system.
+  /*!
+     \param job_id    Job id returned by createJob().
+  */
+  void clearJobWorkingDir(in long job_id) raises (SALOME::SALOME_Exception);
+
   //! Retrieve one sigle file from the working directory.
   /*! Use this method if you don't want to copy all the results of the job,
       for instance if you want to obtain a file which contains the computing
index bd3f5d4b0915d8571b746c01956047b407e32b47..8814a57236acd0f1e59ae5037f9f74f149dd04eb 100644 (file)
@@ -249,6 +249,37 @@ Launcher_cpp::getJobResults(int job_id, std::string directory)
   LAUNCHER_MESSAGE("getJobResult ended");
 }
 
+//=============================================================================
+/*!
+ * Clear the remote working directory
+ */
+//=============================================================================
+void
+Launcher_cpp::clearJobWorkingDir(int job_id)
+{
+  LAUNCHER_MESSAGE("Clear the remote working directory");
+
+  // 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;
+  try
+  {
+    _batchmap[job_id]->clearWorkingDir(*(job->getBatchJob()));
+  }
+  catch(const Batch::GenericException &ex)
+  {
+    LAUNCHER_INFOS("getJobResult is maybe incomplete, exception: " << ex.message);
+    throw LauncherException(ex.message.c_str());
+  }
+  LAUNCHER_MESSAGE("getJobResult ended");
+}
+
 //=============================================================================
 /*!
  * Get Job dump state - the result directory could be changed
index b7c66213746d519458c7278a9d04adfdf738b945..728694eddfe5a9047d568e43baf2d18c836cf7c1 100644 (file)
@@ -68,6 +68,7 @@ public:
   const char * getJobState(int job_id);
   const char * getAssignedHostnames(int job_id); // Get names or ids of hosts assigned to the job
   void         getJobResults(int job_id, std::string directory);
+  void         clearJobWorkingDir(int job_id);
   bool         getJobDumpState(int job_id, std::string directory);
   bool         getJobWorkFile(int job_id, std::string work_file, std::string directory);
   void         stopJob(int job_id);
index d37cb04e56d910582ffa6d460c913facd9ad1020..33a961d04fc279db497f8a021818ee3e6e750667 100644 (file)
@@ -286,6 +286,20 @@ SALOME_Launcher::getJobResults(CORBA::Long job_id, const char * directory)
   }
 }
 
+void
+SALOME_Launcher::clearJobWorkingDir(CORBA::Long job_id)
+{
+  try
+  {
+    _l.clearJobWorkingDir(job_id);
+  }
+  catch(const LauncherException &ex)
+  {
+    INFOS(ex.msg.c_str());
+    THROW_SALOME_CORBA_EXCEPTION(ex.msg.c_str(),SALOME::BAD_PARAM);
+  }
+}
+
 CORBA::Boolean
 SALOME_Launcher::getJobDumpState(CORBA::Long job_id, const char * directory)
 {
index cf4f5795d56090d8aa3fabeaee867fa486aa49a8..a04a5d48ee989c43e96a51096712eb1bf327e1e0 100644 (file)
@@ -51,6 +51,7 @@ public:
   char *      getJobState  (CORBA::Long job_id);
   char *      getAssignedHostnames  (CORBA::Long job_id); // Get names or ids of hosts assigned to the job
   void        getJobResults(CORBA::Long job_id, const char * directory);
+  void        clearJobWorkingDir(CORBA::Long job_id);
   CORBA::Boolean getJobDumpState(CORBA::Long job_id, const char * directory);
   CORBA::Boolean getJobWorkFile(CORBA::Long job_id, const char * work_file, const char * directory);
   void        stopJob      (CORBA::Long job_id);