From e602ebae00c924277ee1401a16196a6adaf1f4a5 Mon Sep 17 00:00:00 2001 From: vsr Date: Mon, 8 Sep 2008 06:35:54 +0000 Subject: [PATCH] =?utf8?q?Remove=20debug=20output=20from=20terminal.=20Avo?= =?utf8?q?id=20using=20"utilities.h"=20in=20standalone=20(non-CORBA)=20cla?= =?utf8?q?sses=20(requested=20by=20B.S=C3=A9cher=20via=20mail)?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/Launcher/Launcher.cxx | 59 +++++++++++++++++++------- src/Launcher/SALOME_LauncherServer.cxx | 6 +-- 2 files changed, 46 insertions(+), 19 deletions(-) diff --git a/src/Launcher/Launcher.cxx b/src/Launcher/Launcher.cxx index 7f2d491c5..9f9f3904d 100644 --- a/src/Launcher/Launcher.cxx +++ b/src/Launcher/Launcher.cxx @@ -21,7 +21,6 @@ #include "Batch_FactBatchManager_eLSF.hxx" #include "Batch_FactBatchManager_ePBS.hxx" #include "Launcher.hxx" -#include "utilities.h" #include #include #include @@ -39,7 +38,9 @@ using namespace std; Launcher_cpp::Launcher_cpp() { - MESSAGE ( "Launcher_cpp constructor" ); +#if defined(_DEBUG_) || defined(_DEBUG) + cerr << "Launcher_cpp constructor" << endl; +#endif } //============================================================================= @@ -50,7 +51,9 @@ Launcher_cpp::Launcher_cpp() Launcher_cpp::~Launcher_cpp() { - MESSAGE ( "Launcher_cpp destructor" ); +#if defined(_DEBUG_) || defined(_DEBUG) + cerr << "Launcher_cpp destructor" << endl; +#endif std::map < string, Batch::BatchManager_eClient * >::const_iterator it1; for(it1=_batchmap.begin();it1!=_batchmap.end();it1++) delete it1->second; @@ -74,7 +77,9 @@ long Launcher_cpp::submitSalomeJob( const string fileToExecute , const batchParams& batch_params, const machineParams& params) throw(LauncherException) { - MESSAGE ( "BEGIN OF Launcher_cpp::submitSalomeJob" ); +#if defined(_DEBUG_) || defined(_DEBUG) + cerr << "BEGIN OF Launcher_cpp::submitSalomeJob" << endl; +#endif long jobId; vector aMachineList; @@ -95,7 +100,9 @@ long Launcher_cpp::submitSalomeJob( const string fileToExecute , ParserResourcesType p = _ResManager->GetResourcesList(aMachineList[0]); string clustername(p.Alias); - MESSAGE ( "Choose cluster: " << clustername ); +#if defined(_DEBUG_) || defined(_DEBUG) + cerr << "Choose cluster: " << clustername << endl; +#endif // search batch manager for that cluster in map or instanciate one map < string, Batch::BatchManager_eClient * >::const_iterator it = _batchmap.find(clustername); @@ -286,18 +293,26 @@ Batch::BatchManager_eClient *Launcher_cpp::FactoryBatchManager( const ParserReso mpi = "indif"; break; } - MESSAGE ( "Instanciation of batch manager" ); +#if defined(_DEBUG_) || defined(_DEBUG) + cerr << "Instanciation of batch manager" << endl; +#endif switch( params.Batch ){ case pbs: - MESSAGE ( "Instantiation of PBS batch manager" ); +#if defined(_DEBUG_) || defined(_DEBUG) + cerr << "Instantiation of PBS batch manager" << endl; +#endif fact = new Batch::FactBatchManager_ePBS; break; case lsf: - MESSAGE ( "Instantiation of LSF batch manager" ); +#if defined(_DEBUG_) || defined(_DEBUG) + cerr << "Instantiation of LSF batch manager" << endl; +#endif fact = new Batch::FactBatchManager_eLSF; break; default: - MESSAGE ( "BATCH = " << params.Batch ); +#if defined(_DEBUG_) || defined(_DEBUG) + cerr << "BATCH = " << params.Batch << endl; +#endif throw LauncherException("no batchmanager for that cluster"); } return (*fact)(hostname.c_str(),protocol.c_str(),mpi.c_str()); @@ -407,7 +422,9 @@ string Launcher_cpp::buildSalomeCouplingScript(const string fileToExecute, const tempOutputFile.flush(); tempOutputFile.close(); chmod(TmpFileName.c_str(), 0x1ED); - MESSAGE ( TmpFileName.c_str() ); +#if defined(_DEBUG_) || defined(_DEBUG) + cerr << TmpFileName.c_str() << endl; +#endif delete mpiImpl; @@ -471,8 +488,10 @@ string Launcher_cpp::getRemoteFile( std::string remoteDir, std::string localFile bool Launcher_cpp::check(const batchParams& batch_params) { bool rtn = true; - MESSAGE ( "Job parameters are :" ); - MESSAGE ( "Directory : $HOME/Batch/$date" ); +#if defined(_DEBUG_) || defined(_DEBUG) + cerr << "Job parameters are :" << endl; + cerr << "Directory : $HOME/Batch/$date" << endl; +#endif // check expected_during_time (check the format) std::string edt_info = batch_params.expected_during_time; @@ -509,7 +528,9 @@ bool Launcher_cpp::check(const batchParams& batch_params) else { edt_info = "No value given"; } - MESSAGE ( "Expected during time : " << edt_info ); +#if defined(_DEBUG_) || defined(_DEBUG) + cerr << "Expected during time : " << edt_info << endl;; +#endif // check memory (check the format) std::string mem_info; @@ -535,7 +556,9 @@ bool Launcher_cpp::check(const batchParams& batch_params) else { mem_info = "No value given"; } - MESSAGE ( "Memory : " << mem_info ); +#if defined(_DEBUG_) || defined(_DEBUG) + cerr << "Memory : " << mem_info << endl; +#endif // check nb_proc std::string nb_proc_info; @@ -549,7 +572,9 @@ bool Launcher_cpp::check(const batchParams& batch_params) else { nb_proc_info = nb_proc_value.str(); } - MESSAGE ( "Nb of processors : " << nb_proc_info ); +#if defined(_DEBUG_) || defined(_DEBUG) + cerr << "Nb of processors : " << nb_proc_info << endl; +#endif return rtn; } @@ -617,7 +642,9 @@ Launcher_cpp::getHomeDir(const ParserResourcesType& p, const std::string& tmpdir command += p.Alias; command += " 'echo $HOME' > "; command += filelogtemp; - MESSAGE ( command.c_str() ); +#if defined(_DEBUG_) || defined(_DEBUG) + std::cerr << command.c_str() << std::endl; +#endif int status = system(command.c_str()); if(status) throw LauncherException("Error of launching home command on remote host"); diff --git a/src/Launcher/SALOME_LauncherServer.cxx b/src/Launcher/SALOME_LauncherServer.cxx index 5913d0ffb..a79dc3f91 100644 --- a/src/Launcher/SALOME_LauncherServer.cxx +++ b/src/Launcher/SALOME_LauncherServer.cxx @@ -32,7 +32,7 @@ void AttachDebugger() { std::stringstream exec; exec << "$DEBUGGER SALOME_LauncherServer " << getpid() << "&"; - std::cerr << exec.str() << std::endl; + MESSAGE ( exec.str() ); system(exec.str().c_str()); while(1); } @@ -40,13 +40,13 @@ void AttachDebugger() void terminateHandler(void) { - std::cerr << "Terminate: not managed exception !" << std::endl; + MESSAGE ( "Terminate: not managed exception !" ); AttachDebugger(); } void unexpectedHandler(void) { - std::cerr << "Unexpected: unexpected exception !" << std::endl; + MESSAGE ( "Unexpected: unexpected exception !" ); AttachDebugger(); } -- 2.39.2