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.11 2006/10/02 16:38:39 jgrosseo
21 storing of objects that failed to be stored to the grid before
22 interfacing of shuttle status table in daq system
24 Revision 1.10 2006/08/15 10:50:00 jgrosseo
25 effc++ corrections (alberto)
27 Revision 1.9 2006/08/08 14:19:29 jgrosseo
28 Update to shuttle classes (Alberto)
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.
37 Revision 1.8 2006/07/21 07:37:20 jgrosseo
38 last run is stored after each run
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.
46 Revision 1.6 2006/07/19 10:09:55 jgrosseo
47 new configuration, accesst to DAQ FES (Alberto)
49 Revision 1.5 2006/07/10 13:01:41 jgrosseo
50 enhanced storing of last sucessfully processed run (alberto)
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
55 Revision 1.3 2006/06/12 09:11:16 jgrosseo
56 coding conventions (Alberto)
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)
62 Revision 1.1 2006/03/07 07:52:34 hristov
63 New version (B.Yordanov)
65 Revision 1.5 2005/11/21 09:03:48 byordano
68 Revision 1.4 2005/11/20 10:12:37 byordano
69 comments added to AliShuttleTrigger
75 // This class is to deal with DAQ LogBook and DAQ "end of run" notification.
76 // It has severeal two modes:
77 // 1) synchronized - Collect()
78 // 2) asynchronized - Run() - starts listening for DAQ "end of run"
79 // notification by DIM service.
82 #include "AliShuttleTrigger.h"
87 #include "AliShuttleConfig.h"
88 #include "AliShuttle.h"
89 #include "DATENotifier.h"
91 ClassImp(TerminateSignalHandler)
92 ClassImp(AliShuttleTrigger)
94 //______________________________________________________________________________________________
95 Bool_t TerminateSignalHandler::Notify()
97 // Sentd terminate command to the Shuttle trigger
99 AliInfo("Terminate signal received ...");
100 fTrigger->Terminate();
105 //______________________________________________________________________________________________
106 AliShuttleTrigger::AliShuttleTrigger(const AliShuttleConfig* config,
107 UInt_t timeout, Int_t retries):
108 fConfig(config), fShuttle(NULL),
109 fNotified(kFALSE), fTerminate(kFALSE),
110 fMutex(), fCondition(&fMutex),
111 fQuitSignalHandler(0),
112 fInterruptSignalHandler(0)
115 // config - pointer to the AliShuttleConfig object which represents
117 // mainStorage - pointer to AliCDBStorage for the undelying CDBStorage
118 // localStorage (local) CDB storage to be used if mainStorage is unavailable
121 fShuttle = new AliShuttle(config, timeout, retries);
123 TerminateSignalHandler* fQuitSignalHandler = new TerminateSignalHandler(this, kSigQuit);
124 TerminateSignalHandler* fInterruptSignalHandler = new TerminateSignalHandler(this, kSigInterrupt);
126 gSystem->AddSignalHandler(fQuitSignalHandler);
127 gSystem->AddSignalHandler(fInterruptSignalHandler);
131 //______________________________________________________________________________________________
132 AliShuttleTrigger::~AliShuttleTrigger()
136 gSystem->RemoveSignalHandler(fQuitSignalHandler);
137 gSystem->RemoveSignalHandler(fInterruptSignalHandler);
141 delete fQuitSignalHandler;
142 fQuitSignalHandler = 0;
144 delete fInterruptSignalHandler;
145 fInterruptSignalHandler = 0;
148 //______________________________________________________________________________________________
149 Bool_t AliShuttleTrigger::Notify() {
151 // Trigger Collect() methods in asynchronized (listen) mode.
152 // Usually called automaticly by DATENotifier on "end of run"
153 // notification event.
166 //______________________________________________________________________________________________
167 void AliShuttleTrigger::Terminate() {
169 // Stop triggers listen mode and exist from Run()
170 // Usually called automaticly by TerminateSignalHandler.
177 //______________________________________________________________________________________________
178 void AliShuttleTrigger::Run() {
180 // AliShuttleTrigger main loop for asynchronized (listen) mode.
181 // It spawns DIM service listener and waits for DAQ "end of run"
182 // notification. Calls Collect() on notification.
187 DATENotifier* notifier = new DATENotifier(this, "/DATE/LOGBOOK/UPDATE");
193 while (!(fNotified || fTerminate)) {
202 AliInfo("Terminated.");
212 //______________________________________________________________________________________________
213 Bool_t AliShuttleTrigger::Collect(Int_t run)
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
220 return fShuttle->Collect(run);