return kFALSE;
}
- SendMLInfo();
+ SendMLDetInfo();
return kTRUE;
}
AliCDBManager::Instance()->GetStorage(fgkLocalCDB)->Put(fStatusEntry);
- SendMLInfo();
+ SendMLDetInfo();
}
//______________________________________________________________________________________________
-void AliShuttle::SendMLInfo()
+void AliShuttle::SendMLDetInfo()
{
//
// sends ML information about the current status of the current detector being processed
AliShuttleStatus* status = dynamic_cast<AliShuttleStatus*> (fStatusEntry->GetObject());
if (!status){
- Log("SHUTTLE", "SendMLInfo - UNEXPECTED: status could not be read from current CDB entry");
+ Log("SHUTTLE", "SendMLDetInfo - UNEXPECTED: status could not be read from current CDB entry");
return;
}
return cont;
}
+//______________________________________________________________________________________________
+void AliShuttle::SendMLRunInfo(const char* status)
+{
+ //
+ // Send information about this run to ML
+
+ TMonaLisaText mlStatus("SHUTTLE_status", status);
+ TString runType(fLogbookEntry->GetRunType());
+ if (strlen(fLogbookEntry->GetRunParameter("log")) > 0){
+
+ runType += "(";
+ runType += fLogbookEntry->GetRunParameter("log");
+ runType += ")";
+ }
+ TMonaLisaText mlRunType("SHUTTLE_runtype", runType);
+
+ TList mlList;
+ mlList.Add(&mlStatus);
+ mlList.Add(&mlRunType);
+
+ TString mlID;
+ mlID.Form("%d", GetCurrentRun());
+ fMonaLisa->SendParameters(&mlList, mlID);
+}
+
//______________________________________________________________________________________________
Bool_t AliShuttle::Process(AliShuttleLogbookEntry* entry)
{
Log("SHUTTLE", Form("\t\t\t^*^*^*^*^*^*^*^*^*^*^*^* run %d: START ^*^*^*^*^*^*^*^*^*^*^*^*",
GetCurrentRun()));
- // Send the information to ML
CountOpenRuns();
- TMonaLisaText mlStatus("SHUTTLE_status", "Processing");
- TString runType(entry->GetRunType());
- if (strlen(entry->GetRunParameter("log")) > 0){
-
- runType += "(";
- runType += entry->GetRunParameter("log");
- runType += ")";
- }
- TMonaLisaText mlRunType("SHUTTLE_runtype", runType);
-
- TList mlList;
- mlList.Add(&mlStatus);
- mlList.Add(&mlRunType);
-
- TString mlID;
- mlID.Form("%d", GetCurrentRun());
- fMonaLisa->SendParameters(&mlList, mlID);
+ // Send the information to ML
+ SendMLRunInfo("Processing");
if (fLogbookEntry->IsDone())
{
fFirstUnprocessed[iDet] = kFALSE;
}
}
- TMonaLisaText mlStatusPending("SHUTTLE_status", "Pending");
- mlList.Clear();
- mlList.Add(&mlStatusPending);
- fMonaLisa->SendParameters(&mlList, mlID);
+ SendMLRunInfo("Pending");
}
}
TString totEventsStr = entry->GetRunParameter("totalEvents");
Int_t totEvents = totEventsStr.Atoi();
- if (startTime != 0 && endTime != 0 && endTime > startTime && totEvents > 0 && ecsSuccess)
- return entry;
-
- if (ecsSuccess == kFALSE)
+ // runs are accepted if they have ecsSuccess set or more than 1 event
+ if (startTime != 0 && endTime != 0 && endTime > startTime && (totEvents > 1 || ecsSuccess))
{
- Log("SHUTTLE", Form("Skipped run %d due to ECS failure, Reason: %s", run, entry->GetRunParameter("eor_reason")));
+ if (ecsSuccess == kFALSE)
+ Log("SHUTTLE", Form("Processing run %d although in status ECS failure, Reason: %s", run, entry->GetRunParameter("eor_reason")));
+ return entry;
}
- else if (totEvents < 1)
+
+ Bool_t skip = kFALSE;
+
+ if (totEvents <= 1)
{
- Log("SHUTTLE", Form("QueryRunParameters - Run %d has 0 events - Skipping!", run));
- }
+ Log("SHUTTLE", Form("QueryRunParameters - Run %d has 1 event or less - Skipping!", run));
+ skip = kTRUE;
+ }
else
{
Log("SHUTTLE", Form("QueryRunParameters - Invalid parameters for Run %d: "
"startTime = %d, endTime = %d. Skipping (Shuttle won't be marked as DONE)!",
run, startTime, endTime));
}
-
- //Log("SHUTTLE", Form("Marking SHUTTLE done for run %d", run));
- //fLogbookEntry = entry;
- //if (!UpdateShuttleLogbook("shuttle_done"))
- //{
- // AliError(Form("Could not update logbook for run %d !", run));
- //}
- //fLogbookEntry = 0;
+
+ if (skip)
+ {
+ Log("SHUTTLE", Form("Marking SHUTTLE skipped for run %d", run));
+ fLogbookEntry = entry;
+ if (!UpdateShuttleLogbook("shuttle_skipped"))
+ {
+ AliError(Form("Could not update logbook for run %d !", run));
+ }
+ fLogbookEntry = 0;
+ }
delete entry;
return 0;
TString detName(detector);
TString setClause;
- if (detName == "shuttle_done" || detName == "shuttle_ignored")
+ if (detName == "shuttle_done" || detName == "shuttle_skipped")
{
setClause = "set shuttle_done=1";
-
+
if (detName == "shuttle_done")
{
- if (TouchFile()==kTRUE){
- //Send the information to ML
- TMonaLisaText mlStatus("SHUTTLE_status", "Done");
-
- TList mlList;
- mlList.Add(&mlStatus);
-
- TString mlID;
- mlID.Form("%d", GetCurrentRun());
- fMonaLisa->SendParameters(&mlList, mlID);
- }
- else{
+ if (TouchFile() != kTRUE)
return kFALSE;
- }
-
+
+ SendMLRunInfo("Done");
}
- } else {
+ else
+ SendMLRunInfo("Skipped");
+ }
+ else {
TString statusStr(status);
if(statusStr.Contains("done", TString::kIgnoreCase) ||
statusStr.Contains("failed", TString::kIgnoreCase)){
{
// query Shuttle logbook for earlier runs, check if some detectors are unprocessed,
// flag them into fFirstUnprocessed array
- TString whereClause(Form("where shuttle_done=0 and run < %d", run));
+ TString whereClauseBis(Form("where shuttle_done=0 and run < %d", run));
TObjArray tmpLogbookEntries;
- if (!QueryShuttleLogbook(whereClause, tmpLogbookEntries))
+ if (!QueryShuttleLogbook(whereClauseBis, tmpLogbookEntries))
{
Log("SHUTTLE", "Collect - Can't retrieve entries from Shuttle logbook");
return kFALSE;
return kTRUE;
}
+ Int_t runMode = (Int_t)fConfig->GetRunMode();
+ TString tmpStr;
+ if (runMode == 0) tmpStr = " Nightly Test:";
+ else tmpStr = " Data Taking:";
void* dir = gSystem->OpenDirectory(GetShuttleLogDir());
if (dir == NULL)
{
TString body;
if (target == kDCSEMail){
- subject = Form("Retrieval of data points for %s FAILED in run %d !",
- fCurrentDetector.Data(), GetCurrentRun());
+ subject = Form("%s Retrieval of data points for %s FAILED in run %d !",
+ tmpStr.Data(), fCurrentDetector.Data(), GetCurrentRun());
AliDebug(2, Form("subject: %s", subject.Data()));
body = Form("Dear DCS experts, \n\n");
"in run %d!!\n\n", fCurrentDetector.Data(), GetCurrentRun());
}
else if (target == kFXSEMail){
- subject = Form("FXS communication for %s FAILED in run %d !",
- fCurrentDetector.Data(), GetCurrentRun());
+ subject = Form("%s FXS communication for %s FAILED in run %d !",
+ tmpStr.Data(), fCurrentDetector.Data(), GetCurrentRun());
AliDebug(2, Form("subject: %s", subject.Data()));
TString sys;
if (system == kDAQ) sys="DAQ";
"in run %d!!\n\n", fCurrentDetector.Data(), GetCurrentRun());
}
else {
- subject = Form("%s Shuttle preprocessor FAILED in run %d (run type = %s)!",
- fCurrentDetector.Data(), GetCurrentRun(), GetRunType());
+ subject = Form("%s %s Shuttle preprocessor FAILED in run %d (run type = %s)!",
+ tmpStr.Data(), fCurrentDetector.Data(), GetCurrentRun(), GetRunType());
AliDebug(2, Form("subject: %s", subject.Data()));
body = Form("Dear %s expert(s), \n\n", fCurrentDetector.Data());
fCurrentDetector.Data());
if (fConfig->GetRunMode() == AliShuttleConfig::kTest)
{
- body += Form("\thttp://pcalimonitor.cern.ch:8889/shuttle.jsp?time=168 \n\n");
+ body += Form("\thttp://pcalimonitor.cern.ch/shuttle.jsp?time=24 \n\n");
} else {
- body += Form("\thttp://pcalimonitor.cern.ch/shuttle.jsp?instance=PROD&time=168 \n\n");
+ body += Form("\thttp://pcalimonitor.cern.ch/shuttle.jsp?instance=PROD&time=24 \n\n");
}
}
// TODO implement when HLTMode is inserted in run logbook
- TString hltMode = fLogbookEntry->GetRunParameter("HLTMode");
+ TString hltMode = fLogbookEntry->GetRunParameter("HLTmode");
TSubString firstChar = hltMode(0,1);
AliDebug(2,Form("First char = %s ",firstChar.Data()));
if (firstChar == "A") {
TMap *mapLs = dynamic_cast<TMap*>(resultLs->At(0));
if (!mapLs){
Log("SHUTTLE",Form("No map for %s command, returning without touching",commandLs.Data()));
+ delete resultLs;
+ resultLs = 0x0;
return kFALSE;
}
TObjString *valueLsPath = dynamic_cast<TObjString*>(mapLs->GetValue("path"));
Bool_t boolMkdir = gGrid->Mkdir(dir.Data());
if (!boolMkdir) {
Log("SHUTTLE",Form("Impossible to create dir %s in alien catalogue for run %i!",dir.Data(),GetCurrentRun()));
+ if (valueLsPath) {
+ delete valueLsPath;
+ valueLsPath = 0x0;
+ }
+ delete mapLs;
+ mapLs = 0x0;
+ delete resultLs;
+ resultLs = 0x0;
return kFALSE;
}
Log("SHUTTLE",Form("Directory %s successfully created in alien catalogue for run %i",dir.Data(),GetCurrentRun()));
Log("SHUTTLE",Form("Directory %s correctly found for run %i",dir.Data(),GetCurrentRun()));
}
+ delete valueLsPath;
+ valueLsPath = 0x0;
+ delete mapLs;
+ mapLs = 0x0;
+ delete resultLs;
+ resultLs = 0x0;
+
TString command;
command.Form("touch %s/%i", dir.Data(), GetCurrentRun());
Log("SHUTTLE", Form("Creating entry in file catalog: %s", command.Data()));
TMap *mapTouch = dynamic_cast<TMap*>(resultTouch->At(0));
if (!mapTouch){
Log("SHUTTLE",Form("No map for touching command, returning without touching for run %i",GetCurrentRun()));
+ delete resultTouch;
+ resultTouch = 0x0;
return kFALSE;
}
TObjString *valueTouch = dynamic_cast<TObjString*>(mapTouch->GetValue("__result__"));
if (!valueTouch){
Log("SHUTTLE",Form("No value for \"__result__\" key set in the map for touching command, returning without touching for run %i",GetCurrentRun()));
+ delete mapTouch;
+ mapTouch = 0x0;
+ delete resultTouch;
+ resultTouch = 0x0;
return kFALSE;
}
if (valueTouch->GetString()!="1"){
Log("SHUTTLE",Form("Failing the touching command, returning without touching for run %i",GetCurrentRun()));
+ delete valueTouch;
+ valueTouch = 0x0;
+ delete mapTouch;
+ mapTouch = 0x0;
+ delete resultTouch;
+ resultTouch = 0x0;
return kFALSE;
}
+ delete valueTouch;
+ valueTouch = 0x0;
+ delete mapTouch;
+ mapTouch = 0x0;
+ delete resultTouch;
+ resultTouch = 0x0;
return kTRUE;
}