]>
Commit | Line | Data |
---|---|---|
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 | |
14 | // AliPreprocessor. | |
15 | // | |
16 | ||
17 | #include <TMap.h> | |
18 | #include <TString.h> | |
19 | #include <TList.h> | |
20 | ||
21 | #include "AliShuttleInterface.h" | |
22 | #include "AliShuttleStatus.h" | |
23 | ||
24 | class TObject; | |
25 | class AliShuttleConfig; | |
26 | class AliShuttleLogbookEntry; | |
27 | class AliPreprocessor; | |
28 | class AliCDBMetaData; | |
29 | class TSQLServer; | |
30 | class AliCDBEntry; | |
31 | class AliCDBPath; | |
32 | class TMutex; | |
33 | ||
34 | class AliShuttle: public AliShuttleInterface { | |
35 | public: | |
36 | enum { kNDetectors=17 }; // number of subdetectors in ALICE | |
37 | ||
38 | AliShuttle(const AliShuttleConfig* config, UInt_t timeout = 5000, Int_t retries = 5); | |
39 | virtual ~AliShuttle(); | |
40 | ||
41 | virtual void RegisterPreprocessor(AliPreprocessor* preprocessor); | |
42 | ||
43 | Bool_t Collect(Int_t run = -1); | |
44 | ||
45 | Bool_t Process(AliShuttleLogbookEntry* entry); | |
46 | ||
47 | // monitoring functions | |
48 | ULong_t GetTimeOfLastAction() const; | |
49 | const TString GetLastAction() const; | |
50 | ||
51 | Int_t GetCurrentRun() const; | |
52 | UInt_t GetCurrentStartTime() const; | |
53 | UInt_t GetCurrentEndTime() const; | |
54 | ||
55 | virtual UInt_t Store(const AliCDBPath& path, TObject* object, AliCDBMetaData* metaData, | |
56 | Int_t validityStart = 0, Bool_t validityInfinite = kFALSE); | |
57 | virtual UInt_t StoreReferenceData(const AliCDBPath& path, TObject* object, AliCDBMetaData* metaData); | |
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); | |
61 | virtual void Log(const char* detector, const char* message); | |
62 | ||
63 | static TString GetMainCDB () {return fgkMainCDB;} | |
64 | static void SetMainCDB (TString mainCDB) {fgkMainCDB = mainCDB;} | |
65 | static TString GetLocalCDB () {return fgkLocalCDB;} | |
66 | static void SetLocalCDB (TString localCDB) {fgkLocalCDB = localCDB;} | |
67 | ||
68 | static TString GetMainRefStorage() {return fgkMainRefStorage;} | |
69 | static void SetMainRefStorage (TString mainRefStorage) {fgkMainRefStorage = mainRefStorage;} | |
70 | static TString GetLocalRefStorage() {return fgkLocalRefStorage;} | |
71 | static void SetLocalRefStorage (TString localRefStorage) {fgkLocalRefStorage = localRefStorage;} | |
72 | ||
73 | //TODO Test only, remove later ! | |
74 | void SetProcessDCS(Bool_t process) {fgkProcessDCS = process;} | |
75 | ||
76 | static const char* GetDetCode(const char* detector); | |
77 | static const char* GetDetCode(UInt_t detPos); | |
78 | static const Int_t GetDetPos(const char* detCode); | |
79 | static const UInt_t NDetectors() {return kNDetectors;} | |
80 | static const char* GetShuttleTempDir() {return fgkShuttleTempDir;} | |
81 | ||
82 | Bool_t Connect(Int_t system); | |
83 | ||
84 | private: | |
85 | AliShuttle(const AliShuttle& other); | |
86 | AliShuttle& operator= (const AliShuttle& other); | |
87 | ||
88 | UInt_t ProcessCurrentDetector(); | |
89 | ||
90 | Bool_t QueryRunParameters(Int_t& run, UInt_t& startTime, UInt_t& endTime); | |
91 | Bool_t QueryShuttleLogbook(const char* whereClause, TObjArray& entries); | |
92 | Bool_t RetrieveConditionsData(const TObjArray& shuttleLogbookEntries); | |
93 | ||
94 | Bool_t GetValueSet(const char* host, Int_t port, const char* alias, TObjArray* result); | |
95 | ||
96 | const char* GetDAQFileName(const char* detector, const char* id, const char* source); | |
97 | Bool_t RetrieveDAQFile(const char* daqFileName, const char* localFileName); | |
98 | TList* GetDAQFileSources(const char* detector, const char* id); | |
99 | Bool_t UpdateDAQTable(); | |
100 | ||
101 | const char* GetDCSFileName(const char* detector, const char* id, const char* source); | |
102 | // Bool_t RetrieveDCSFile(const char* daqFileName const char* localFileName); | |
103 | TList* GetDCSFileSources(const char* detector, const char* id); | |
104 | ||
105 | const char* GetHLTFileName(const char* detector, const char* id, const char* source); | |
106 | // Bool_t RetrieveHLTFile(const char* daqFileName, const char* localFileName; | |
107 | TList* GetHLTFileSources(const char* detector, const char* id); | |
108 | ||
109 | UInt_t WriteToCDB(const char* mainUri, const char* localUri, | |
110 | const AliCDBPath& path, TObject* object, AliCDBMetaData* metaData, | |
111 | Int_t validityStart = 0, Bool_t validityInfinite = kFALSE); | |
112 | ||
113 | Bool_t TryToStoreAgain(); | |
114 | Bool_t TryToStoreAgain(TString& storageType); | |
115 | ||
116 | AliShuttleStatus* ReadShuttleStatus(); | |
117 | Bool_t WriteShuttleStatus(AliShuttleStatus* status); | |
118 | Bool_t ContinueProcessing(); | |
119 | void UpdateShuttleStatus(AliShuttleStatus::Status newStatus, Bool_t increaseCount = kFALSE); | |
120 | Bool_t UpdateShuttleLogbook(const char* detector, const char* status=0); | |
121 | ||
122 | void SetLastAction(const char* action); | |
123 | ||
124 | const AliShuttleConfig* fConfig; // pointer to configuration object | |
125 | ||
126 | // static const UInt_t fgkNDetectors = 17; //! number of detectors | |
127 | static const char* fgkDetectorName[kNDetectors]; //! names of detectors | |
128 | static const char* fgkDetectorCode[kNDetectors]; //! codes of detectors | |
129 | static TString fgkMainCDB; // URI of the main (Grid) CDB storage | |
130 | static TString fgkLocalCDB; //! URI of the local backup CDB storage | |
131 | static TString fgkMainRefStorage; // URI of the main (Grid) REFERENCE storage | |
132 | static TString fgkLocalRefStorage; // URI of the local REFERENCE storage | |
133 | static const char* fgkShuttleTempDir; // base path of SHUTTLE temp folder | |
134 | static const char* fgkShuttleLogDir; // path of SHUTTLE log folder | |
135 | ||
136 | UInt_t fTimeout; // DCS server connection timeout parameter | |
137 | Int_t fRetries; // Number of DCS server connection retries | |
138 | ||
139 | TMap fPreprocessorMap; // list of detector Preprocessors ("DET", "Preprocessor") | |
140 | ||
141 | AliShuttleLogbookEntry* fLogbookEntry; //! current Shuttle logbook entry | |
142 | TString fCurrentDetector; // current detector | |
143 | ||
144 | TSQLServer *fServer[3]; // pointer to the three FS logbook servers | |
145 | Bool_t fFESCalled[3]; // FES call status | |
146 | TList fFESlist[3]; // List of files retrieved from each FES | |
147 | ||
148 | AliCDBEntry* fStatusEntry; // last CDB entry containing a AliShuttleStatus retrieved | |
149 | Bool_t fGridError; // Grid storage error flag | |
150 | ||
151 | TMutex* fMonitoringMutex; // mutex to lock the monitoring class members | |
152 | UInt_t fLastActionTime; // time of last action for monitoring | |
153 | TString fLastAction; // string description for last action | |
154 | ||
155 | //TODO Test only, remove later ! | |
156 | static Bool_t fgkProcessDCS; // flag to enable DCS archive data processing | |
157 | ||
158 | ClassDef(AliShuttle, 0); | |
159 | }; | |
160 | ||
161 | #endif |