]> git.uio.no Git - u/mrichter/AliRoot.git/blame - SHUTTLE/AliShuttleTrigger.cxx
Adding the AliFileListFrame class: the file list frame of the GUI.
[u/mrichter/AliRoot.git] / SHUTTLE / AliShuttleTrigger.cxx
CommitLineData
d477ad88 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16/*
17 $Log$
cb343cfd 18 Revision 1.11 2006/10/02 16:38:39 jgrosseo
19 update (alberto):
20 fixed memory leaks
21 storing of objects that failed to be stored to the grid before
22 interfacing of shuttle status table in daq system
23
2bb7b766 24 Revision 1.10 2006/08/15 10:50:00 jgrosseo
25 effc++ corrections (alberto)
26
4f0ab988 27 Revision 1.9 2006/08/08 14:19:29 jgrosseo
28 Update to shuttle classes (Alberto)
29
30 - Possibility to set the full object's path in the Preprocessor's and
31 Shuttle's Store functions
32 - Possibility to extend the object's run validity in the same classes
33 ("startValidity" and "validityInfinite" parameters)
34 - Implementation of the StoreReferenceData function to store reference
35 data in a dedicated CDB storage.
36
84090f85 37 Revision 1.8 2006/07/21 07:37:20 jgrosseo
38 last run is stored after each run
39
7bfb2090 40 Revision 1.7 2006/07/20 09:54:40 jgrosseo
41 introducing status management: The processing per subdetector is divided into several steps,
42 after each step the status is stored on disk. If the system crashes in any of the steps the Shuttle
43 can keep track of the number of failures and skips further processing after a certain threshold is
44 exceeded. These thresholds can be configured in LDAP.
45
5164a766 46 Revision 1.6 2006/07/19 10:09:55 jgrosseo
47 new configuration, accesst to DAQ FES (Alberto)
48
57f50b3c 49 Revision 1.5 2006/07/10 13:01:41 jgrosseo
50 enhanced storing of last sucessfully processed run (alberto)
51
a7160fe9 52 Revision 1.4 2006/07/04 14:59:57 jgrosseo
53 revision of AliDCSValue: Removed wrapper classes, reduced storage size per value by factor 2
54
45a493ce 55 Revision 1.3 2006/06/12 09:11:16 jgrosseo
56 coding conventions (Alberto)
57
58bc3020 58 Revision 1.2 2006/06/06 14:26:40 jgrosseo
59 o) removed files that were moved to STEER
60 o) shuttle updated to follow the new interface (Alberto)
61
b948db8d 62 Revision 1.1 2006/03/07 07:52:34 hristov
63 New version (B.Yordanov)
64
d477ad88 65 Revision 1.5 2005/11/21 09:03:48 byordano
66 one more print added
67
68 Revision 1.4 2005/11/20 10:12:37 byordano
69 comments added to AliShuttleTrigger
70
71 */
72
73
74//
75// This class is to deal with DAQ LogBook and DAQ "end of run" notification.
76// It has severeal two modes:
cb343cfd 77// 1) synchronized - Collect()
b948db8d 78// 2) asynchronized - Run() - starts listening for DAQ "end of run"
d477ad88 79// notification by DIM service.
80//
81
82#include "AliShuttleTrigger.h"
83
d477ad88 84#include <TSystem.h>
cb343cfd 85
d477ad88 86#include "AliLog.h"
d477ad88 87#include "AliShuttleConfig.h"
88#include "AliShuttle.h"
89#include "DATENotifier.h"
90
91ClassImp(TerminateSignalHandler)
cb343cfd 92ClassImp(AliShuttleTrigger)
58bc3020 93
b948db8d 94//______________________________________________________________________________________________
cb343cfd 95Bool_t TerminateSignalHandler::Notify()
58bc3020 96{
97// Sentd terminate command to the Shuttle trigger
d477ad88 98
99 AliInfo("Terminate signal received ...");
100 fTrigger->Terminate();
101
102 return kTRUE;
103}
104
b948db8d 105//______________________________________________________________________________________________
d477ad88 106AliShuttleTrigger::AliShuttleTrigger(const AliShuttleConfig* config,
b948db8d 107 UInt_t timeout, Int_t retries):
108 fConfig(config), fShuttle(NULL),
2bb7b766 109 fNotified(kFALSE), fTerminate(kFALSE),
4f0ab988 110 fMutex(), fCondition(&fMutex),
cb343cfd 111 fQuitSignalHandler(0),
112 fInterruptSignalHandler(0)
d477ad88 113{
114 //
115 // config - pointer to the AliShuttleConfig object which represents
116 // the configuration
b948db8d 117 // mainStorage - pointer to AliCDBStorage for the undelying CDBStorage
118 // localStorage (local) CDB storage to be used if mainStorage is unavailable
d477ad88 119 //
120
b948db8d 121 fShuttle = new AliShuttle(config, timeout, retries);
d477ad88 122
cb343cfd 123 TerminateSignalHandler* fQuitSignalHandler = new TerminateSignalHandler(this, kSigQuit);
124 TerminateSignalHandler* fInterruptSignalHandler = new TerminateSignalHandler(this, kSigInterrupt);
58bc3020 125
cb343cfd 126 gSystem->AddSignalHandler(fQuitSignalHandler);
127 gSystem->AddSignalHandler(fInterruptSignalHandler);
58bc3020 128
129}
130
b948db8d 131//______________________________________________________________________________________________
58bc3020 132AliShuttleTrigger::~AliShuttleTrigger()
133{
cb343cfd 134 // destructor
d477ad88 135
cb343cfd 136 gSystem->RemoveSignalHandler(fQuitSignalHandler);
137 gSystem->RemoveSignalHandler(fInterruptSignalHandler);
d477ad88 138
139 delete fShuttle;
cb343cfd 140
141 delete fQuitSignalHandler;
142 fQuitSignalHandler = 0;
143
144 delete fInterruptSignalHandler;
145 fInterruptSignalHandler = 0;
d477ad88 146}
147
b948db8d 148//______________________________________________________________________________________________
d477ad88 149Bool_t AliShuttleTrigger::Notify() {
150 //
cb343cfd 151 // Trigger Collect() methods in asynchronized (listen) mode.
d477ad88 152 // Usually called automaticly by DATENotifier on "end of run"
153 // notification event.
154 //
155
156 fMutex.Lock();
157
158 fNotified = kTRUE;
159 fCondition.Signal();
160
161 fMutex.UnLock();
162
163 return kTRUE;
164}
165
b948db8d 166//______________________________________________________________________________________________
d477ad88 167void AliShuttleTrigger::Terminate() {
168 //
169 // Stop triggers listen mode and exist from Run()
170 // Usually called automaticly by TerminateSignalHandler.
171 //
172
173 fTerminate = kTRUE;
174 fCondition.Signal();
175}
176
b948db8d 177//______________________________________________________________________________________________
d477ad88 178void AliShuttleTrigger::Run() {
179 //
180 // AliShuttleTrigger main loop for asynchronized (listen) mode.
181 // It spawns DIM service listener and waits for DAQ "end of run"
cb343cfd 182 // notification. Calls Collect() on notification.
d477ad88 183 //
184
185 fTerminate = kFALSE;
186
187 DATENotifier* notifier = new DATENotifier(this, "/DATE/LOGBOOK/UPDATE");
188
189 while (1) {
190
191 fMutex.Lock();
192
193 while (!(fNotified || fTerminate)) {
194 fCondition.Wait();
195 }
196
197 fNotified = kFALSE;
198
199 fMutex.UnLock();
200
201 if (fTerminate) {
202 AliInfo("Terminated.");
203 break;
204 }
205
cb343cfd 206 Collect();
d477ad88 207 }
208
209 delete notifier;
210}
211
b948db8d 212//______________________________________________________________________________________________
a7160fe9 213Bool_t AliShuttleTrigger::Collect(Int_t run)
58bc3020 214{
d477ad88 215 //
cb343cfd 216 // this function creates a thread that runs the shuttle
217 // then it checks if the shuttle is still running by checking the monitoring functions of the shuttle
d477ad88 218 //
219
cb343cfd 220 return fShuttle->Collect(run);
d477ad88 221}