]> SALOME platform Git repositories - tools/libbatch.git/blobdiff - src/LSF/BatchManager_LSF.cxx
Salome HOME
Add very simple log system
[tools/libbatch.git] / src / LSF / BatchManager_LSF.cxx
index e9388fa05e157dee61c18b049885ab6edc8705ca..a1b0dafbe9ec6350f55cb9dbda81274097640806 100644 (file)
@@ -38,6 +38,7 @@
 #include <NotYetImplementedException.hxx>
 #include "BatchManager_LSF.hxx"
 #include "JobInfo_LSF.hxx"
+#include "Log.hxx"
 
 using namespace std;
 
@@ -64,23 +65,23 @@ namespace Batch {
     const std::string workDir = params[WORKDIR];
 
     // export input files on cluster
-    cerr << "Export des fichiers en entree" << endl;
+    LOG("Export des fichiers en entree");
     exportInputFiles(job);
 
     // build batch script for job
-    cerr << "Construction du script de batch" << endl;
+    LOG("Construction du script de batch");
     string scriptFile = buildSubmissionScript(job);
-    cerr << "Script envoye" << endl;
+    LOG("Script envoye");
 
     // define command to submit batch
     string subCommand = string("cd ") + workDir + "; bsub < " + scriptFile;
     string command = _protocol.getExecCommand(subCommand, _hostname, _username);
     command += " 2>&1";
-    cerr << command.c_str() << endl;
+    LOG(command);
 
     string output;
     int status = Utils::getCommandOutput(command, output);
-    cout << output;
+    LOG(output);
     if (status != 0) throw RunTimeException("Can't submit job, error was: " + output);
 
     // read id of submitted job in output
@@ -103,12 +104,12 @@ namespace Batch {
     // define command to delete batch
     string subCommand = string("bkill ") + iss.str();
     string command = _protocol.getExecCommand(subCommand, _hostname, _username);
-    cerr << command.c_str() << endl;
+    LOG(command);
     status = system(command.c_str());
     if (status)
       throw RunTimeException("Error of connection on remote host");
 
-    cerr << "jobId = " << ref << "killed" << endl;
+    LOG("jobId = " << ref << "killed");
   }
 
   // Methode pour le controle des jobs : renvoie l'etat du job
@@ -121,7 +122,7 @@ namespace Batch {
     // define command to query batch
     string subCommand = string("bjobs ") + iss.str();
     string command = _protocol.getExecCommand(subCommand, _hostname, _username);
-    cerr << command.c_str() << endl;
+    LOG(command);
 
     string output;
     int status = Utils::getCommandOutput(command, output);
@@ -251,7 +252,7 @@ namespace Batch {
     tempOutputFile.flush();
     tempOutputFile.close();
 
-    cerr << "Batch script file generated is: " << TmpFileName.c_str() << endl;
+    LOG("Batch script file generated is: " << TmpFileName.c_str());
 
     string remoteFileName = rootNameToExecute + "_Batch.sh";
     int status = _protocol.copyFile(TmpFileName, "", "",
@@ -284,7 +285,7 @@ namespace Batch {
 
     string subCommand = string("echo $HOME");
     string command = _protocol.getExecCommand(subCommand, _hostname, _username) + " > " + filelogtemp;
-    cerr << command.c_str() << endl;
+    LOG(command);
     int status = system(command.c_str());
     if (status)
       throw RunTimeException("Error of launching home command on remote host");