Launcher_cpp::Launcher_cpp()
{
- cerr << "Launcher_cpp constructor" << endl;
+#if defined(_DEBUG_) || defined(_DEBUG)
+ cout << "Launcher_cpp constructor" << endl;
+#endif
}
//=============================================================================
Launcher_cpp::~Launcher_cpp()
{
- cerr << "Launcher_cpp destructor" << endl;
+#if defined(_DEBUG_) || defined(_DEBUG)
+ cout << "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;
long Launcher_cpp::submitJob( const std::string xmlExecuteFile,
const std::string clusterName) throw(LauncherException)
{
- cerr << "BEGIN OF Launcher_cpp::submitJob" << endl;
+#if defined(_DEBUG_) || defined(_DEBUG)
+ cout << "BEGIN OF Launcher_cpp::submitJob" << endl;
+#endif
long jobId;
vector<string> aMachineList;
ParserResourcesType p = _ResManager->GetResourcesList(aMachineList[0]);
string cname(p.Alias);
- cerr << "Choose cluster: " << cname << endl;
+#if defined(_DEBUG_) || defined(_DEBUG)
+ cout << "Choose cluster: " << cname << endl;
+#endif
// search batch manager for that cluster in map or instanciate one
map < string, Batch::BatchManager_eClient * >::const_iterator it2 = _batchmap.find(cname);
const batchParams& batch_params,
const machineParams& params) throw(LauncherException)
{
- cerr << "BEGIN OF Launcher_cpp::submitSalomeJob" << endl;
+#if defined(_DEBUG_) || defined(_DEBUG)
+ cout << "BEGIN OF Launcher_cpp::submitSalomeJob" << endl;
+#endif
long jobId;
vector<string> aMachineList;
ParserResourcesType p = _ResManager->GetResourcesList(aMachineList[0]);
string clustername(p.Alias);
- cerr << "Choose cluster: " << clustername << endl;
+#if defined(_DEBUG_) || defined(_DEBUG)
+ cout << "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);
throw LauncherException("unknown mpi implementation");
break;
}
- cerr << "Instanciation of batch manager" << endl;
+#if defined(_DEBUG_) || defined(_DEBUG)
+ cout << "Instanciation of batch manager" << endl;
+#endif
switch( params.Batch ){
case pbs:
- cerr << "Instantiation of PBS batch manager" << endl;
+#if defined(_DEBUG_) || defined(_DEBUG)
+ cout << "Instantiation of PBS batch manager" << endl;
+#endif
fact = new Batch::FactBatchManager_ePBS;
break;
case lsf:
- cerr << "Instantiation of LSF batch manager" << endl;
+#if defined(_DEBUG_) || defined(_DEBUG)
+ cout << "Instantiation of LSF batch manager" << endl;
+#endif
fact = new Batch::FactBatchManager_eLSF;
break;
case sge:
- cerr << "Instantiation of SGE batch manager" << endl;
+#if defined(_DEBUG_) || defined(_DEBUG)
+ cout << "Instantiation of SGE batch manager" << endl;
+#endif
fact = new Batch::FactBatchManager_eSGE;
break;
default:
- cerr << "BATCH = " << params.Batch << endl;
+#if defined(_DEBUG_) || defined(_DEBUG)
+ cout << "BATCH = " << params.Batch << endl;
+#endif
throw LauncherException("no batchmanager for that cluster");
}
return (*fact)(hostname.c_str(),protocol.c_str(),mpi.c_str());
tempOutputFile.flush();
tempOutputFile.close();
chmod(TmpFileName.c_str(), 0x1ED);
- cerr << TmpFileName.c_str() << endl;
+#if defined(_DEBUG_) || defined(_DEBUG)
+ cout << TmpFileName.c_str() << endl;
+#endif
delete mpiImpl;
bool Launcher_cpp::check(const batchParams& batch_params)
{
bool rtn = true;
- cerr << "Job parameters are :" << endl;
- cerr << "Directory : $HOME/Batch/$date" << endl;
+#if defined(_DEBUG_) || defined(_DEBUG)
+ cout << "Job parameters are :" << endl;
+ cout << "Directory : $HOME/Batch/$date" << endl;
+#endif
// check expected_during_time (check the format)
std::string edt_info = batch_params.expected_during_time;
else {
edt_info = "No value given";
}
- cerr << "Expected during time : " << edt_info << endl;;
+#if defined(_DEBUG_) || defined(_DEBUG)
+ cout << "Expected during time : " << edt_info << endl;;
+#endif
// check memory (check the format)
std::string mem_info;
else {
mem_info = "No value given";
}
- cerr << "Memory : " << mem_info << endl;
+#if defined(_DEBUG_) || defined(_DEBUG)
+ cout << "Memory : " << mem_info << endl;
+#endif
// check nb_proc
std::string nb_proc_info;
else {
nb_proc_info = nb_proc_value.str();
}
- cerr << "Nb of processors : " << nb_proc_info << endl;
+#if defined(_DEBUG_) || defined(_DEBUG)
+ cout << "Nb of processors : " << nb_proc_info << endl;
+#endif
return rtn;
}
if (aDoc != NULL)
handler->ProcessXmlDocument(aDoc);
- else
- cerr << "ResourcesManager_cpp: could not parse file "<< aFilePath << endl;
+ else{
+#if defined(_DEBUG_) || defined(_DEBUG)
+ cout << "ResourcesManager_cpp: could not parse file "<< aFilePath << endl;
+#endif
+ }
// Free the document
xmlFreeDoc(aDoc);
fclose(aFile);
}
- else
- cerr << "Launcher_cpp: file "<<aFilePath<<" is not readable." << endl;
+ else{
+#if defined(_DEBUG_) || defined(_DEBUG)
+ cout << "Launcher_cpp: file "<<aFilePath<<" is not readable." << endl;
+#endif
+ }
delete handler;
command += p.Alias;
command += " 'echo $HOME' > ";
command += filelogtemp;
- std::cerr << command.c_str() << std::endl;
+#if defined(_DEBUG_) || defined(_DEBUG)
+ cout << command.c_str() << endl;
+#endif
int status = system(command.c_str());
if(status)
throw LauncherException("Error of launching home command on remote host");
ResourcesManager_cpp(const char *xmlFilePath) :
_path_resources(xmlFilePath)
{
- cerr << "ResourcesManager_cpp constructor" << endl;
+#if defined(_DEBUG_) || defined(_DEBUG)
+ cout << "ResourcesManager_cpp constructor" << endl;
+#endif
}
//=============================================================================
ResourcesManager_cpp::ResourcesManager_cpp() throw(ResourcesException)
{
- cerr << "ResourcesManager_cpp constructor" << endl;
+#if defined(_DEBUG_) || defined(_DEBUG)
+ cout << "ResourcesManager_cpp constructor" << endl;
+#endif
_isAppliSalomeDefined = (getenv("APPLI") != 0);
if(!getenv("KERNEL_ROOT_DIR"))
throw ResourcesException("you must define KERNEL_ROOT_DIR environment variable!!");
}
ParseXmlFile();
- cerr << "ResourcesManager_cpp constructor end";
+#if defined(_DEBUG_) || defined(_DEBUG)
+ cout << "ResourcesManager_cpp constructor end";
+#endif
}
//=============================================================================
ResourcesManager_cpp::~ResourcesManager_cpp()
{
- cerr << "ResourcesManager_cpp destructor" << endl;
+#if defined(_DEBUG_) || defined(_DEBUG)
+ cout << "ResourcesManager_cpp destructor" << endl;
+#endif
}
//=============================================================================
ResourcesManager_cpp::GetFittingResources(const machineParams& params,
const std::vector<std::string>& componentList) throw(ResourcesException)
{
-// cerr << "ResourcesManager_cpp::GetFittingResources" << endl;
vector <std::string> vec;
ParseXmlFile();
const char *hostname = params.hostname.c_str();
- cerr << "GetFittingResources " << hostname << " " << GetHostname().c_str() << endl;
+#if defined(_DEBUG_) || defined(_DEBUG)
+ cout << "GetFittingResources " << hostname << " " << GetHostname().c_str() << endl;
+#endif
if (hostname[0] != '\0'){
- // cerr << "ResourcesManager_cpp::GetFittingResources : hostname specified" << endl;
if ( strcmp(hostname, "localhost") == 0 ||
strcmp(hostname, GetHostname().c_str()) == 0 )
{
- // cerr << "ResourcesManager_cpp::GetFittingResources : localhost" << endl;
vec.push_back(GetHostname().c_str());
- // cerr << "ResourcesManager_cpp::GetFittingResources : " << vec.size() << endl;
}
else if (_resourcesList.find(hostname) != _resourcesList.end())
if( (*iter).second.DataForSort._nbOfNodes > 1 ){
if( strncmp(hostname,(*iter).first.c_str(),strlen(hostname)) == 0 ){
vec.push_back((*iter).first.c_str());
- //cerr << "SALOME_ResourcesManager_cpp::GetFittingResources vector["
- // << cpt << "] = " << (*iter).first.c_str() << endl ;
cpt++;
}
}
}
if(cpt==0){
// --- user specified an unknown hostame so notify him.
- cerr << "ResourcesManager_cpp::GetFittingResources : SALOME_Exception" << endl;
+#if defined(_DEBUG_) || defined(_DEBUG)
+ cout << "ResourcesManager_cpp::GetFittingResources : SALOME_Exception" << endl;
+#endif
throw ResourcesException("unknown host");
}
}
if (aFile == NULL)
{
- cerr << "Error opening file !" << endl;
+#if defined(_DEBUG_) || defined(_DEBUG)
+ cout << "Error opening file !" << endl;
+#endif
return;
}
int isOk = xmlSaveFile(aFilePath, aDoc);
if (!isOk)
- cerr << "Error while XML file saving." << endl;
+#if defined(_DEBUG_) || defined(_DEBUG)
+ cout << "Error while XML file saving." << endl;
+#endif
// Free the document
xmlFreeDoc(aDoc);
fclose(aFile);
- cerr << "WRITING DONE!" << endl;
+#if defined(_DEBUG_) || defined(_DEBUG)
+ cout << "WRITING DONE!" << endl;
+#endif
}
//=============================================================================
if (aDoc != NULL)
handler->ProcessXmlDocument(aDoc);
else
- cerr << "ResourcesManager_cpp: could not parse file "<< aFilePath << endl;
+#if defined(_DEBUG_) || defined(_DEBUG)
+ cout << "ResourcesManager_cpp: could not parse file "<< aFilePath << endl;
+#endif
// Free the document
xmlFreeDoc(aDoc);
fclose(aFile);
}
else
- cerr << "ResourcesManager_cpp: file "<<aFilePath<<" is not readable." << endl;
+#if defined(_DEBUG_) || defined(_DEBUG)
+ cout << "ResourcesManager_cpp: file "<<aFilePath<<" is not readable." << endl;
+#endif
delete handler;