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.12 2006/10/20 15:22:59 jgrosseo
19 o) Adding time out to the execution of the preprocessors: The Shuttle forks and the parent process monitors the child
20 o) Merging Collect, CollectAll, CollectNew function
21 o) Removing implementation of empty copy constructors (declaration still there!)
23 Revision 1.11 2006/10/02 16:38:39 jgrosseo
26 storing of objects that failed to be stored to the grid before
27 interfacing of shuttle status table in daq system
29 Revision 1.10 2006/08/15 10:50:00 jgrosseo
30 effc++ corrections (alberto)
32 Revision 1.9 2006/08/08 14:19:29 jgrosseo
33 Update to shuttle classes (Alberto)
35 - Possibility to set the full object's path in the Preprocessor's and
36 Shuttle's Store functions
37 - Possibility to extend the object's run validity in the same classes
38 ("startValidity" and "validityInfinite" parameters)
39 - Implementation of the StoreReferenceData function to store reference
40 data in a dedicated CDB storage.
42 Revision 1.8 2006/07/21 07:37:20 jgrosseo
43 last run is stored after each run
45 Revision 1.7 2006/07/20 09:54:40 jgrosseo
46 introducing status management: The processing per subdetector is divided into several steps,
47 after each step the status is stored on disk. If the system crashes in any of the steps the Shuttle
48 can keep track of the number of failures and skips further processing after a certain threshold is
49 exceeded. These thresholds can be configured in LDAP.
51 Revision 1.6 2006/07/19 10:09:55 jgrosseo
52 new configuration, accesst to DAQ FES (Alberto)
54 Revision 1.5 2006/07/10 13:01:41 jgrosseo
55 enhanced storing of last sucessfully processed run (alberto)
57 Revision 1.4 2006/07/04 14:59:57 jgrosseo
58 revision of AliDCSValue: Removed wrapper classes, reduced storage size per value by factor 2
60 Revision 1.3 2006/06/12 09:11:16 jgrosseo
61 coding conventions (Alberto)
63 Revision 1.2 2006/06/06 14:26:40 jgrosseo
64 o) removed files that were moved to STEER
65 o) shuttle updated to follow the new interface (Alberto)
67 Revision 1.1 2006/03/07 07:52:34 hristov
68 New version (B.Yordanov)
70 Revision 1.5 2005/11/21 09:03:48 byordano
73 Revision 1.4 2005/11/20 10:12:37 byordano
74 comments added to AliShuttleTrigger
80 // This class is to deal with DAQ LogBook and DAQ "end of run" notification.
81 // It has severeal two modes:
82 // 1) synchronized - Collect()
83 // 2) asynchronized - Run() - starts listening for DAQ "end of run"
84 // notification by DIM service.
87 #include "AliShuttleTrigger.h"
92 #include "AliShuttleConfig.h"
93 #include "AliShuttle.h"
94 #include "DATENotifier.h"
96 ClassImp(TerminateSignalHandler)
97 ClassImp(AliShuttleTrigger)
99 //______________________________________________________________________________________________
100 Bool_t TerminateSignalHandler::Notify()
102 // Sentd terminate command to the Shuttle trigger
104 AliInfo("Terminate signal received ...");
105 fTrigger->Terminate();
110 //______________________________________________________________________________________________
111 AliShuttleTrigger::AliShuttleTrigger(const AliShuttleConfig* config,
112 UInt_t timeout, Int_t retries):
113 fConfig(config), fShuttle(NULL),
114 fNotified(kFALSE), fTerminate(kFALSE),
115 fMutex(), fCondition(&fMutex),
116 fQuitSignalHandler(0),
117 fInterruptSignalHandler(0)
120 // config - pointer to the AliShuttleConfig object which represents
122 // mainStorage - pointer to AliCDBStorage for the undelying CDBStorage
123 // localStorage (local) CDB storage to be used if mainStorage is unavailable
126 fShuttle = new AliShuttle(config, timeout, retries);
128 TerminateSignalHandler* fQuitSignalHandler = new TerminateSignalHandler(this, kSigQuit);
129 TerminateSignalHandler* fInterruptSignalHandler = new TerminateSignalHandler(this, kSigInterrupt);
131 gSystem->AddSignalHandler(fQuitSignalHandler);
132 gSystem->AddSignalHandler(fInterruptSignalHandler);
136 //______________________________________________________________________________________________
137 AliShuttleTrigger::~AliShuttleTrigger()
141 gSystem->RemoveSignalHandler(fQuitSignalHandler);
142 gSystem->RemoveSignalHandler(fInterruptSignalHandler);
146 delete fQuitSignalHandler;
147 fQuitSignalHandler = 0;
149 delete fInterruptSignalHandler;
150 fInterruptSignalHandler = 0;
153 //______________________________________________________________________________________________
154 Bool_t AliShuttleTrigger::Notify() {
156 // Trigger Collect() methods in asynchronized (listen) mode.
157 // Usually called automaticly by DATENotifier on "end of run"
158 // notification event.
171 //______________________________________________________________________________________________
172 void AliShuttleTrigger::Terminate() {
174 // Stop triggers listen mode and exist from Run()
175 // Usually called automaticly by TerminateSignalHandler.
182 //______________________________________________________________________________________________
183 void AliShuttleTrigger::Run() {
185 // AliShuttleTrigger main loop for asynchronized (listen) mode.
186 // It spawns DIM service listener and waits for DAQ "end of run"
187 // notification. Calls Collect() on notification.
192 DATENotifier* notifier = new DATENotifier(this, "/DATE/LOGBOOK/UPDATE");
198 while (!(fNotified || fTerminate)) {
207 AliInfo("Terminated.");
217 //______________________________________________________________________________________________
218 Bool_t AliShuttleTrigger::Collect(Int_t run)
221 // this function creates a thread that runs the shuttle
222 // then it checks if the shuttle is still running by checking the monitoring functions of the shuttle
225 return fShuttle->Collect(run);