//
// returns 0 if fail, 1 otherwise
+
if (fTestMode & kErrorStorage)
{
Log(fCurrentDetector, "StoreLocally - In TESTMODE - Simulating error while storing locally");
if (!(AliCDBManager::Instance()->GetStorage(localUri))) {
Log("SHUTTLE", Form("StoreLocally - Cannot activate local %s storage", cdbType));
} else {
+ Int_t logLevel = AliLog::GetGlobalLogLevel();
+ AliLog::SetGlobalLogLevel(AliLog::kError);
result = AliCDBManager::Instance()->GetStorage(localUri)
->Put(object, id, metaData);
+ AliLog::SetGlobalLogLevel((AliLog::EType_t)logLevel);
}
if(!result) {
Log(fCurrentDetector, Form("StoreLocally - Can't store object <%s>!", id.ToString().Data()));
}
+
return result;
}
//
TString offDetStr(GetOfflineDetName(detector));
- TString dir;
+ static TString dir;
if (offDetStr == "ITS" || offDetStr == "MUON" || offDetStr == "PHOS")
{
dir.Form("%s/%s/%s", base, offDetStr.Data(), detector);
}
return dir.Data();
-
-
}
//______________________________________________________________________________________________
fStatusEntry = new AliCDBEntry(status, id, new AliCDBMetaData);
fStatusEntry->SetOwner(1);
+ Int_t logLevel = AliLog::GetGlobalLogLevel();
+ AliLog::SetGlobalLogLevel(AliLog::kError);
+
UInt_t result = AliCDBManager::Instance()->GetStorage(fgkLocalCDB)->Put(fStatusEntry);
- if (!result) {
+ AliLog::SetGlobalLogLevel((AliLog::EType_t)logLevel);
+
+ if (!result) {
Log("SHUTTLE", Form("WriteShuttleStatus - Failed for %s, run %d",
fCurrentDetector.Data(), run));
return kFALSE;
status->SetStatus(newStatus);
if (increaseCount) status->IncreaseCount();
+ Int_t logLevel = AliLog::GetGlobalLogLevel();
+ AliLog::SetGlobalLogLevel(AliLog::kError);
+
AliCDBManager::Instance()->GetStorage(fgkLocalCDB)->Put(fStatusEntry);
+ AliLog::SetGlobalLogLevel((AliLog::EType_t)logLevel);
+
SendMLDetInfo();
}
// Send mail to detector expert!
Log("SHUTTLE", Form("ContinueProcessing - Sending mail to %s expert...",
fCurrentDetector.Data()));
+ // det experts in to
+ TString to="";
+ TIter *iterExperts = 0;
+ iterExperts = new TIter(fConfig->GetResponsibles(fCurrentDetector));
+ TObjString *anExpert=0;
+ while ((anExpert = (TObjString*) iterExperts->Next()))
+ {
+ to += Form("%s, \n", anExpert->GetName());
+ }
+ delete iterExperts;
+
+ if (to.Length() > 0)
+ to.Remove(to.Length()-3);
+ AliDebug(2, Form("to: %s",to.Data()));
+
+ if (to.IsNull()) {
+ Log("SHUTTLE", Form("List of %s responsibles not set!", fCurrentDetector.Data()));
+ return kFALSE;
+ }
+
+ Log(fCurrentDetector.Data(), Form("ContinueProcessing - Sending mail to %s expert(s):",
+ fCurrentDetector.Data()));
+ Log(fCurrentDetector.Data(), Form("\n%s", to.Data()));
if (!SendMail(kPPEMail))
Log("SHUTTLE", Form("ContinueProcessing - Could not send mail to %s expert",
fCurrentDetector.Data()));
}
// TODO Check field count!
- const UInt_t nCols = 25;
+ const UInt_t nCols = 26;
if (aResult->GetFieldCount() != (Int_t) nCols) {
Log("SHUTTLE", "Invalid SQL result field number!");
delete aResult;
return NULL;
}
- TString sourceName = 0;
+ TString sourceName = "";
if (system == kDAQ)
{
sourceName = "DAQsource";
return NULL;
}
- TString sourceName = 0;
+ TString sourceName = "";
if (system == kDAQ)
{
sourceName = "DAQsource";
//
// check connection: if already connected return
+
if(fServer[system] && fServer[system]->IsConnected()) {
- // ping the server --> automatic reconnection should occur if it was broken but the
- // server is still alive
- fServer[system]->Ping();
- return kTRUE;
+ // ping the server
+ if (fServer[system]->PingVerify()==kTRUE){ // connection is still alive
+ return kTRUE;
+ }
+ else{
+ AliWarning(Form("Connection got lost to FXS database for %s. Closing and reconnecting.",
+ AliShuttleInterface::GetSystemName(system)));
+ fServer[system]->Close();
+ delete fServer[system];
+ fServer[system] = 0x0;
+ }
}
TString dbHost, dbUser, dbPass, dbName;
if (detName == "ALL") whereClause = Form("where run=%d and time_processed IS NULL;",GetCurrentRun());
else whereClause = Form("where run=%d and detector=\"%s\" and time_processed IS NULL;",GetCurrentRun(), detector);
- Log("SHUTTLE",Form(" whereClause = %s ",whereClause.Data()));
+ //Log("SHUTTLE",Form(" whereClause = %s ",whereClause.Data()));
TString sqlQuery = Form("update %s set time_processed=%d %s", fConfig->GetFXSdbTable(system),
now.GetSec(), whereClause.Data());
return fLogbookEntry ? fLogbookEntry->GetEndTime() : 0;
}
-//______________________________________________________________________________________________
-UInt_t AliShuttle::GetCurrentTimeCreated() const
-{
- //
- // get current end time from logbook entry
- //
-
- return fLogbookEntry ? fLogbookEntry->GetTimeCreated() : 0;
-}
-
//______________________________________________________________________________________________
UInt_t AliShuttle::GetCurrentYear() const
{
body = Form("Dear %s FXS experts, \n\n",sys.Data());
body += Form("SHUTTLE couldn\'t retrieve data from the FXS for detector %s "
"in run %d!!\n\n", fCurrentDetector.Data(), GetCurrentRun());
+ body += Form("The contacted server was:\nDB: %s\nFXS:%s\n\n", fConfig->GetFXSdbHost(system), fConfig->GetFXSHost(system));
}
else {
subject = Form("%s %s Shuttle preprocessor FAILED in run %d (run type = %s)!",
body += Form("Find the %s log for the current run on \n\n"
- "\thttp://pcalishuttle01.cern.ch:8880/%s/%d/%d/%s.log \n\n",
+ "\thttp://pcalishuttle02.cern.ch/%s/%d/%d/%s.log \n\n",
fCurrentDetector.Data(), logFolder.Data(), GetCurrentRun()/10000,
GetCurrentRun(), fCurrentDetector.Data());
- body += Form("The last 10 lines of %s log file are following:\n\n", fCurrentDetector.Data());
+ body += Form("The last 15 lines of %s log file are following:\n\n", fCurrentDetector.Data());
AliDebug(2, Form("Body begin: %s", body.Data()));
TString logFileName = Form("%s/%d/%d/%s.log", GetShuttleLogDir(),
GetCurrentRun()/10000, GetCurrentRun(), fCurrentDetector.Data());
- TString tailCommand = Form("tail -n 10 %s >> %s", logFileName.Data(), bodyFileName.Data());
+ TString tailCommand = Form("tail -n 15 %s >> %s", logFileName.Data(), bodyFileName.Data());
if (gSystem->Exec(tailCommand.Data()))
{
mailBody << Form("%s log file not found ...\n\n", fCurrentDetector.Data());
if (result->GetRowCount() == 0)
{
- Log("SHUTTLE", "ERROR: Trigger configuration not found in logbook_trigger_config");
+ Log("SHUTTLE", "WARNING: Trigger configuration not found in logbook_trigger_config");
delete result;
return 0;
}
return triggerConfig;
}
+//______________________________________________________________________________________________
+const char* AliShuttle::GetCTPTimeParams()
+{
+ // Receives the CTP time parameters from the DAQ logbook for the current run
+
+ // check connection, if needed reconnect
+ if (!Connect(3))
+ return 0;
+
+ TString sqlQuery;
+ sqlQuery.Form("SELECT alignmentFile FROM logbook_trigger_config WHERE run = %d", GetCurrentRun());
+ TSQLResult* result = fServer[3]->Query(sqlQuery);
+ if (!result)
+ {
+ Log("SHUTTLE", Form("ERROR: Can't execute query <%s>!", sqlQuery.Data()));
+ return 0;
+ }
+
+ if (result->GetRowCount() == 0)
+ {
+ Log("SHUTTLE", "WARNING: CTP time params not found in logbook_trigger_config");
+ delete result;
+ return 0;
+ }
+
+ TSQLRow* row = result->Next();
+ if (!row)
+ {
+ Log("SHUTTLE", "ERROR: Could not receive logbook_trigger_config data");
+ delete result;
+ return 0;
+ }
+
+ // static, so that pointer remains valid when it is returned to the calling class
+ static TString triggerTimeParams(row->GetField(0));
+
+ delete row;
+ row = 0;
+
+ delete result;
+ result = 0;
+
+ Log("SHUTTLE", Form("Found trigger time parameters: %s", triggerTimeParams.Data()));
+
+ return triggerTimeParams;
+}
+
+//______________________________________________________________________________________________
+const char* AliShuttle::GetTriggerDetectorMask()
+{
+ // Receives the trigger detector mask from DAQ logbook
+
+ // check connection, if needed reconnect
+ if (!Connect(3))
+ return 0;
+
+ TString sqlQuery;
+ sqlQuery.Form("SELECT BIN(BIT_OR(inputDetectorMask)) from logbook_trigger_clusters WHERE run = %d;", GetCurrentRun());
+ TSQLResult* result = fServer[3]->Query(sqlQuery);
+ if (!result)
+ {
+ Log("SHUTTLE", Form("ERROR: Can't execute query <%s>!", sqlQuery.Data()));
+ return 0;
+ }
+
+ if (result->GetRowCount() == 0)
+ {
+ Log("SHUTTLE", "ERROR: Trigger Detector Mask not found in logbook_trigger_clusters");
+ delete result;
+ return 0;
+ }
+
+ TSQLRow* row = result->Next();
+ if (!row)
+ {
+ Log("SHUTTLE", "ERROR: Could not receive logbook_trigger_clusters data");
+ delete result;
+ return 0;
+ }
+
+ // static, so that pointer remains valid when it is returned to the calling class
+ static TString triggerDetectorMask(row->GetField(0));
+
+ delete row;
+ row = 0;
+
+ delete result;
+ result = 0;
+
+ Log("SHUTTLE", Form("Found Trigger Detector Mask: %s", triggerDetectorMask.Data()));
+
+ return triggerDetectorMask;
+}
+
//______________________________________________________________________________________________
void AliShuttle::SetShuttleTempDir(const char* tmpDir)
{
return kFALSE;
}
TObjString *valueLsPath = dynamic_cast<TObjString*>(mapLs->GetValue("path"));
- if (!valueLsPath || (TString)(valueLsPath->GetString()).CompareTo(dir)!=1){
+ if (!valueLsPath || (valueLsPath->GetString()).CompareTo(dir)!=1){
Log("SHUTTLE",Form("No directory %s found, creating it",dir.Data()));
// creating the directory
//
// The call is delegated to AliShuttleInterface
- return GetCurrentTimeCreated()-fConfig->GetDCSQueryOffset();
+ return GetCurrentStartTime()-fConfig->GetDCSQueryOffset();
}
//______________________________________________________________________________________________
UInt_t AliShuttle::GetEndTimeDCSQuery()