Salome HOME
Add the possibility to retrieve one single file. omu/pleiade9110
authorOvidiu Mircescu <ovidiu.mircescu@edf.fr>
Mon, 15 Dec 2014 16:47:25 +0000 (17:47 +0100)
committerOvidiu Mircescu <ovidiu.mircescu@edf.fr>
Mon, 15 Dec 2014 16:47:25 +0000 (17:47 +0100)
EDF pleiade issue n° 9110 asked to have the possibility to retrieve
a file before the end of the job, without retrieving all the result files.

src/Core/BatchManager.cxx
src/Core/BatchManager.hxx

index 874680727ff568d3f02aee45c49ccdd432b674ba..f5340bc4bd7dfdaa6aa1e2fedddfcc8f3c4033d0 100644 (file)
@@ -293,6 +293,28 @@ namespace Batch {
     return ret;
   }
 
+  bool BatchManager::importWorkFile( const Job & job,
+                                     const std::string& work_file,
+                                     const std::string& directory )
+  {
+    Parametre params = job.getParametre();
+
+    // Create local result directory
+    int status = CommunicationProtocol::getInstance(SH).makeDirectory(directory, "", "");
+    if (status)
+      LOG("Directory creation failed. Status is: " << status);
+
+    bool ret = true;
+    status = _protocol.copyFile(string(params[WORKDIR]) + "/" + work_file,
+                                _hostname, _username,
+                                directory, "", "");
+    if (status) {
+      LOG("Copy command failed. Status is: " << status);
+      ret = false;
+    }
+    return ret;
+  }
+
   MpiImpl *BatchManager::FactoryMpiImpl(string mpiImpl)
   {
     if(mpiImpl == "lam")
index fffb817cb943d5ee6d9eba7532817f9b23a3a912..7eb91287161d3642ec431cc2cfa2e3cf4c9e22db 100644 (file)
@@ -77,6 +77,8 @@ namespace Batch {
                                       long initSleepTime = 1, long maxSleepTime = 600);
     virtual void importOutputFiles( const Job & job, const std::string directory );
     bool importDumpStateFile( const Job & job, const std::string directory );
+    // copier le fichier work_file à partir du working_directory vers directory
+    virtual bool importWorkFile( const Job & job, const std::string& work_file, const std::string& directory );
 
     // Get the underlying communication protocol
     const CommunicationProtocol & getProtocol() const;