#include "BatchManager.hxx"
#include "Utils.hxx"
#include "NotYetImplementedException.hxx"
+#include "Log.hxx"
using namespace std;
bool timeoutReached = (testTimeout && time >= timeout);
JobInfo jinfo = jobid.queryJob();
string state = jinfo.getParametre()[STATE].str();
- cout << "State is \"" << state << "\"";
while (!timeoutReached && state != FINISHED && state != FAILED) {
- cout << ", sleeping " << sleeptime << "s..." << endl;
+ LOG("State is \"" << state << "\"" << ", sleeping " << sleeptime << "s...");
Utils::sleep(sleeptime);
time += sleeptime;
timeoutReached = (testTimeout && time >= timeout);
sleeptime = maxSleepTime;
jinfo = jobid.queryJob();
state = jinfo.getParametre()[STATE].str();
- cout << "State is \"" << state << "\"";
}
- cout << endl;
+ LOG("State is \"" << state << "\"");
return state;
}
string subCommand = string("chmod u+x ") + remoteExec;
string command = _protocol.getExecCommand(subCommand, _hostname, _username);
- cerr << command.c_str() << endl;
+ LOG(command);
status = system(command.c_str());
if (status) {
std::ostringstream oss;
// Create local result directory
int status = CommunicationProtocol::getInstance(SH).makeDirectory(directory, "", "");
- if (status) {
- string mess("Directory creation failed. Status is :");
- ostringstream status_str;
- status_str << status;
- mess += status_str.str();
- cerr << mess << endl;
- }
+ if (status)
+ LOG("Directory creation failed. Status is: " << status);
for(Vit=V.begin(); Vit!=V.end(); Vit++) {
CoupleType cpt = *static_cast< CoupleType * >(*Vit);
}
status = _protocol.copyFile(remotePath, _hostname, _username,
localPath, "", "");
- if (status) {
- // Try to get what we can (logs files)
- // throw BatchException("Error of connection on remote host");
- std::string mess("Copy command failed ! status is :");
- ostringstream status_str;
- status_str << status;
- mess += status_str.str();
- cerr << mess << endl;
- }
+ if (status)
+ LOG("Copy command failed. Status is: " << status);
}
// Copy logs
status = _protocol.copyFile(string(params[WORKDIR]) + string("/logs"), _hostname, _username,
directory, "", "");
- if (status) {
- std::string mess("Copy logs directory failed ! status is :");
- ostringstream status_str;
- status_str << status;
- mess += status_str.str();
- cerr << mess << endl;
- }
-
+ if (status)
+ LOG("Copy logs directory failed. Status is: " << status);
}
bool BatchManager::importDumpStateFile( const Job & job, const string directory )
// Create local result directory
int status = CommunicationProtocol::getInstance(SH).makeDirectory(directory, "", "");
- if (status) {
- string mess("Directory creation failed. Status is :");
- ostringstream status_str;
- status_str << status;
- mess += status_str.str();
- cerr << mess << endl;
- }
+ if (status)
+ LOG("Directory creation failed. Status is: " << status);
bool ret = true;
status = _protocol.copyFile(string(params[WORKDIR]) + string("/dumpState*.xml"), _hostname, _username,
directory, "", "");
if (status) {
- // Try to get what we can (logs files)
- // throw BatchException("Error of connection on remote host");
- std::string mess("Copy command failed ! status is :");
- ostringstream status_str;
- status_str << status;
- mess += status_str.str();
- cerr << mess << endl;
+ LOG("Copy command failed. Status is: " << status);
ret = false;
}
return ret;