]>
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}; |
9827400b | 35 | enum TestMode { kNone = 0, kSkipDCS = 1, kErrorDCS = 2, kErrorFXSSources = 4, kErrorFXSFiles = 8, kErrorOCDB = 16, kErrorStorage = 32, kErrorGrid = 64 }; |
339adafa | 36 | enum EMailTarget { kDCSEMail = 0, kFXSEMail, kPPEMail }; |
2c15234c | 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; | |
675f64cd | 54 | UInt_t GetCurrentYear() const; |
55 | ||
56 | const char* GetLHCPeriod() const; | |
73abe331 | 57 | |
3301427a | 58 | virtual Bool_t Store(const AliCDBPath& path, TObject* object, AliCDBMetaData* metaData, |
84090f85 | 59 | Int_t validityStart = 0, Bool_t validityInfinite = kFALSE); |
3301427a | 60 | virtual Bool_t StoreReferenceData(const AliCDBPath& path, TObject* object, AliCDBMetaData* metaData); |
9827400b | 61 | virtual Bool_t StoreReferenceFile(const char* detector, const char* localFile, const char* gridFileName); |
c88ad5db | 62 | virtual Bool_t StoreRunMetadataFile(const char* localFile, const char* gridFileName); |
b948db8d | 63 | virtual const char* GetFile(Int_t system, const char* detector, |
64 | const char* id, const char* source); | |
4a33bdd9 | 65 | virtual TList* GetFileSources(Int_t system, const char* detector, const char* id = 0); |
66 | virtual TList* GetFileIDs(Int_t system, const char* detector, const char* source); | |
eba76848 | 67 | virtual const char* GetRunParameter(const char* lbEntry); |
f100adeb | 68 | virtual UInt_t GetStartTimeDCSQuery(); |
69 | virtual UInt_t GetEndTimeDCSQuery(); | |
9827400b | 70 | virtual AliCDBEntry* GetFromOCDB(const char* detector, const AliCDBPath& path); |
71 | virtual const char* GetRunType(); | |
4859271b | 72 | virtual Bool_t GetHLTStatus(); |
ca8ea066 | 73 | virtual const char* GetTriggerConfiguration(); |
2c5f9d06 | 74 | virtual const char* GetCTPTimeParams(); |
b48d2542 | 75 | virtual const char* GetTriggerDetectorMask(); |
6a150f83 | 76 | virtual void Log(const char* detector, const char* message, UInt_t level=3); |
b948db8d | 77 | |
eba76848 | 78 | void SetLogbookEntry(AliShuttleLogbookEntry* entry) {fLogbookEntry=entry;} |
9827400b | 79 | |
80 | void SetTestMode(TestMode testMode) { fTestMode = testMode; } | |
81 | void SetReadTestModeFromLog(Bool_t flag) { fReadTestMode = flag; } | |
57f50b3c | 82 | |
57f50b3c | 83 | Bool_t Connect(Int_t system); |
84 | ||
d386d623 | 85 | static void SetMainCDB (TString mainCDB) {fgkMainCDB = mainCDB;} |
86 | static void SetLocalCDB (TString localCDB) {fgkLocalCDB = localCDB;} | |
87 | ||
88 | static void SetMainRefStorage (TString mainRefStorage) {fgkMainRefStorage = mainRefStorage;} | |
89 | static void SetLocalRefStorage (TString localRefStorage) {fgkLocalRefStorage = localRefStorage;} | |
90 | ||
91 | static void SetShuttleTempDir (const char* tmpDir); | |
92 | static void SetShuttleLogDir (const char* logDir); | |
93 | ||
73abe331 | 94 | private: |
57f50b3c | 95 | AliShuttle(const AliShuttle& other); |
96 | AliShuttle& operator= (const AliShuttle& other); | |
97 | ||
ffa25f20 | 98 | Int_t ProcessCurrentDetector(); |
2bb7b766 | 99 | |
eba76848 | 100 | AliShuttleLogbookEntry* QueryRunParameters(Int_t run); |
2bb7b766 | 101 | Bool_t QueryShuttleLogbook(const char* whereClause, TObjArray& entries); |
fbc112e3 | 102 | void CountOpenRuns(); |
2bb7b766 | 103 | Bool_t RetrieveConditionsData(const TObjArray& shuttleLogbookEntries); |
104 | ||
a038aa70 | 105 | TMap* GetValueSet(const char* host, Int_t port, const TSeqCollection* entries, |
542b6cc8 | 106 | DCSType type, Int_t valueSet); |
57f50b3c | 107 | |
9d733021 | 108 | Bool_t RetrieveFile(UInt_t system, const char* daqFileName, const char* localFileName); |
109 | ||
110 | Bool_t UpdateTable(); | |
bd23d48b | 111 | Bool_t UpdateTableSkippedCase(const char* detector="ALL"); |
3301427a | 112 | Bool_t UpdateTableFailCase(); |
57f50b3c | 113 | |
3301427a | 114 | Bool_t StoreLocally(const TString& localUri, const AliCDBPath& path, TObject* object, |
115 | AliCDBMetaData* metaData, Int_t validityStart = 0, Bool_t validityInfinite = kFALSE); | |
85a80aa9 | 116 | |
3301427a | 117 | Bool_t StoreOCDB(); |
5e993b6f | 118 | Int_t StoreOCDB(const TString& uri); |
d524ade6 | 119 | Bool_t CopyFileLocally(const char* localFile, const TString& target); |
c88ad5db | 120 | Bool_t CopyFilesToGrid(const char* type); |
3301427a | 121 | void CleanLocalStorage(const TString& uri); |
546242fb | 122 | Bool_t CleanReferenceStorage(const char* detector); |
3301427a | 123 | void RemoveFile(const char* filename); |
2d9019b4 | 124 | const char* GetRefFilePrefix(const char* base, const char* detector); |
2bb7b766 | 125 | |
e7f62f16 | 126 | AliShuttleStatus* ReadShuttleStatus(); |
127 | Bool_t WriteShuttleStatus(AliShuttleStatus* status); | |
128 | Bool_t ContinueProcessing(); | |
129 | void UpdateShuttleStatus(AliShuttleStatus::Status newStatus, Bool_t increaseCount = kFALSE); | |
130 | Bool_t UpdateShuttleLogbook(const char* detector, const char* status=0); | |
339adafa | 131 | Bool_t SendMail(EMailTarget target, Int_t system = -1); |
ef83773f | 132 | Int_t GetMem(Int_t pid); |
ffa29e93 | 133 | |
134 | TString GetLogFileName(const char* detector) const; | |
57c1a579 | 135 | |
e7f62f16 | 136 | void SetLastAction(const char* action); |
137 | ||
ee6f7523 | 138 | void SendAlive(); |
8e828d39 | 139 | void SendMLDetInfo(); |
140 | void SendMLRunInfo(const char* status); | |
503ff24f | 141 | virtual Bool_t TouchFile(); |
b948db8d | 142 | |
2bb7b766 | 143 | const AliShuttleConfig* fConfig; // pointer to configuration object |
73abe331 | 144 | |
2bb7b766 | 145 | UInt_t fTimeout; // DCS server connection timeout parameter |
146 | Int_t fRetries; // Number of DCS server connection retries | |
5164a766 | 147 | |
2bb7b766 | 148 | TMap fPreprocessorMap; // list of detector Preprocessors ("DET", "Preprocessor") |
57f50b3c | 149 | |
2bb7b766 | 150 | AliShuttleLogbookEntry* fLogbookEntry; //! current Shuttle logbook entry |
151 | TString fCurrentDetector; // current detector | |
926cbc0e | 152 | Bool_t fFirstProcessing; // processing this detector the first time in this run |
57f50b3c | 153 | |
2c15234c | 154 | TSQLServer *fServer[4]; // pointer to the three FXS + Run & Shuttle logbook servers |
155 | Bool_t fFXSCalled[3]; // FXS call status | |
156 | TList fFXSlist[3]; // List of files retrieved from each FXS | |
339adafa | 157 | Int_t fFXSError; // Variable to keep track of any FXS errors; contains -1 for no error, kDAQ, kDCS, kHLT otherwise |
85a80aa9 | 158 | |
2bb7b766 | 159 | AliCDBEntry* fStatusEntry; // last CDB entry containing a AliShuttleStatus retrieved |
be48e3ea | 160 | |
cb343cfd | 161 | TMutex* fMonitoringMutex; // mutex to lock the monitoring class members |
162 | UInt_t fLastActionTime; // time of last action for monitoring | |
163 | TString fLastAction; // string description for last action | |
4f0ab988 | 164 | |
be48e3ea | 165 | Bool_t fFirstUnprocessed[AliShuttleInterface::kNDetectors]; // array of flags for first unprocessed dets |
166 | ||
e7f62f16 | 167 | TMonaLisaWriter* fMonaLisa; // ML instance that sends the processing information |
168 | ||
9827400b | 169 | TestMode fTestMode; // sets test mode flags, that e.g. simulate a dcs error etc. |
170 | Bool_t fReadTestMode; // Reads the test mode from the log entry of the given run (only for test) | |
ffa29e93 | 171 | |
172 | Bool_t fOutputRedirected; // is the output redirected to a file | |
b948db8d | 173 | |
73abe331 | 174 | ClassDef(AliShuttle, 0); |
175 | }; | |
176 | ||
177 | #endif |