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