]>
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 TSQLServer; | |
29 | class TMutex; | |
30 | class TMonaLisaWriter; | |
31 | ||
32 | class AliShuttle: public AliShuttleInterface { | |
33 | public: | |
34 | enum DCSType {kAlias=0, kDP}; | |
35 | enum returnCodes {kDCSErrCode=20051975, kStorErrCode=20051976}; | |
36 | ||
37 | AliShuttle(const AliShuttleConfig* config, UInt_t timeout = 5000, Int_t retries = 5); | |
38 | virtual ~AliShuttle(); | |
39 | ||
40 | virtual void RegisterPreprocessor(AliPreprocessor* preprocessor); | |
41 | ||
42 | Bool_t Collect(Int_t run = -1); | |
43 | ||
44 | Bool_t Process(AliShuttleLogbookEntry* entry); | |
45 | ||
46 | // monitoring functions | |
47 | ULong_t GetTimeOfLastAction() const; | |
48 | const TString GetLastAction() const; | |
49 | ||
50 | Int_t GetCurrentRun() const; | |
51 | UInt_t GetCurrentStartTime() const; | |
52 | UInt_t GetCurrentEndTime() const; | |
53 | ||
54 | virtual Bool_t Store(const AliCDBPath& path, TObject* object, AliCDBMetaData* metaData, | |
55 | Int_t validityStart = 0, Bool_t validityInfinite = kFALSE); | |
56 | virtual Bool_t StoreReferenceData(const AliCDBPath& path, TObject* object, AliCDBMetaData* metaData); | |
57 | virtual const char* GetFile(Int_t system, const char* detector, | |
58 | const char* id, const char* source); | |
59 | virtual TList* GetFileSources(Int_t system, const char* detector, const char* id); | |
60 | virtual const char* GetRunParameter(const char* lbEntry); | |
61 | virtual AliCDBEntry* GetFromOCDB(const AliCDBPath& path); | |
62 | virtual const char* GetRunType(const char* detCode); | |
63 | virtual void Log(const char* detector, const char* message); | |
64 | ||
65 | //TODO Test only, remove later ! | |
66 | void SetProcessDCS(Bool_t process) {fgkProcessDCS = process;} | |
67 | void SetLogbookEntry(AliShuttleLogbookEntry* entry) {fLogbookEntry=entry;} | |
68 | ||
69 | Bool_t Connect(Int_t system); | |
70 | ||
71 | static void SetMainCDB (TString mainCDB) {fgkMainCDB = mainCDB;} | |
72 | static void SetLocalCDB (TString localCDB) {fgkLocalCDB = localCDB;} | |
73 | ||
74 | static void SetMainRefStorage (TString mainRefStorage) {fgkMainRefStorage = mainRefStorage;} | |
75 | static void SetLocalRefStorage (TString localRefStorage) {fgkLocalRefStorage = localRefStorage;} | |
76 | ||
77 | static void SetShuttleTempDir (const char* tmpDir); | |
78 | static void SetShuttleLogDir (const char* logDir); | |
79 | ||
80 | private: | |
81 | AliShuttle(const AliShuttle& other); | |
82 | AliShuttle& operator= (const AliShuttle& other); | |
83 | ||
84 | UInt_t ProcessCurrentDetector(); | |
85 | ||
86 | AliShuttleLogbookEntry* QueryRunParameters(Int_t run); | |
87 | Bool_t QueryShuttleLogbook(const char* whereClause, TObjArray& entries); | |
88 | Bool_t RetrieveConditionsData(const TObjArray& shuttleLogbookEntries); | |
89 | ||
90 | Bool_t GetValueSet(const char* host, Int_t port, const char* alias, | |
91 | TObjArray* result, DCSType type); | |
92 | ||
93 | Bool_t RetrieveFile(UInt_t system, const char* daqFileName, const char* localFileName); | |
94 | ||
95 | Bool_t UpdateTable(); | |
96 | Bool_t UpdateTableFailCase(); | |
97 | ||
98 | Bool_t StoreLocally(const TString& localUri, const AliCDBPath& path, TObject* object, | |
99 | AliCDBMetaData* metaData, Int_t validityStart = 0, Bool_t validityInfinite = kFALSE); | |
100 | ||
101 | Bool_t StoreOCDB(); | |
102 | Bool_t StoreOCDB(const TString& uri); | |
103 | void CleanLocalStorage(const TString& uri); | |
104 | void RemoveFile(const char* filename); | |
105 | ||
106 | AliShuttleStatus* ReadShuttleStatus(); | |
107 | Bool_t WriteShuttleStatus(AliShuttleStatus* status); | |
108 | Bool_t ContinueProcessing(); | |
109 | void UpdateShuttleStatus(AliShuttleStatus::Status newStatus, Bool_t increaseCount = kFALSE); | |
110 | Bool_t UpdateShuttleLogbook(const char* detector, const char* status=0); | |
111 | Bool_t SendMail(); | |
112 | ||
113 | void SetLastAction(const char* action); | |
114 | ||
115 | void SendMLInfo(); | |
116 | ||
117 | void SetRunType(); | |
118 | ||
119 | const AliShuttleConfig* fConfig; // pointer to configuration object | |
120 | ||
121 | UInt_t fTimeout; // DCS server connection timeout parameter | |
122 | Int_t fRetries; // Number of DCS server connection retries | |
123 | ||
124 | TMap fPreprocessorMap; // list of detector Preprocessors ("DET", "Preprocessor") | |
125 | ||
126 | AliShuttleLogbookEntry* fLogbookEntry; //! current Shuttle logbook entry | |
127 | TString fCurrentDetector; // current detector | |
128 | ||
129 | TSQLServer *fServer[4]; // pointer to the three FXS + Run & Shuttle logbook servers | |
130 | Bool_t fFXSCalled[3]; // FXS call status | |
131 | TList fFXSlist[3]; // List of files retrieved from each FXS | |
132 | ||
133 | AliCDBEntry* fStatusEntry; // last CDB entry containing a AliShuttleStatus retrieved | |
134 | ||
135 | TMutex* fMonitoringMutex; // mutex to lock the monitoring class members | |
136 | UInt_t fLastActionTime; // time of last action for monitoring | |
137 | TString fLastAction; // string description for last action | |
138 | ||
139 | Bool_t fFirstUnprocessed[AliShuttleInterface::kNDetectors]; // array of flags for first unprocessed dets | |
140 | ||
141 | TMonaLisaWriter* fMonaLisa; // ML instance that sends the processing information | |
142 | ||
143 | //TODO Test only, remove later ! | |
144 | static Bool_t fgkProcessDCS; // flag to enable DCS archive data processing | |
145 | ||
146 | ClassDef(AliShuttle, 0); | |
147 | }; | |
148 | ||
149 | #endif |