/*
$Log$
+Revision 1.26 2007/01/23 19:20:03 acolla
+Removed old ldif files, added TOF, MCH ldif files. Added some options in
+AliShuttleConfig::Print. Added in Ali Shuttle: SetShuttleTempDir and
+SetShuttleLogDir
+
Revision 1.25 2007/01/15 19:13:52 acolla
Moved some AliInfo to AliDebug in SendMail function
#include <TSQLRow.h>
#include <TMutex.h>
+#include <TMonaLisaWriter.h>
+
#include <fstream>
#include <sys/types.h>
fGridError(kFALSE),
fMonitoringMutex(0),
fLastActionTime(0),
-fLastAction()
+fLastAction(),
+fMonaLisa(0)
{
//
// config: AliShuttleConfig used
AliError(Form("WriteShuttleStatus for %s, run %d failed", fCurrentDetector.Data(), run));
return kFALSE;
}
+
+ SendMLInfo();
return kTRUE;
}
if (increaseCount) status->IncreaseCount();
AliCDBManager::Instance()->GetStorage(fgkLocalCDB)->Put(fStatusEntry);
+
+ SendMLInfo();
+}
+
+//______________________________________________________________________________________________
+void AliShuttle::SendMLInfo()
+{
+ //
+ // sends ML information about the current status of the current detector being processed
+ //
+
+ AliShuttleStatus* status = dynamic_cast<AliShuttleStatus*> (fStatusEntry->GetObject());
+
+ if (!status){
+ AliError("UNEXPECTED: status could not be read from current CDB entry");
+ return;
+ }
+
+ TMonaLisaText mlStatus(Form("%s_status", fCurrentDetector.Data()), status->GetStatusName());
+ TMonaLisaValue mlRetryCount(Form("%s_count", fCurrentDetector.Data()), status->GetCount());
+
+ TList mlList;
+ mlList.Add(&mlStatus);
+ mlList.Add(&mlRetryCount);
+
+ fMonaLisa->SendParameters(&mlList);
}
+
//______________________________________________________________________________________________
Bool_t AliShuttle::ContinueProcessing()
{
Log("SHUTTLE",
Form("ContinueProcessing - %s: Grid storage failed again",
fCurrentDetector.Data()));
+ // trigger ML information manually because we do not had a status change
+ SendMLInfo();
}
return kFALSE;
}
"Updating Shuttle Logbook", fCurrentDetector.Data(),
status->GetCount(), status->GetStatusName()));
UpdateShuttleLogbook(fCurrentDetector.Data(), "FAILED");
+ UpdateShuttleStatus(AliShuttleStatus::kFailed);
} else {
Log("SHUTTLE", Form("ContinueProcessing - %s: restarting. "
"Aborted before with %s. Retry number %d.", fCurrentDetector.Data(),
fLogbookEntry = entry;
- if(fLogbookEntry->IsDone()){
+ if (fLogbookEntry->IsDone())
+ {
Log("SHUTTLE","Process - Shuttle is already DONE. Updating logbook");
UpdateShuttleLogbook("shuttle_done");
fLogbookEntry = 0;
return kTRUE;
}
+ // create ML instance that monitors this run
+ fMonaLisa = new TMonaLisaWriter(Form("%d", GetCurrentRun()), "SHUTTLE", "aliendb1.cern.ch");
+ // disable monitoring of other parameters that come e.g. from TFile
+ gMonitoringWriter = 0;
AliInfo(Form("\n\n \t\t\t^*^*^*^*^*^*^*^*^*^*^*^* run %d: START ^*^*^*^*^*^*^*^*^*^*^*^* \n",
GetCurrentRun()));
+
+ // Send the information to ML
+ TMonaLisaText mlStatus("SHUTTLE_status", "Processing");
+
+ TList mlList;
+ mlList.Add(&mlStatus);
+
+ fMonaLisa->SendParameters(&mlList);
+
fLogbookEntry->Print("all");
// Initialization
AliInfo(Form("\n\n \t\t\t****** run %d - %s: START ******",
GetCurrentRun(), aDetector->GetName()));
+ Log(fCurrentDetector.Data(), "Starting processing");
Int_t pid = fork();
}
}
+ // remove ML instance
+ delete fMonaLisa;
+ fMonaLisa = 0;
+
fLogbookEntry = 0;
return hasError == kFALSE;
//______________________________________________________________________________________________
Bool_t AliShuttle::UpdateShuttleLogbook(const char* detector, const char* status)
{
-// Update Shuttle logbook filling detector or shuttle_done column
-// ex. of usage: UpdateShuttleLogbook("PHOS", "DONE") or UpdateShuttleLogbook("shuttle_done")
+ //
+ // Update Shuttle logbook filling detector or shuttle_done column
+ // ex. of usage: UpdateShuttleLogbook("PHOS", "DONE") or UpdateShuttleLogbook("shuttle_done")
+ //
// check connection, in case connect
if(!Connect(3)){
TString detName(detector);
TString setClause;
- if(detName == "shuttle_done") {
+ if(detName == "shuttle_done")
+ {
setClause = "set shuttle_done=1";
+
+ // Send the information to ML
+ TMonaLisaText mlStatus("SHUTTLE_status", "Done");
+
+ TList mlList;
+ mlList.Add(&mlStatus);
+
+ fMonaLisa->SendParameters(&mlList);
} else {
TString statusStr(status);
if(statusStr.Contains("done", TString::kIgnoreCase) ||
}
TString toLog = Form("%s (%d): %s - ", TTimeStamp(time(0)).AsString("s"), getpid(), detector);
- if(GetCurrentRun()>=0 ) toLog += Form("run %d - ", GetCurrentRun());
+ if (GetCurrentRun() >= 0)
+ toLog += Form("run %d - ", GetCurrentRun());
toLog += Form("%s", message);
AliInfo(toLog.Data());
TString fileName;
- fileName.Form("%s/%s.log", GetShuttleLogDir(), detector);
+ if (GetCurrentRun() >= 0)
+ fileName.Form("%s/%s_%d.log", GetShuttleLogDir(), detector, GetCurrentRun());
+ else
+ fileName.Form("%s/%s.log", GetShuttleLogDir(), detector);
+
gSystem->ExpandPathName(fileName);
ofstream logFile;