1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 Revision 1.13 2006/11/16 16:16:48 jgrosseo
19 introducing strict run ordering flag
20 removed giving preprocessor name to preprocessor, they have to know their name themselves ;-)
22 Revision 1.12 2006/10/20 15:22:59 jgrosseo
23 o) Adding time out to the execution of the preprocessors: The Shuttle forks and the parent process monitors the child
24 o) Merging Collect, CollectAll, CollectNew function
25 o) Removing implementation of empty copy constructors (declaration still there!)
27 Revision 1.11 2006/10/02 16:38:39 jgrosseo
30 storing of objects that failed to be stored to the grid before
31 interfacing of shuttle status table in daq system
33 Revision 1.10 2006/08/15 10:50:00 jgrosseo
34 effc++ corrections (alberto)
36 Revision 1.9 2006/08/08 14:19:29 jgrosseo
37 Update to shuttle classes (Alberto)
39 - Possibility to set the full object's path in the Preprocessor's and
40 Shuttle's Store functions
41 - Possibility to extend the object's run validity in the same classes
42 ("startValidity" and "validityInfinite" parameters)
43 - Implementation of the StoreReferenceData function to store reference
44 data in a dedicated CDB storage.
46 Revision 1.8 2006/07/21 07:37:20 jgrosseo
47 last run is stored after each run
49 Revision 1.7 2006/07/20 09:54:40 jgrosseo
50 introducing status management: The processing per subdetector is divided into several steps,
51 after each step the status is stored on disk. If the system crashes in any of the steps the Shuttle
52 can keep track of the number of failures and skips further processing after a certain threshold is
53 exceeded. These thresholds can be configured in LDAP.
55 Revision 1.6 2006/07/19 10:09:55 jgrosseo
56 new configuration, accesst to DAQ FES (Alberto)
58 Revision 1.5 2006/07/10 13:01:41 jgrosseo
59 enhanced storing of last sucessfully processed run (alberto)
61 Revision 1.4 2006/07/04 14:59:57 jgrosseo
62 revision of AliDCSValue: Removed wrapper classes, reduced storage size per value by factor 2
64 Revision 1.3 2006/06/12 09:11:16 jgrosseo
65 coding conventions (Alberto)
67 Revision 1.2 2006/06/06 14:26:40 jgrosseo
68 o) removed files that were moved to STEER
69 o) shuttle updated to follow the new interface (Alberto)
71 Revision 1.1 2006/03/07 07:52:34 hristov
72 New version (B.Yordanov)
74 Revision 1.5 2005/11/21 09:03:48 byordano
77 Revision 1.4 2005/11/20 10:12:37 byordano
78 comments added to AliShuttleTrigger
84 // This class is to deal with DAQ LogBook and DAQ "end of run" notification.
85 // It has severeal two modes:
86 // 1) synchronized - Collect()
87 // 2) asynchronized - Run() - starts listening for DAQ "end of run"
88 // notification by DIM service.
91 #include "AliShuttleTrigger.h"
96 #include "AliShuttleConfig.h"
97 #include "AliShuttle.h"
98 #include "DATENotifier.h"
100 ClassImp(TerminateSignalHandler)
101 ClassImp(AliShuttleTrigger)
103 //______________________________________________________________________________________________
104 Bool_t TerminateSignalHandler::Notify()
106 // Sentd terminate command to the Shuttle trigger
108 AliInfo("Terminate signal received ...");
109 fTrigger->Terminate();
114 //______________________________________________________________________________________________
115 AliShuttleTrigger::AliShuttleTrigger(const AliShuttleConfig* config,
116 UInt_t timeout, Int_t retries):
117 fConfig(config), fShuttle(NULL),
118 fNotified(kFALSE), fTerminate(kFALSE),
119 fMutex(), fCondition(&fMutex),
120 fQuitSignalHandler(0),
121 fInterruptSignalHandler(0)
124 // config - pointer to the AliShuttleConfig object which represents
126 // mainStorage - pointer to AliCDBStorage for the undelying CDBStorage
127 // localStorage (local) CDB storage to be used if mainStorage is unavailable
130 if (!fConfig->IsValid()) AliFatal("********** !!!!! Invalid configuration !!!!! **********");
131 fShuttle = new AliShuttle(config, timeout, retries);
133 TerminateSignalHandler* fQuitSignalHandler = new TerminateSignalHandler(this, kSigQuit);
134 TerminateSignalHandler* fInterruptSignalHandler = new TerminateSignalHandler(this, kSigInterrupt);
136 gSystem->AddSignalHandler(fQuitSignalHandler);
137 gSystem->AddSignalHandler(fInterruptSignalHandler);
141 //______________________________________________________________________________________________
142 AliShuttleTrigger::~AliShuttleTrigger()
146 gSystem->RemoveSignalHandler(fQuitSignalHandler);
147 gSystem->RemoveSignalHandler(fInterruptSignalHandler);
151 delete fQuitSignalHandler;
152 fQuitSignalHandler = 0;
154 delete fInterruptSignalHandler;
155 fInterruptSignalHandler = 0;
158 //______________________________________________________________________________________________
159 Bool_t AliShuttleTrigger::Notify() {
161 // Trigger Collect() methods in asynchronized (listen) mode.
162 // Usually called automaticly by DATENotifier on "end of run"
163 // notification event.
176 //______________________________________________________________________________________________
177 void AliShuttleTrigger::Terminate() {
179 // Stop triggers listen mode and exist from Run()
180 // Usually called automaticly by TerminateSignalHandler.
187 //______________________________________________________________________________________________
188 void AliShuttleTrigger::Run() {
190 // AliShuttleTrigger main loop for asynchronized (listen) mode.
191 // It spawns DIM service listener and waits for DAQ "end of run"
192 // notification. Calls Collect() on notification.
197 DATENotifier* notifier = new DATENotifier(this, "/DATE/LOGBOOK/UPDATE");
205 while (!(fNotified || fTerminate)) {
206 if (fCondition.TimedWaitRelative(1000*fConfig->GetTriggerWait()) == 1)
207 break; // 1 = timeout
215 AliInfo("Terminated.");
221 //AliInfo(Form("Received %d triggers so far", nTry));
224 // AliInfo("Collect() ran more than 5 times -> Exiting!");
234 //______________________________________________________________________________________________
235 Bool_t AliShuttleTrigger::Collect(Int_t run)
238 // this function creates a thread that runs the shuttle
239 // then it checks if the shuttle is still running by checking the monitoring functions of the shuttle
242 return fShuttle->Collect(run);