]> git.uio.no Git - u/mrichter/AliRoot.git/blame - SHUTTLE/AliShuttle.h
AliDCSClient "multiSplit" option added in the DCS configuration
[u/mrichter/AliRoot.git] / SHUTTLE / AliShuttle.h
CommitLineData
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 24class TObject;
73abe331 25class AliShuttleConfig;
2bb7b766 26class AliShuttleLogbookEntry;
b948db8d 27class AliPreprocessor;
57f50b3c 28class TSQLServer;
cb343cfd 29class TMutex;
e7f62f16 30class TMonaLisaWriter;
73abe331 31
b948db8d 32class AliShuttle: public AliShuttleInterface {
73abe331 33public:
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 };
2c15234c 36
b948db8d 37 AliShuttle(const AliShuttleConfig* config, UInt_t timeout = 5000, Int_t retries = 5);
73abe331 38 virtual ~AliShuttle();
39
b948db8d 40 virtual void RegisterPreprocessor(AliPreprocessor* preprocessor);
41
cb343cfd 42 Bool_t Collect(Int_t run = -1);
2bb7b766 43
44 Bool_t Process(AliShuttleLogbookEntry* entry);
73abe331 45
cb343cfd 46 // monitoring functions
47 ULong_t GetTimeOfLastAction() const;
48 const TString GetLastAction() const;
49
2bb7b766 50 Int_t GetCurrentRun() const;
51 UInt_t GetCurrentStartTime() const;
52 UInt_t GetCurrentEndTime() const;
73abe331 53
3301427a 54 virtual Bool_t Store(const AliCDBPath& path, TObject* object, AliCDBMetaData* metaData,
84090f85 55 Int_t validityStart = 0, Bool_t validityInfinite = kFALSE);
3301427a 56 virtual Bool_t StoreReferenceData(const AliCDBPath& path, TObject* object, AliCDBMetaData* metaData);
9827400b 57 virtual Bool_t StoreReferenceFile(const char* detector, const char* localFile, const char* gridFileName);
b948db8d 58 virtual const char* GetFile(Int_t system, const char* detector,
59 const char* id, const char* source);
4a33bdd9 60 virtual TList* GetFileSources(Int_t system, const char* detector, const char* id = 0);
61 virtual TList* GetFileIDs(Int_t system, const char* detector, const char* source);
eba76848 62 virtual const char* GetRunParameter(const char* lbEntry);
9827400b 63 virtual AliCDBEntry* GetFromOCDB(const char* detector, const AliCDBPath& path);
64 virtual const char* GetRunType();
4859271b 65 virtual Bool_t GetHLTStatus();
b948db8d 66 virtual void Log(const char* detector, const char* message);
67
eba76848 68 void SetLogbookEntry(AliShuttleLogbookEntry* entry) {fLogbookEntry=entry;}
9827400b 69
70 void SetTestMode(TestMode testMode) { fTestMode = testMode; }
71 void SetReadTestModeFromLog(Bool_t flag) { fReadTestMode = flag; }
57f50b3c 72
57f50b3c 73 Bool_t Connect(Int_t system);
74
d386d623 75 static void SetMainCDB (TString mainCDB) {fgkMainCDB = mainCDB;}
76 static void SetLocalCDB (TString localCDB) {fgkLocalCDB = localCDB;}
77
78 static void SetMainRefStorage (TString mainRefStorage) {fgkMainRefStorage = mainRefStorage;}
79 static void SetLocalRefStorage (TString localRefStorage) {fgkLocalRefStorage = localRefStorage;}
80
81 static void SetShuttleTempDir (const char* tmpDir);
82 static void SetShuttleLogDir (const char* logDir);
83
73abe331 84private:
57f50b3c 85 AliShuttle(const AliShuttle& other);
86 AliShuttle& operator= (const AliShuttle& other);
87
9827400b 88 Bool_t ProcessCurrentDetector();
2bb7b766 89
eba76848 90 AliShuttleLogbookEntry* QueryRunParameters(Int_t run);
2bb7b766 91 Bool_t QueryShuttleLogbook(const char* whereClause, TObjArray& entries);
92 Bool_t RetrieveConditionsData(const TObjArray& shuttleLogbookEntries);
93
a038aa70 94 TMap* GetValueSet(const char* host, Int_t port, const TSeqCollection* entries,
542b6cc8 95 DCSType type, Int_t valueSet);
57f50b3c 96
9d733021 97 Bool_t RetrieveFile(UInt_t system, const char* daqFileName, const char* localFileName);
98
99 Bool_t UpdateTable();
3301427a 100 Bool_t UpdateTableFailCase();
57f50b3c 101
3301427a 102 Bool_t StoreLocally(const TString& localUri, const AliCDBPath& path, TObject* object,
103 AliCDBMetaData* metaData, Int_t validityStart = 0, Bool_t validityInfinite = kFALSE);
85a80aa9 104
3301427a 105 Bool_t StoreOCDB();
106 Bool_t StoreOCDB(const TString& uri);
9827400b 107 Bool_t StoreRefFilesToGrid();
3301427a 108 void CleanLocalStorage(const TString& uri);
546242fb 109 Bool_t CleanReferenceStorage(const char* detector);
3301427a 110 void RemoveFile(const char* filename);
2d9019b4 111 const char* GetRefFilePrefix(const char* base, const char* detector);
2bb7b766 112
e7f62f16 113 AliShuttleStatus* ReadShuttleStatus();
114 Bool_t WriteShuttleStatus(AliShuttleStatus* status);
115 Bool_t ContinueProcessing();
116 void UpdateShuttleStatus(AliShuttleStatus::Status newStatus, Bool_t increaseCount = kFALSE);
117 Bool_t UpdateShuttleLogbook(const char* detector, const char* status=0);
57c1a579 118 Bool_t SendMail();
ffa29e93 119
120 TString GetLogFileName(const char* detector) const;
57c1a579 121
e7f62f16 122 void SetLastAction(const char* action);
123
124 void SendMLInfo();
b948db8d 125
2bb7b766 126 const AliShuttleConfig* fConfig; // pointer to configuration object
73abe331 127
2bb7b766 128 UInt_t fTimeout; // DCS server connection timeout parameter
129 Int_t fRetries; // Number of DCS server connection retries
5164a766 130
2bb7b766 131 TMap fPreprocessorMap; // list of detector Preprocessors ("DET", "Preprocessor")
57f50b3c 132
2bb7b766 133 AliShuttleLogbookEntry* fLogbookEntry; //! current Shuttle logbook entry
134 TString fCurrentDetector; // current detector
57f50b3c 135
2c15234c 136 TSQLServer *fServer[4]; // pointer to the three FXS + Run & Shuttle logbook servers
137 Bool_t fFXSCalled[3]; // FXS call status
138 TList fFXSlist[3]; // List of files retrieved from each FXS
85a80aa9 139
2bb7b766 140 AliCDBEntry* fStatusEntry; // last CDB entry containing a AliShuttleStatus retrieved
be48e3ea 141
cb343cfd 142 TMutex* fMonitoringMutex; // mutex to lock the monitoring class members
143 UInt_t fLastActionTime; // time of last action for monitoring
144 TString fLastAction; // string description for last action
4f0ab988 145
be48e3ea 146 Bool_t fFirstUnprocessed[AliShuttleInterface::kNDetectors]; // array of flags for first unprocessed dets
147
e7f62f16 148 TMonaLisaWriter* fMonaLisa; // ML instance that sends the processing information
149
9827400b 150 TestMode fTestMode; // sets test mode flags, that e.g. simulate a dcs error etc.
151 Bool_t fReadTestMode; // Reads the test mode from the log entry of the given run (only for test)
ffa29e93 152
153 Bool_t fOutputRedirected; // is the output redirected to a file
b948db8d 154
73abe331 155 ClassDef(AliShuttle, 0);
156};
157
158#endif