]> SALOME platform Git repositories - tools/libbatch.git/blobdiff - src/CCC/BatchManager_CCC.cxx
Salome HOME
Add very simple log system
[tools/libbatch.git] / src / CCC / BatchManager_CCC.cxx
index 715a51fc98ce6ab4124d9f4308a8b3435b57f4e0..e24c17174b7fdf569aba6aa201970578ae9f75fe 100644 (file)
@@ -52,6 +52,7 @@
 
 #include "BatchManager_CCC.hxx"
 #include "JobInfo_CCC.hxx"
+#include "Log.hxx"
 
 using namespace std;
 
@@ -82,24 +83,24 @@ namespace Batch {
     std::string fileNameToExecute = fileToExecute.substr(p1+1,p2-p1-1);
 
     // 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");
     buildBatchScript(job);
-    cerr << "Script envoye" << endl;
+    LOG("Script envoye");
 
     // define command to submit batch
     string subCommand = string("bash -l -c \\\"cd ") + workDir + "; ccc_msub " + fileNameToExecute + "_Batch.sh\\\"";
     string command = _protocol.getExecCommand(subCommand, _hostname, _username);
     command += " 2>&1";
-    cerr << command.c_str() << endl;
+    LOG(command);
 
     // submit job
     string output;
     int status = Utils::getCommandOutput(command, output);
-    cout << output;
+    LOG(output);
     if (status != 0) throw RunTimeException("Can't submit job, error was: " + output);
 
     // find id of submitted job in output
@@ -127,12 +128,12 @@ namespace Batch {
     // define command to delete batch
     string subCommand = string("bash -l -c \\\"ccc_mdel ") + iss.str() + string("\\\"");
     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
@@ -145,7 +146,7 @@ namespace Batch {
     // define command to query batch
     string subCommand = string("bash -l -c \\\"bjobs ") + iss.str() + string("\\\"");
     string command = _protocol.getExecCommand(subCommand, _hostname, _username);
-    cerr << command.c_str() << endl;
+    LOG(command);
 
     string output;
     int status = Utils::getCommandOutput(command, output);
@@ -256,7 +257,7 @@ namespace Batch {
     tempOutputFile.close();
 
     Utils::chmod(TmpFileName.c_str(), 0x1ED);
-    cerr << "Batch script file generated is: " << TmpFileName.c_str() << endl;
+    LOG("Batch script file generated is: " << TmpFileName.c_str());
 
     int status = _protocol.copyFile(TmpFileName, "", "",
                                     workDir + "/" + rootNameToExecute + "_Batch.sh",
@@ -275,7 +276,7 @@ namespace Batch {
     string subCommand = string("echo ");
     subCommand += tmpdir;
     string command = _protocol.getExecCommand(subCommand, _hostname, _username);
-    cerr << command.c_str() << endl;
+    LOG(command);
 
     string output;
     int status = Utils::getCommandOutput(command, output);