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