From 4f0ab9885f257d215b743887f62be6fe5eea547e Mon Sep 17 00:00:00 2001 From: jgrosseo Date: Tue, 15 Aug 2006 10:50:00 +0000 Subject: [PATCH] effc++ corrections (alberto) --- SHUTTLE/AliDCSClient.cxx | 9 ++++-- SHUTTLE/AliDCSMessage.cxx | 27 ++++++++++++++-- SHUTTLE/AliShuttle.cxx | 58 ++++++++++++++++++++++++++++------- SHUTTLE/AliShuttle.h | 23 +++++++++----- SHUTTLE/AliShuttleConfig.cxx | 10 ++++++ SHUTTLE/AliShuttleStatus.cxx | 11 ++++++- SHUTTLE/AliShuttleTrigger.cxx | 24 ++++++++++++--- SHUTTLE/DATENotifier.cxx | 18 +++++++++-- SHUTTLE/DATENotifier.h | 4 ++- SHUTTLE/Shuttle.C | 28 ++++++++++++----- 10 files changed, 173 insertions(+), 39 deletions(-) diff --git a/SHUTTLE/AliDCSClient.cxx b/SHUTTLE/AliDCSClient.cxx index 4ad1636df14..6e4dae1a5bd 100644 --- a/SHUTTLE/AliDCSClient.cxx +++ b/SHUTTLE/AliDCSClient.cxx @@ -15,6 +15,9 @@ /* $Log$ +Revision 1.4 2006/07/04 14:59:57 jgrosseo +revision of AliDCSValue: Removed wrapper classes, reduced storage size per value by factor 2 + Revision 1.3 2006/06/12 09:11:16 jgrosseo coding conventions (Alberto) @@ -104,7 +107,7 @@ AliDCSClient::AliDCSClient(const char* host, Int_t port, UInt_t timeout, fSocket->SetOption(kNoBlock, 1); break; } - + AliDebug(1, Form("Connection timeout! tries <%d> ...", tries)); delete fSocket; @@ -117,7 +120,9 @@ AliDCSClient::AliDCSClient(const char* host, Int_t port, UInt_t timeout, //______________________________________________________________________ AliDCSClient::AliDCSClient(const AliDCSClient& /*other*/): -TObject() + TObject(), fSocket(NULL), fTimeout(0), fRetries(0), + fServerErrorCode(AliDCSMessage::kNoneError), fServerError("") + { // copy constructor (not implemented) diff --git a/SHUTTLE/AliDCSMessage.cxx b/SHUTTLE/AliDCSMessage.cxx index 28d18b2671a..2fc69a485de 100644 --- a/SHUTTLE/AliDCSMessage.cxx +++ b/SHUTTLE/AliDCSMessage.cxx @@ -15,6 +15,12 @@ /* $Log$ +Revision 1.5 2006/07/20 09:54:40 jgrosseo +introducing status management: The processing per subdetector is divided into several steps, +after each step the status is stored on disk. If the system crashes in any of the steps the Shuttle +can keep track of the number of failures and skips further processing after a certain threshold is +exceeded. These thresholds can be configured in LDAP. + Revision 1.4 2006/07/04 14:59:57 jgrosseo revision of AliDCSValue: Removed wrapper classes, reduced storage size per value by factor 2 @@ -84,7 +90,12 @@ ClassImp(AliDCSMessage) //______________________________________________________________________ AliDCSMessage::AliDCSMessage(): - fMessage(NULL), fMessageSize(0), fType(kInvalid) + fMessage(NULL), fMessageSize(0), fType(kInvalid), + fStartTime(0), fEndTime(0), + fRequestString(""), fCount(0), + fValueType(AliDCSValue::kInvalid), fValues(), + fErrorCode(kNoneError), fErrorString(""), + fRequestStrings() { // default constructor @@ -92,7 +103,12 @@ AliDCSMessage::AliDCSMessage(): //______________________________________________________________________ AliDCSMessage::AliDCSMessage(const char* message, UInt_t size): - fMessageSize(size), fType(kInvalid) + fMessageSize(size), fType(kInvalid), + fStartTime(0), fEndTime(0), + fRequestString(""), fCount(0), + fValueType(AliDCSValue::kInvalid), fValues(), + fErrorCode(kNoneError), fErrorString(""), + fRequestStrings() { // default constructor @@ -103,7 +119,12 @@ AliDCSMessage::AliDCSMessage(const char* message, UInt_t size): //______________________________________________________________________ AliDCSMessage::AliDCSMessage(const AliDCSMessage& /*other*/): -TObject() + TObject(), fMessage(NULL), fMessageSize(0), fType(kInvalid), + fStartTime(0), fEndTime(0), + fRequestString(""), fCount(0), + fValueType(AliDCSValue::kInvalid), fValues(), + fErrorCode(kNoneError), fErrorString(""), + fRequestStrings() { // copy constructor (not implemented) diff --git a/SHUTTLE/AliShuttle.cxx b/SHUTTLE/AliShuttle.cxx index 6e7fef84cd6..368d3a3cb40 100644 --- a/SHUTTLE/AliShuttle.cxx +++ b/SHUTTLE/AliShuttle.cxx @@ -15,6 +15,16 @@ /* $Log$ +Revision 1.12 2006/08/08 14:19:29 jgrosseo +Update to shuttle classes (Alberto) + +- Possibility to set the full object's path in the Preprocessor's and +Shuttle's Store functions +- Possibility to extend the object's run validity in the same classes +("startValidity" and "validityInfinite" parameters) +- Implementation of the StoreReferenceData function to store reference +data in a dedicated CDB storage. + Revision 1.11 2006/07/21 07:37:20 jgrosseo last run is stored after each run @@ -115,10 +125,14 @@ some docs added ClassImp(AliShuttle) +TString AliShuttle::fgkMainCDB("alien://DBFolder=ShuttleCDB"); TString AliShuttle::fgkLocalCDB("local://LocalShuttleCDB"); TString AliShuttle::fgkMainRefStorage("alien://DBFolder=ShuttleReference"); TString AliShuttle::fgkLocalRefStorage("local://LocalReferenceStorage"); +Bool_t AliShuttle::fgkProcessDCS(kTRUE); + + const char* AliShuttle::fgkShuttleTempDir = gSystem->ExpandPathName("$ALICE_ROOT/SHUTTLE/temp"); const char* AliShuttle::fgkShuttleLogDir = gSystem->ExpandPathName("$ALICE_ROOT/SHUTTLE/log"); @@ -131,10 +145,13 @@ const char* AliShuttle::fgkDetectorCode[AliShuttle::fgkNDetectors] = {"SPD", "SD //______________________________________________________________________________________________ AliShuttle::AliShuttle(const AliShuttleConfig* config, UInt_t timeout, Int_t retries): - fConfig(config), - fTimeout(timeout), - fRetries(retries), fCurrentRun(-1), fCurrentStartTime(0), - fCurrentEndTime(0), fStatusEntry(0) +fConfig(config), +fTimeout(timeout), fRetries(retries), +fPreprocessorMap(), +fCurrentRun(-1), +fCurrentStartTime(0), fCurrentEndTime(0), +fCurrentDetector(""), +fStatusEntry(0) { // // config: AliShuttleConfig used @@ -151,7 +168,15 @@ AliShuttle::AliShuttle(const AliShuttleConfig* config, //______________________________________________________________________ AliShuttle::AliShuttle(const AliShuttle& /*other*/): -AliShuttleInterface() +AliShuttleInterface(), +fConfig(0), +fTimeout(0), fRetries(0), +fPreprocessorMap(), +fCurrentRun(-1), +fCurrentStartTime(0), fCurrentEndTime(0), +fCurrentDetector(""), +fStatusEntry(0) + { // copy constructor (not implemented) @@ -238,11 +263,13 @@ UInt_t AliShuttle::Store(const AliCDBPath& path, TObject* object, UInt_t result = 0; - if (!(AliCDBManager::Instance()->IsDefaultStorageSet())) { - Log(fCurrentDetector, "No CDB storage set!"); + if (!(AliCDBManager::Instance()->GetStorage(fgkMainCDB))) { + Log(fCurrentDetector, "Cannot activate main CDB storage!"); } else { - result = (UInt_t) AliCDBManager::Instance()->Put(object, id, metaData); + result = (UInt_t) AliCDBManager::Instance()->GetStorage(fgkMainCDB) + ->Put(object, id, metaData); } + if(!result) { Log(fCurrentDetector, @@ -557,9 +584,15 @@ Bool_t AliShuttle::Process() while ((anAlias = (TObjString*) iter.Next())) { TObjArray valueSet; - //result = GetValueSet(host, port, anAlias->String(), valueSet); - AliInfo(Form("Port = %d",port)); - result = kTRUE; + // TODO Test only... I've added a flag that allows to + // exclude DCS archive DB query + if(fgkProcessDCS){ + AliInfo("Querying DCS archive DB data..."); + result = GetValueSet(host, port, anAlias->String(), valueSet); + } else { + AliInfo(Form("Skipping DCS processing. Port = %d",port)); + result = kTRUE; + } if(result) { aliasMap.Add(anAlias->Clone(), valueSet.Clone()); }else{ @@ -584,6 +617,9 @@ Bool_t AliShuttle::Process() if(aPreprocessor) { aPreprocessor->Initialize(fCurrentRun, fCurrentStartTime, fCurrentEndTime); + + // TODO Think about what to do in case of "Grid storage error" + // (-> object put in local backup storage, return 2) hasError = (aPreprocessor->Process(&aliasMap) == 0); }else{ // TODO default behaviour? diff --git a/SHUTTLE/AliShuttle.h b/SHUTTLE/AliShuttle.h index 3cd1d579bd3..d642e19782a 100644 --- a/SHUTTLE/AliShuttle.h +++ b/SHUTTLE/AliShuttle.h @@ -52,17 +52,20 @@ public: virtual TList* GetFileSources(Int_t system, const char* detector, const char* id); virtual void Log(const char* detector, const char* message); + static TString GetMainCDB () {return fgkMainCDB;} + static void SetMainCDB (TString mainCDB) {fgkMainCDB = mainCDB;} static TString GetLocalCDB () {return fgkLocalCDB;} static void SetLocalCDB (TString localCDB) {fgkLocalCDB = localCDB;} static TString GetMainRefStorage() {return fgkMainRefStorage;} static void SetMainRefStorage (TString mainRefStorage) {fgkMainRefStorage = mainRefStorage;} - static TString GetLocalRefStorage() {return fgkLocalRefStorage;} static void SetLocalRefStorage (TString localRefStorage) {fgkLocalRefStorage = localRefStorage;} // TODO Test only, remove later! void SetCurrentRun(int run) {fCurrentRun=run;} + //TODO Test only, remove later ! + void SetProcessDCS(Bool_t process) {fgkProcessDCS = process;} static const char* GetDetCode(const char* detector); static const char* GetShuttleTempDir() {return fgkShuttleTempDir;} @@ -90,17 +93,18 @@ private: // Bool_t RetrieveHLTFile(const char* daqFileName, const char* localFileName; TList* GetHLTFileSources(const char* detector, const char* id); - AliShuttleStatus* ReadShuttleStatus(); - Bool_t WriteShuttleStatus(AliShuttleStatus* status); - Bool_t ContinueProcessing(); - void UpdateShuttleStatus(AliShuttleStatus::Status newStatus, Bool_t increaseCount = kFALSE); + AliShuttleStatus* ReadShuttleStatus(); + Bool_t WriteShuttleStatus(AliShuttleStatus* status); + Bool_t ContinueProcessing(); + void UpdateShuttleStatus(AliShuttleStatus::Status newStatus, Bool_t increaseCount = kFALSE); const AliShuttleConfig* fConfig; //! pointer to configuration object static const Int_t fgkNDetectors = 17; //! number of detectors static const char* fgkDetectorName[fgkNDetectors]; //! names of detectors static const char* fgkDetectorCode[fgkNDetectors]; //! codes of detectors - static TString fgkLocalCDB; //! URI of the local backup storage + static TString fgkMainCDB; //! URI of the main (Grid) CDB storage + static TString fgkLocalCDB; //! URI of the local backup CDB storage static TString fgkMainRefStorage; //! URI of the main (Grid) REFERENCE storage static TString fgkLocalRefStorage; //! URI of the local REFERENCE storage static const char* fgkShuttleTempDir; //! base path of SHUTTLE temp folder @@ -115,14 +119,17 @@ private: UInt_t fCurrentStartTime; //! Run Start time UInt_t fCurrentEndTime; //! Run end time - TString fCurrentDetector; // current detector + TString fCurrentDetector; // current detector TSQLServer *fServer[3]; //! pointer to the three FS logbook servers Bool_t fFESCalled[3]; //! FES call status TList fFESlist[3]; //! List of files retrieved from each FES - AliCDBEntry* fStatusEntry; //! last CDB entry containing a AliShuttleStatus retrieved + AliCDBEntry* fStatusEntry; //! last CDB entry containing a AliShuttleStatus retrieved + + //TODO Test only, remove later ! + static Bool_t fgkProcessDCS; // flag to enable DCS archive data processing ClassDef(AliShuttle, 0); }; diff --git a/SHUTTLE/AliShuttleConfig.cxx b/SHUTTLE/AliShuttleConfig.cxx index 44450dd2969..68bbf536650 100644 --- a/SHUTTLE/AliShuttleConfig.cxx +++ b/SHUTTLE/AliShuttleConfig.cxx @@ -15,6 +15,12 @@ /* $Log$ +Revision 1.7 2006/07/20 09:54:40 jgrosseo +introducing status management: The processing per subdetector is divided into several steps, +after each step the status is stored on disk. If the system crashes in any of the steps the Shuttle +can keep track of the number of failures and skips further processing after a certain threshold is +exceeded. These thresholds can be configured in LDAP. + Revision 1.6 2006/07/19 10:09:55 jgrosseo new configuration, accesst to DAQ FES (Alberto) @@ -145,6 +151,10 @@ ClassImp(AliShuttleConfig) AliShuttleConfig::AliShuttleConfig(const char* host, Int_t port, const char* binddn, const char* password, const char* basedn): fIsValid(kFALSE), + fDAQlbHost(""), fDAQlbUser(""), fDAQlbPass(""), + fMaxPPRetries(0), fMaxRetries(0), + fDetectorMap(), fDetectorList(), + fShuttleInstanceHost(""), fProcessedDetectors(), fProcessAll(kFALSE) { // diff --git a/SHUTTLE/AliShuttleStatus.cxx b/SHUTTLE/AliShuttleStatus.cxx index 523770c9922..c06f8453392 100644 --- a/SHUTTLE/AliShuttleStatus.cxx +++ b/SHUTTLE/AliShuttleStatus.cxx @@ -15,6 +15,12 @@ /* $Log$ +Revision 1.1 2006/07/20 13:20:13 jgrosseo +introducing status management: The processing per subdetector is divided into several steps, +after each step the status is stored on disk. If the system crashes in any of the steps the Shuttle +can keep track of the number of failures and skips further processing after a certain threshold is +exceeded. These thresholds can be configured in LDAP. + */ // @@ -47,7 +53,10 @@ AliShuttleStatus::AliShuttleStatus(Status status) : TObject(), fTimeStamp = time(0); } -AliShuttleStatus::AliShuttleStatus(const AliShuttleStatus& c) : TObject(c) +AliShuttleStatus::AliShuttleStatus(const AliShuttleStatus& c) : +TObject(c), fTimeStamp(0), +fStatus(kInvalid), +fCount(1) { // copy constructor diff --git a/SHUTTLE/AliShuttleTrigger.cxx b/SHUTTLE/AliShuttleTrigger.cxx index db01bfa540a..7346d93c38e 100644 --- a/SHUTTLE/AliShuttleTrigger.cxx +++ b/SHUTTLE/AliShuttleTrigger.cxx @@ -15,6 +15,16 @@ /* $Log$ + Revision 1.9 2006/08/08 14:19:29 jgrosseo + Update to shuttle classes (Alberto) + + - Possibility to set the full object's path in the Preprocessor's and + Shuttle's Store functions + - Possibility to extend the object's run validity in the same classes + ("startValidity" and "validityInfinite" parameters) + - Implementation of the StoreReferenceData function to store reference + data in a dedicated CDB storage. + Revision 1.8 2006/07/21 07:37:20 jgrosseo last run is stored after each run @@ -82,7 +92,7 @@ ClassImp(TerminateSignalHandler) //______________________________________________________________________ TerminateSignalHandler::TerminateSignalHandler(const TerminateSignalHandler& /*other*/): -TSignalHandler() +TSignalHandler(), fTrigger() { // copy constructor (not implemented) @@ -116,8 +126,9 @@ ClassImp(AliShuttleTrigger) AliShuttleTrigger::AliShuttleTrigger(const AliShuttleConfig* config, UInt_t timeout, Int_t retries): fConfig(config), fShuttle(NULL), - fNotified(kFALSE), fTerminate(kFALSE), fLastRun(0), fCondition(&fMutex), - fQuitSignalHandler(this, kSigQuit), + fNotified(kFALSE), fTerminate(kFALSE), fLastRun(0), + fMutex(), fCondition(&fMutex), + fQuitSignalHandler(this, kSigQuit), fInterruptSignalHandler(this, kSigInterrupt) { // @@ -137,7 +148,12 @@ AliShuttleTrigger::AliShuttleTrigger(const AliShuttleConfig* config, //______________________________________________________________________ AliShuttleTrigger::AliShuttleTrigger(const AliShuttleTrigger& /*other*/): -TObject() + TObject(), fConfig(), fShuttle(NULL), + fNotified(kFALSE), fTerminate(kFALSE), fLastRun(0), + fMutex(), fCondition(&fMutex), + fQuitSignalHandler(this, kSigQuit), + fInterruptSignalHandler(this, kSigInterrupt) + { // copy constructor (not implemented) diff --git a/SHUTTLE/DATENotifier.cxx b/SHUTTLE/DATENotifier.cxx index f9a2533484c..cce88235d9f 100644 --- a/SHUTTLE/DATENotifier.cxx +++ b/SHUTTLE/DATENotifier.cxx @@ -4,15 +4,29 @@ #include "AliShuttleTrigger.h" -void DATENotifier::infoHandler() { +//______________________________________________________________________ +void DATENotifier::infoHandler() +{ +// Info handler + AliInfoGeneral("DATENotifier::infoHandler()", "DATE notification received ..."); fTrigger->Notify(); } -void DATENotifier::errorHandler(int severity, int code, char *msg) { +//______________________________________________________________________ +void DATENotifier::errorHandler(int severity, int code, char *msg) +{ +// Error handler AliInfoGeneral("DATENotifier::errorHandler()", Form("DIM Error: severity<%d>, code<%d> , message<%s>", severity, code, msg)); } + +//______________________________________________________________________ +DATENotifier::DATENotifier(const DATENotifier& /*other*/): +DimInfo(), fTrigger(0) { +// copy constructor (not implemented) + +} diff --git a/SHUTTLE/DATENotifier.h b/SHUTTLE/DATENotifier.h index 0f8fcbb560d..cc6855a1c43 100644 --- a/SHUTTLE/DATENotifier.h +++ b/SHUTTLE/DATENotifier.h @@ -14,7 +14,9 @@ public: void infoHandler(); - void errorHandler(int severity, int code, char *msg); + void errorHandler(int severity, int code, char *msg); +private: + DATENotifier(const DATENotifier& other); }; #endif diff --git a/SHUTTLE/Shuttle.C b/SHUTTLE/Shuttle.C index a2467c37f6c..d449cf2abd3 100644 --- a/SHUTTLE/Shuttle.C +++ b/SHUTTLE/Shuttle.C @@ -1,17 +1,31 @@ void Shuttle(const char* param = "listen") { + // WARNING: if ldap is built with ssl support it may cause confilcts with the + // AliEn interface. If this happens, grid storage activation must be done BEFORE + // loading LDAP libraries!!! + + gSystem->Load("libRLDAP.so"); gSystem->Load("libSHUTTLE"); gSystem->Load("$ROOTSYS/lib/libThread"); gSystem->Load("$ALICE_ROOT/SHUTTLE/test/libTest.so"); // AliLog::SetGlobalDebugLevel(1); - AliCDBManager *man = AliCDBManager::Instance(); - man->SetDefaultStorage("local://MainCDB"); + // Setting local CDB and reference storage locations + AliShuttle::SetMainCDB("alien://DBFolder=ShuttleCDB"); + AliShuttle::SetLocalCDB("local://LocalShuttleCDB"); + AliShuttle::SetMainRefStorage("alien://DBFolder=GridReferenceStorage"); + AliShuttle::SetLocalRefStorage("local://LocalReferenceStorage"); + + AliShuttle::SetProcessDCS(kTRUE); + + +// AliCDBManager *man = AliCDBManager::Instance(); +// man->SetDefaultStorage("local://MainCDB"); // man->SetDefaultStorage("alien://DBFolder=ShuttleMainCDB"); - AliShuttleConfig config("pcalice290.cern.ch", 389, - "o=alice,dc=cern,dc=ch"); + + AliShuttleConfig config("pcalice290.cern.ch", 389, "o=alice,dc=cern,dc=ch"); config.SetProcessAll(kTRUE); config.Print(); @@ -20,8 +34,8 @@ void Shuttle(const char* param = "listen") { AliShuttle* shuttle = trigger.GetShuttle(); // Add here detectors preprocessor ... - //TestTPCPreprocessor *tpcPrep = new TestTPCPreprocessor("TPC",shuttle); - //TestITSPreprocessor *itsPrep = new TestITSPreprocessor("ITS",shuttle); + TestTPCPreprocessor *tpcPrep = new TestTPCPreprocessor("TPC",shuttle); + TestITSPreprocessor *itsPrep = new TestITSPreprocessor("ITS",shuttle); TestRICHPreprocessor *richPrep = new TestRICHPreprocessor("RICH",shuttle); TString paramStr(param); @@ -46,7 +60,7 @@ void Shuttle(const char* param = "listen") { cout<<"new - collect data only for the new runs"< - sets last run manually. use with caution!" << endl + cout<<"lastrun= - sets last run manually. use with caution!" << endl; cout<<" - the same as 'listen'"<