X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=SHUTTLE%2FAliShuttleConfig.cxx;h=c8d4465ddd4e78845858571f2d441e10bfb0b5f3;hb=21267a278a054ab8f31acd074c699775728508c0;hp=d62135105601f1f33510a52d1684c82e0db48605;hpb=7d4cf768bf34685fa08bc46abc5a794a406f74a3;p=u%2Fmrichter%2FAliRoot.git diff --git a/SHUTTLE/AliShuttleConfig.cxx b/SHUTTLE/AliShuttleConfig.cxx index d6213510560..c8d4465ddd4 100644 --- a/SHUTTLE/AliShuttleConfig.cxx +++ b/SHUTTLE/AliShuttleConfig.cxx @@ -15,6 +15,24 @@ /* $Log$ +Revision 1.27 2007/12/17 03:23:32 jgrosseo +several bugfixes +added "empty preprocessor" as placeholder for Acorde in FDR + +Revision 1.26 2007/12/07 19:14:36 acolla +in AliShuttleTrigger: + +Added automatic collection of new runs on a regular time basis (settable from the configuration) + +in AliShuttleConfig: new members + +- triggerWait: time to wait for DIM trigger (s) before starting automatic collection of new runs +- mode: run mode (test, prod) -> used to build log folder (logs or logs_PROD) + +in AliShuttle: + +- logs now stored in logs/#RUN/DET_#RUN.log + Revision 1.25 2007/11/26 16:58:37 acolla Monalisa configuration added: host and table name @@ -157,7 +175,7 @@ some docs added // will be retrieved (used by AliShuttle). // - +#include #include "AliShuttleConfig.h" #include "AliShuttleInterface.h" @@ -168,6 +186,7 @@ some docs added #include #include #include +#include AliShuttleConfig::AliShuttleDCSConfigHolder::AliShuttleDCSConfigHolder(const TLDAPEntry* entry): @@ -244,10 +263,9 @@ fIsValid(kFALSE) ExpandAndAdd(fDCSDataPoints, aDataPoint); } } - + fIsValid = kTRUE; } - //______________________________________________________________________________________________ void AliShuttleConfig::AliShuttleDCSConfigHolder::ExpandAndAdd(TObjArray* target, const char* entry) { @@ -509,6 +527,7 @@ ClassImp(AliShuttleConfig) AliShuttleConfig::AliShuttleConfig(const char* host, Int_t port, const char* binddn, const char* password, const char* basedn): fConfigHost(host), + fAlienPath(""), fDAQlbHost(""), fDAQlbPort(), fDAQlbUser(""), @@ -517,19 +536,33 @@ AliShuttleConfig::AliShuttleConfig(const char* host, Int_t port, fDAQlbTable(""), fShuttlelbTable(""), fRunTypelbTable(""), - fMaxRetries(0), + fPasswdFilePath(""), + fTerminateFilePath(""), + fMaxRetries(0), fPPTimeOut(0), + fDCSTimeOut(0), + fDCSRetries(0), + fDCSQueryOffset(0), + fDCSDelay(0), fPPMaxMem(0), fMonitorHost(""), fMonitorTable(""), fTriggerWait(3600), + fShuttleFileSystem("/"), + fFreeDiskWarningThreshold(20), + fFreeDiskFatalThreshold(10), fRunMode(kTest), fDetectorMap(), fDetectorList(), + fAdmin(), fShuttleInstanceHost(""), fProcessedDetectors(), + fKeepDCSMap(kFALSE), + fKeepTempFolder(kFALSE), + fSendMail(kFALSE), fProcessAll(kFALSE), fIsValid(kFALSE) + { // // host: ldap server host @@ -542,6 +575,12 @@ AliShuttleConfig::AliShuttleConfig(const char* host, Int_t port, fDetectorMap.SetOwner(1); fDetectorList.SetOwner(0); //fDetectorList and fDetectorMap share the same object! fProcessedDetectors.SetOwner(); + + for (int i=0; i<6; i++) + { + fAdmin[i] = new TObjArray(); + fAdmin[i]->SetOwner(); + } TLDAPServer aServer(host, port, binddn, password, 3); @@ -611,6 +650,7 @@ AliShuttleConfig::AliShuttleConfig(const char* host, Int_t port, result += SetGlobalConfig(&globalList); result += SetSysConfig(&sysList); + result += SetPasswords(); result += SetDetConfig(&detList,&dcsList); result += SetHostConfig(&hostList); @@ -815,6 +855,18 @@ const TObjArray* AliShuttleConfig::GetResponsibles(const char* detector) const return aHolder->GetResponsibles(); } +//______________________________________________________________________________________________ +const TObjArray* AliShuttleConfig::GetAdmins(Int_t sys) const +{ + // + // returns collection of TObjString which represents the list of mail addresses + // of the system's administrator(s) (DAQ, DCS, HLT, Global, Amanda, DQM) + // + + if (sys < 0 || sys > 5) return 0; + return fAdmin[sys]; +} + //______________________________________________________________________________________________ Bool_t AliShuttleConfig::HostProcessDetector(const char* detector) const { @@ -850,6 +902,7 @@ UInt_t AliShuttleConfig::SetGlobalConfig(TList* list) { // Set the global configuration (DAQ Logbook + preprocessor monitoring settings) + TLDAPEntry* anEntry = 0; TLDAPAttribute* anAttribute = 0; @@ -873,6 +926,13 @@ UInt_t AliShuttleConfig::SetGlobalConfig(TList* list) } + anAttribute = anEntry->GetAttribute("AlienPath"); + if (!anAttribute) { + AliError("Can't find AlienPath attribute!"); + return 4; + } + fAlienPath = anAttribute->GetValue(); + anAttribute = anEntry->GetAttribute("daqLbHost"); if (!anAttribute) { AliError("Can't find daqLbHost attribute!"); @@ -895,13 +955,6 @@ UInt_t AliShuttleConfig::SetGlobalConfig(TList* list) } fDAQlbUser = anAttribute->GetValue(); - anAttribute = anEntry->GetAttribute("daqLbPasswd"); - if (!anAttribute) { - AliError("Can't find daqLbPasswd attribute!"); - return 4; - } - fDAQlbPass = anAttribute->GetValue(); - anAttribute = anEntry->GetAttribute("daqLbDB"); if (!anAttribute) { AliError("Can't find daqLbDB attribute!"); @@ -938,6 +991,11 @@ UInt_t AliShuttleConfig::SetGlobalConfig(TList* list) TString tmpStr = anAttribute->GetValue(); fMaxRetries = tmpStr.Atoi(); + anAttribute = anEntry->GetAttribute("terminateFilePath"); + if (anAttribute) { + fTerminateFilePath = anAttribute->GetValue(); + } + anAttribute = anEntry->GetAttribute("ppTimeOut"); if (!anAttribute) { AliError("Can't find ppTimeOut attribute!"); @@ -946,6 +1004,38 @@ UInt_t AliShuttleConfig::SetGlobalConfig(TList* list) tmpStr = anAttribute->GetValue(); fPPTimeOut = tmpStr.Atoi(); + anAttribute = anEntry->GetAttribute("dcsTimeOut"); + if (!anAttribute) { + AliError("Can't find dcsTimeOut attribute!"); + return 4; + } + tmpStr = anAttribute->GetValue(); + fDCSTimeOut = tmpStr.Atoi(); + + anAttribute = anEntry->GetAttribute("nDCSretries"); + if (!anAttribute) { + AliError("Can't find dcsTimeOut attribute!"); + return 4; + } + tmpStr = anAttribute->GetValue(); + fDCSRetries = tmpStr.Atoi(); + + anAttribute = anEntry->GetAttribute("DCSQueryOffset"); + if (!anAttribute) { + AliError("Can't find DCSQueryOffset attribute!"); + return 4; + } + tmpStr = anAttribute->GetValue(); + fDCSQueryOffset = tmpStr.Atoi(); + + anAttribute = anEntry->GetAttribute("DCSDelay"); + if (!anAttribute) { + AliError("Can't find DCSDelay attribute!"); + return 4; + } + tmpStr = anAttribute->GetValue(); + fDCSDelay = tmpStr.Atoi(); + anAttribute = anEntry->GetAttribute("ppMaxMem"); if (!anAttribute) { AliError("Can't find ppMaxMem attribute!"); @@ -970,47 +1060,147 @@ UInt_t AliShuttleConfig::SetGlobalConfig(TList* list) anAttribute = anEntry->GetAttribute("triggerWait"); // MAY if (!anAttribute) { - AliWarning(Form("triggerWait not set! default = ", fTriggerWait)); + AliWarning(Form("triggerWait not set! default = %d", fTriggerWait)); } tmpStr = anAttribute->GetValue(); fTriggerWait = tmpStr.Atoi(); - + + anAttribute = anEntry->GetAttribute("ShuttleFileSystem"); + if (!anAttribute) { + AliWarning(Form("ShuttleFileSystem not set! default = %s", fShuttleFileSystem.Data())); + } + fShuttleFileSystem = anAttribute->GetValue(); + + anAttribute = anEntry->GetAttribute("FreeDiskWarningThreshold"); // MAY + if (!anAttribute) { + AliWarning(Form("FreeDiskWarningThreshold not set! default = %d", fFreeDiskWarningThreshold)); + } + tmpStr = anAttribute->GetValue(); + fFreeDiskWarningThreshold = tmpStr.Atoi(); + + anAttribute = anEntry->GetAttribute("FreeDiskFatalThreshold"); // MAY + if (!anAttribute) { + AliWarning(Form("FreeDiskFatalThreshold not set! default = %d", fFreeDiskFatalThreshold)); + } + tmpStr = anAttribute->GetValue(); + fFreeDiskFatalThreshold = tmpStr.Atoi(); + anAttribute = anEntry->GetAttribute("mode"); if (!anAttribute) { AliWarning("Run mode not set! Running in test mode."); + } else { + tmpStr = anAttribute->GetValue(); + if (tmpStr == "test") + { + fRunMode = kTest; + } else if (tmpStr == "prod") { + fRunMode = kProd; + } else { + AliWarning(Form("Not a valid run mode: %s", tmpStr.Data())); + AliWarning("Valid run modes are \"test\" and \"prod\". Running in test mode."); + } } - tmpStr = anAttribute->GetValue(); - if (tmpStr == "test") + + anAttribute = anEntry->GetAttribute("keepDCSMap"); // MAY + if (!anAttribute) { - fRunMode = kTest; - } else if (tmpStr == "prod") { - fRunMode = kProd; - } else { - AliWarning(Form("Not a valid run mode: %s", tmpStr.Data())); - AliWarning("Valid run modes are \"test\" and \"prod\". Running in test mode."); + AliWarning("keepDCSMap flag not set - default is FALSE"); + } else { + TString keepDCSMapStr = anAttribute->GetValue(); + if (!(keepDCSMapStr == "0" || keepDCSMapStr == "1")) + { + AliError("keepDCSMap flag must be 0 or 1!"); + return 4; + } + fKeepDCSMap = (Bool_t) keepDCSMapStr.Atoi(); + } + + anAttribute = anEntry->GetAttribute("keepTempFolder"); // MAY + if (!anAttribute) + { + AliWarning("keepTempFolder flag not set - default is FALSE"); + } else { + TString keepTempFolderStr = anAttribute->GetValue(); + if (!(keepTempFolderStr == "0" || keepTempFolderStr == "1")) + { + AliError("keepTempFolder flag must be 0 or 1!"); + return 4; + } + fKeepTempFolder = (Bool_t) keepTempFolderStr.Atoi(); } - - return 0; + + anAttribute = anEntry->GetAttribute("shuttleAdmin"); // MAY + if (!anAttribute) + { + AliDebug(2, "Warning! No \"shuttleAdmin\" attribute!"); + } + else + { + const char* anAdmin; + while ((anAdmin = anAttribute->GetValue())) + { + fAdmin[kGlobal]->AddLast(new TObjString(anAdmin)); + } + } + + anAttribute = anEntry->GetAttribute("amandaAdmin"); // MAY + if (!anAttribute) + { + AliDebug(2, "Warning! No \"amandaAdmin\" attribute!"); + } + else + { + const char* anAdmin; + while ((anAdmin = anAttribute->GetValue())) + { + fAdmin[kAmanda]->AddLast(new TObjString(anAdmin)); + } + } + anAttribute = anEntry->GetAttribute("sendMail"); // MAY + if (!anAttribute) + { + AliWarning("sendMail flag not set - default is FALSE"); + } else { + TString sendMailStr = anAttribute->GetValue(); + if (!(sendMailStr == "0" || sendMailStr == "1")) + { + AliError("sendMail flag must be 0 or 1!"); + return 4; + } + fSendMail = (Bool_t) sendMailStr.Atoi(); + } + + anAttribute = anEntry->GetAttribute("passwdFilePath"); + if (!anAttribute) { + AliError("Can't find Passwords File Path attribute!"); + return 4; + } + fPasswdFilePath = anAttribute->GetValue(); + + return 0; } //______________________________________________________________________________________________ UInt_t AliShuttleConfig::SetSysConfig(TList* list) { - // Set the online FXS configuration (DAQ + DCS + HLT) - + // Set the online FXS configuration (DAQ + DCS + HLT + DQM) + + TLDAPEntry* anEntry = 0; TLDAPAttribute* anAttribute = 0; - if (list->GetEntries() != 3) + if (list->GetEntries() != 4) { AliError(Form("Wrong number of online systems found: %d !", list->GetEntries())); return 1; } TIter iter(list); - Int_t iSys=0, count = 0; + Int_t count = 0; + SystemCode iSys=kDAQ; + while ((anEntry = dynamic_cast (iter.Next()))) { anAttribute = anEntry->GetAttribute("system"); @@ -1018,19 +1208,24 @@ UInt_t AliShuttleConfig::SetSysConfig(TList* list) if (sysName == "DAQ") { - iSys = 0; + iSys = kDAQ; count += 1; } else if (sysName == "DCS") { - iSys = 1; + iSys = kDCS; count += 10; } else if (sysName == "HLT") { - iSys = 2; + iSys = kHLT; count += 100; } + else if (sysName == "DQM") + { + iSys = kDQM; + count += 1000; + } anAttribute = anEntry->GetAttribute("dbHost"); if (!anAttribute) { @@ -1056,14 +1251,6 @@ UInt_t AliShuttleConfig::SetSysConfig(TList* list) } fFXSdbUser[iSys] = anAttribute->GetValue(); - anAttribute = anEntry->GetAttribute("dbPasswd"); - if (!anAttribute) { - AliError(Form ("Can't find dbPasswd attribute for %s!!", - AliShuttleInterface::GetSystemName(iSys))); - return 5; - } - fFXSdbPass[iSys] = anAttribute->GetValue(); - anAttribute = anEntry->GetAttribute("dbName"); if (!anAttribute) { AliError(Form ("Can't find dbName attribute for %s!!", @@ -1106,9 +1293,27 @@ UInt_t AliShuttleConfig::SetSysConfig(TList* list) anAttribute = anEntry->GetAttribute("fxsPasswd"); if (anAttribute) fFXSPass[iSys] = anAttribute->GetValue(); + + anAttribute = anEntry->GetAttribute("fxsBaseFolder"); + if (anAttribute) fFXSBaseFolder[iSys] = anAttribute->GetValue(); + + anAttribute = anEntry->GetAttribute("fxsAdmin"); // MAY + if (!anAttribute) + { + AliDebug(2, "Warning! No \"fxsAdmin\" attribute!"); + } + else + { + const char* anAdmin; + while ((anAdmin = anAttribute->GetValue())) + { + fAdmin[iSys]->AddLast(new TObjString(anAdmin)); + } + } + } - if(count != 111) { + if(count != 1111) { AliError(Form("Wrong system configuration! (code = %d)", count)); return 6; } @@ -1116,6 +1321,72 @@ UInt_t AliShuttleConfig::SetSysConfig(TList* list) return 0; } +//______________________________________________________________________________________________ +UInt_t AliShuttleConfig::SetPasswords(){ + + AliInfo("Setting Passwords"); + + // Retrieving Passwords for DAQ lb, DAQ/DCS/HLT/DQM FXS + + ifstream *inputfile = new ifstream(fPasswdFilePath.Data()); + if (!*inputfile) { + AliError(Form("Error opening file %s !", fPasswdFilePath.Data())); + inputfile->close(); + delete inputfile; + return 1; + } + + TString line; + Int_t nPwd=0; + Int_t nPwdFake=0; + while (line.ReadLine(*inputfile)) { + TObjArray *tokens = line.Tokenize(" \t"); + TString system = ((TObjString *)tokens->At(0))->String(); + TString password = ((TObjString *)tokens->At(1))->String(); + delete tokens; + if (system.Contains("DAQ_LB")){ + fDAQlbPass=password; + nPwd++; + AliDebug(3,Form("DAQ_LB: Password %s for %s found", password.Data(), system.Data())); + } + else if (system.Contains("DAQ_DB")){ + fFXSdbPass[0]=password; + nPwd++; + AliDebug(3,Form("DAQ_DB: Password %s for %s found", password.Data(), system.Data())); + } + else if (system.Contains("DCS_DB")){ + fFXSdbPass[1]=password; + nPwd++; + AliDebug(3,Form("DCS_DB: Password %s for %s found", password.Data(), system.Data())); + } + else if (system.Contains("HLT_DB")){ + fFXSdbPass[2]=password; + nPwd++; + AliDebug(3,Form("HLT_DB: Password %s for %s found", password.Data(), system.Data())); + } + else if (system.Contains("DQM_DB")){ + fFXSdbPass[3]=password; + nPwd++; + AliDebug(3,Form("DQM_DB: Password %s for %s found", password.Data(), system.Data())); + } + else { + nPwdFake++; + AliDebug(3,Form("%i fake line(s) found in file %s", nPwdFake, fPasswdFilePath.Data())); + continue; + } + } + + inputfile->close(); + delete inputfile; + + if (nPwd!=5){ + AliError(Form("Wrong file for DAQ Logbook password found %s (some passwors missing), please Check!", fPasswdFilePath.Data())); + return 2; + } + + return 0; + +} //______________________________________________________________________________________________ UInt_t AliShuttleConfig::SetDetConfig(TList* detList, TList* dcsList) { @@ -1229,33 +1500,69 @@ void AliShuttleConfig::Print(Option_t* option) const result += "\n"; } - result += Form("PP time out = %d - max PP mem size = %d KB - max retries = %d " - "- DIM trigger waiting timeout = %d\n\n", - fPPTimeOut, fPPMaxMem, fMaxRetries, fTriggerWait); + result += Form("PP time out = %d - DCS time out = %d - max PP mem size = %d KB - max retries = %d " + "- DIM trigger waiting timeout = %d\n", + fPPTimeOut, fDCSTimeOut, fPPMaxMem, fMaxRetries, fTriggerWait); + result += Form("FLAGS: keepDCSMap = %d - keepTempFolder = %d - SendMail = %d \n", + fKeepDCSMap, fKeepTempFolder, fSendMail); + const TObjArray* shuttleAdmins = GetAdmins(kGlobal); + if (shuttleAdmins->GetEntries() != 0) + { + result += "SHUTTLE administrator(s): "; + TIter it(shuttleAdmins); + TObjString* anAdmin; + while ((anAdmin = (TObjString*) it.Next())) + { + result += Form("%s ", anAdmin->String().Data()); + } + result += "\n"; + } + const TObjArray* amandaAdmins = GetAdmins(kAmanda); + if (amandaAdmins->GetEntries() != 0) + { + result += "Amanda server administrator(s): "; + TIter it(amandaAdmins); + TObjString* anAdmin; + while ((anAdmin = (TObjString*) it.Next())) + { + result += Form("%s ", anAdmin->String().Data()); + } + result += "\n\n"; + } result += "------------------------------------------------------\n"; result += Form("Logbook Configuration \n\n \tHost: %s:%d; \tUser: %s; ", fDAQlbHost.Data(), fDAQlbPort, fDAQlbUser.Data()); -// result += "Password: "; -// result.Append('*', fDAQlbPass.Length()); result += Form("\tDB: %s; \tTables: %s, %s, %s\n", fDAQlbDB.Data(), fDAQlbTable.Data(), fShuttlelbTable.Data(), fRunTypelbTable.Data()); - result += "\n\n"; + result += Form("Terminate file path: %s\n", fTerminateFilePath.Data()); + result += "\n\n"; + result += "------------------------------------------------------\n"; result += "FXS configuration\n\n"; - for(int iSys=0;iSys<3;iSys++){ + for(int iSys=0;iSys<4;iSys++){ result += Form("*** %s ***\n", AliShuttleInterface::GetSystemName(iSys)); result += Form("\tDB host: %s:%d; \tUser: %s; \tName: %s; \tTable: %s\n", fFXSdbHost[iSys].Data(), fFXSdbPort[iSys], fFXSdbUser[iSys].Data(), fFXSdbName[iSys].Data(), fFXSdbTable[iSys].Data()); - // result += Form("DB Password:",fFXSdbPass[iSys].Data()); - result += Form("\tFXS host: %s:%d; \tUser: %s\n\n", fFXSHost[iSys].Data(), fFXSPort[iSys], + result += Form("\tFXS host: %s:%d; \tUser: %s\n", fFXSHost[iSys].Data(), fFXSPort[iSys], fFXSUser[iSys].Data()); - // result += Form("FXS Password:",fFXSPass[iSys].Data()); + const TObjArray* fxsAdmins = GetAdmins(iSys); + if (fxsAdmins->GetEntries() != 0) + { + result += "\tAdministrator(s): "; + TIter it(fxsAdmins); + TObjString* anAdmin; + while ((anAdmin = (TObjString*) it.Next())) + { + result += Form("%s ", anAdmin->String().Data()); + } + result += "\n\n"; + } } result += "------------------------------------------------------\n"; @@ -1265,7 +1572,7 @@ void AliShuttleConfig::Print(Option_t* option) const fMonitorHost.Data(), fMonitorTable.Data()); result += "\n\n"; - + TString optStr(option); result += "------------------------------------------------------\n";