]>
Commit | Line | Data |
---|---|---|
73abe331 | 1 | #ifndef ALI_SHUTTLE_H |
2 | #define ALI_SHUTTLE_H | |
3 | ||
4 | /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
5 | * See cxx source for full Copyright notice */ | |
6 | ||
7 | /* $Id$ */ | |
8 | ||
9 | ||
10 | // | |
11 | // This class is the main manager for | |
12 | // AliShuttle. It organizes the data retrieval | |
13 | // from DCS and call the interface methods of | |
a7160fe9 | 14 | // AliPreprocessor. |
73abe331 | 15 | // |
16 | ||
73abe331 | 17 | #include <TMap.h> |
b948db8d | 18 | #include <TString.h> |
57f50b3c | 19 | #include <TList.h> |
b948db8d | 20 | |
21 | #include "AliShuttleInterface.h" | |
5164a766 | 22 | #include "AliShuttleStatus.h" |
73abe331 | 23 | |
58bc3020 | 24 | class TObject; |
73abe331 | 25 | class AliShuttleConfig; |
2bb7b766 | 26 | class AliShuttleLogbookEntry; |
b948db8d | 27 | class AliPreprocessor; |
73abe331 | 28 | class AliCDBMetaData; |
57f50b3c | 29 | class TSQLServer; |
5164a766 | 30 | class AliCDBEntry; |
84090f85 | 31 | class AliCDBPath; |
cb343cfd | 32 | class TMutex; |
73abe331 | 33 | |
b948db8d | 34 | class AliShuttle: public AliShuttleInterface { |
73abe331 | 35 | public: |
2c15234c | 36 | enum DCSType {kAlias=0, kDP}; |
37 | ||
b948db8d | 38 | AliShuttle(const AliShuttleConfig* config, UInt_t timeout = 5000, Int_t retries = 5); |
73abe331 | 39 | virtual ~AliShuttle(); |
40 | ||
b948db8d | 41 | virtual void RegisterPreprocessor(AliPreprocessor* preprocessor); |
42 | ||
cb343cfd | 43 | Bool_t Collect(Int_t run = -1); |
2bb7b766 | 44 | |
45 | Bool_t Process(AliShuttleLogbookEntry* entry); | |
73abe331 | 46 | |
cb343cfd | 47 | // monitoring functions |
48 | ULong_t GetTimeOfLastAction() const; | |
49 | const TString GetLastAction() const; | |
50 | ||
2bb7b766 | 51 | Int_t GetCurrentRun() const; |
52 | UInt_t GetCurrentStartTime() const; | |
53 | UInt_t GetCurrentEndTime() const; | |
73abe331 | 54 | |
84090f85 | 55 | virtual UInt_t Store(const AliCDBPath& path, TObject* object, AliCDBMetaData* metaData, |
56 | Int_t validityStart = 0, Bool_t validityInfinite = kFALSE); | |
481441a2 | 57 | virtual UInt_t StoreReferenceData(const AliCDBPath& path, TObject* object, AliCDBMetaData* metaData); |
b948db8d | 58 | virtual const char* GetFile(Int_t system, const char* detector, |
59 | const char* id, const char* source); | |
60 | virtual TList* GetFileSources(Int_t system, const char* detector, const char* id); | |
eba76848 | 61 | virtual const char* GetRunParameter(const char* lbEntry); |
b948db8d | 62 | virtual void Log(const char* detector, const char* message); |
63 | ||
4f0ab988 | 64 | static TString GetMainCDB () {return fgkMainCDB;} |
65 | static void SetMainCDB (TString mainCDB) {fgkMainCDB = mainCDB;} | |
84090f85 | 66 | static TString GetLocalCDB () {return fgkLocalCDB;} |
67 | static void SetLocalCDB (TString localCDB) {fgkLocalCDB = localCDB;} | |
68 | ||
69 | static TString GetMainRefStorage() {return fgkMainRefStorage;} | |
70 | static void SetMainRefStorage (TString mainRefStorage) {fgkMainRefStorage = mainRefStorage;} | |
84090f85 | 71 | static TString GetLocalRefStorage() {return fgkLocalRefStorage;} |
72 | static void SetLocalRefStorage (TString localRefStorage) {fgkLocalRefStorage = localRefStorage;} | |
73abe331 | 73 | |
4f0ab988 | 74 | //TODO Test only, remove later ! |
2bb7b766 | 75 | void SetProcessDCS(Bool_t process) {fgkProcessDCS = process;} |
eba76848 | 76 | void SetLogbookEntry(AliShuttleLogbookEntry* entry) {fLogbookEntry=entry;} |
57f50b3c | 77 | |
57f50b3c | 78 | static const char* GetShuttleTempDir() {return fgkShuttleTempDir;} |
79 | ||
80 | Bool_t Connect(Int_t system); | |
81 | ||
73abe331 | 82 | private: |
57f50b3c | 83 | AliShuttle(const AliShuttle& other); |
84 | AliShuttle& operator= (const AliShuttle& other); | |
85 | ||
2bb7b766 | 86 | UInt_t ProcessCurrentDetector(); |
87 | ||
eba76848 | 88 | AliShuttleLogbookEntry* QueryRunParameters(Int_t run); |
2bb7b766 | 89 | Bool_t QueryShuttleLogbook(const char* whereClause, TObjArray& entries); |
90 | Bool_t RetrieveConditionsData(const TObjArray& shuttleLogbookEntries); | |
91 | ||
2c15234c | 92 | Bool_t GetValueSet(const char* host, Int_t port, const char* alias, |
93 | TObjArray* result, DCSType type); | |
57f50b3c | 94 | |
95 | const char* GetDAQFileName(const char* detector, const char* id, const char* source); | |
96 | Bool_t RetrieveDAQFile(const char* daqFileName, const char* localFileName); | |
97 | TList* GetDAQFileSources(const char* detector, const char* id); | |
5164a766 | 98 | Bool_t UpdateDAQTable(); |
57f50b3c | 99 | |
100 | const char* GetDCSFileName(const char* detector, const char* id, const char* source); | |
101 | // Bool_t RetrieveDCSFile(const char* daqFileName const char* localFileName); | |
102 | TList* GetDCSFileSources(const char* detector, const char* id); | |
57c1a579 | 103 | // Bool_t UpdateDCSTable(); |
57f50b3c | 104 | |
105 | const char* GetHLTFileName(const char* detector, const char* id, const char* source); | |
9e080f92 | 106 | Bool_t RetrieveHLTFile(const char* hltFileName, const char* localFileName); |
57f50b3c | 107 | TList* GetHLTFileSources(const char* detector, const char* id); |
57c1a579 | 108 | Bool_t UpdateHLTTable(); |
57f50b3c | 109 | |
85a80aa9 | 110 | UInt_t WriteToCDB(const char* mainUri, const char* localUri, |
111 | const AliCDBPath& path, TObject* object, AliCDBMetaData* metaData, | |
112 | Int_t validityStart = 0, Bool_t validityInfinite = kFALSE); | |
113 | ||
2bb7b766 | 114 | Bool_t TryToStoreAgain(); |
115 | Bool_t TryToStoreAgain(TString& storageType); | |
116 | ||
4f0ab988 | 117 | AliShuttleStatus* ReadShuttleStatus(); |
118 | Bool_t WriteShuttleStatus(AliShuttleStatus* status); | |
119 | Bool_t ContinueProcessing(); | |
120 | void UpdateShuttleStatus(AliShuttleStatus::Status newStatus, Bool_t increaseCount = kFALSE); | |
2bb7b766 | 121 | Bool_t UpdateShuttleLogbook(const char* detector, const char* status=0); |
57c1a579 | 122 | Bool_t SendMail(); |
123 | ||
cb343cfd | 124 | void SetLastAction(const char* action); |
b948db8d | 125 | |
2bb7b766 | 126 | const AliShuttleConfig* fConfig; // pointer to configuration object |
73abe331 | 127 | |
2bb7b766 | 128 | static TString fgkMainCDB; // URI of the main (Grid) CDB storage |
129 | static TString fgkLocalCDB; //! URI of the local backup CDB storage | |
130 | static TString fgkMainRefStorage; // URI of the main (Grid) REFERENCE storage | |
131 | static TString fgkLocalRefStorage; // URI of the local REFERENCE storage | |
132 | static const char* fgkShuttleTempDir; // base path of SHUTTLE temp folder | |
133 | static const char* fgkShuttleLogDir; // path of SHUTTLE log folder | |
57f50b3c | 134 | |
2bb7b766 | 135 | UInt_t fTimeout; // DCS server connection timeout parameter |
136 | Int_t fRetries; // Number of DCS server connection retries | |
5164a766 | 137 | |
2bb7b766 | 138 | TMap fPreprocessorMap; // list of detector Preprocessors ("DET", "Preprocessor") |
57f50b3c | 139 | |
2bb7b766 | 140 | AliShuttleLogbookEntry* fLogbookEntry; //! current Shuttle logbook entry |
141 | TString fCurrentDetector; // current detector | |
57f50b3c | 142 | |
2c15234c | 143 | TSQLServer *fServer[4]; // pointer to the three FXS + Run & Shuttle logbook servers |
144 | Bool_t fFXSCalled[3]; // FXS call status | |
145 | TList fFXSlist[3]; // List of files retrieved from each FXS | |
85a80aa9 | 146 | |
2bb7b766 | 147 | AliCDBEntry* fStatusEntry; // last CDB entry containing a AliShuttleStatus retrieved |
148 | Bool_t fGridError; // Grid storage error flag | |
be48e3ea | 149 | |
cb343cfd | 150 | TMutex* fMonitoringMutex; // mutex to lock the monitoring class members |
151 | UInt_t fLastActionTime; // time of last action for monitoring | |
152 | TString fLastAction; // string description for last action | |
4f0ab988 | 153 | |
be48e3ea | 154 | Bool_t fFirstUnprocessed[AliShuttleInterface::kNDetectors]; // array of flags for first unprocessed dets |
155 | ||
4f0ab988 | 156 | //TODO Test only, remove later ! |
157 | static Bool_t fgkProcessDCS; // flag to enable DCS archive data processing | |
b948db8d | 158 | |
73abe331 | 159 | ClassDef(AliShuttle, 0); |
160 | }; | |
161 | ||
162 | #endif |