Function GetFromOCDB added to AliShuttle and AliTestShuttle.
[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;
73abe331 28class AliCDBMetaData;
57f50b3c 29class TSQLServer;
5164a766 30class AliCDBEntry;
84090f85 31class AliCDBPath;
cb343cfd 32class TMutex;
e7f62f16 33class TMonaLisaWriter;
73abe331 34
b948db8d 35class AliShuttle: public AliShuttleInterface {
73abe331 36public:
2c15234c 37 enum DCSType {kAlias=0, kDP};
38
b948db8d 39 AliShuttle(const AliShuttleConfig* config, UInt_t timeout = 5000, Int_t retries = 5);
73abe331 40 virtual ~AliShuttle();
41
b948db8d 42 virtual void RegisterPreprocessor(AliPreprocessor* preprocessor);
43
cb343cfd 44 Bool_t Collect(Int_t run = -1);
2bb7b766 45
46 Bool_t Process(AliShuttleLogbookEntry* entry);
73abe331 47
cb343cfd 48 // monitoring functions
49 ULong_t GetTimeOfLastAction() const;
50 const TString GetLastAction() const;
51
2bb7b766 52 Int_t GetCurrentRun() const;
53 UInt_t GetCurrentStartTime() const;
54 UInt_t GetCurrentEndTime() const;
73abe331 55
84090f85 56 virtual UInt_t Store(const AliCDBPath& path, TObject* object, AliCDBMetaData* metaData,
57 Int_t validityStart = 0, Bool_t validityInfinite = kFALSE);
481441a2 58 virtual UInt_t StoreReferenceData(const AliCDBPath& path, TObject* object, AliCDBMetaData* metaData);
b948db8d 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);
eba76848 62 virtual const char* GetRunParameter(const char* lbEntry);
b948db8d 63 virtual void Log(const char* detector, const char* message);
64
4f0ab988 65 //TODO Test only, remove later !
2bb7b766 66 void SetProcessDCS(Bool_t process) {fgkProcessDCS = process;}
eba76848 67 void SetLogbookEntry(AliShuttleLogbookEntry* entry) {fLogbookEntry=entry;}
57f50b3c 68
57f50b3c 69 Bool_t Connect(Int_t system);
70
73abe331 71private:
57f50b3c 72 AliShuttle(const AliShuttle& other);
73 AliShuttle& operator= (const AliShuttle& other);
74
2bb7b766 75 UInt_t ProcessCurrentDetector();
76
eba76848 77 AliShuttleLogbookEntry* QueryRunParameters(Int_t run);
2bb7b766 78 Bool_t QueryShuttleLogbook(const char* whereClause, TObjArray& entries);
79 Bool_t RetrieveConditionsData(const TObjArray& shuttleLogbookEntries);
80
2c15234c 81 Bool_t GetValueSet(const char* host, Int_t port, const char* alias,
82 TObjArray* result, DCSType type);
57f50b3c 83
9d733021 84 Bool_t RetrieveFile(UInt_t system, const char* daqFileName, const char* localFileName);
85
86 Bool_t UpdateTable();
57f50b3c 87
85a80aa9 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
2bb7b766 92 Bool_t TryToStoreAgain();
93 Bool_t TryToStoreAgain(TString& storageType);
94
e7f62f16 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);
57c1a579 100 Bool_t SendMail();
101
e7f62f16 102 void SetLastAction(const char* action);
103
104 void SendMLInfo();
b948db8d 105
2bb7b766 106 const AliShuttleConfig* fConfig; // pointer to configuration object
73abe331 107
2bb7b766 108 UInt_t fTimeout; // DCS server connection timeout parameter
109 Int_t fRetries; // Number of DCS server connection retries
5164a766 110
2bb7b766 111 TMap fPreprocessorMap; // list of detector Preprocessors ("DET", "Preprocessor")
57f50b3c 112
2bb7b766 113 AliShuttleLogbookEntry* fLogbookEntry; //! current Shuttle logbook entry
114 TString fCurrentDetector; // current detector
57f50b3c 115
2c15234c 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
85a80aa9 119
2bb7b766 120 AliCDBEntry* fStatusEntry; // last CDB entry containing a AliShuttleStatus retrieved
121 Bool_t fGridError; // Grid storage error flag
be48e3ea 122
cb343cfd 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
4f0ab988 126
be48e3ea 127 Bool_t fFirstUnprocessed[AliShuttleInterface::kNDetectors]; // array of flags for first unprocessed dets
128
e7f62f16 129 TMonaLisaWriter* fMonaLisa; // ML instance that sends the processing information
130
4f0ab988 131 //TODO Test only, remove later !
132 static Bool_t fgkProcessDCS; // flag to enable DCS archive data processing
b948db8d 133
73abe331 134 ClassDef(AliShuttle, 0);
135};
136
137#endif