/*
$Log$
+ Revision 1.15 2007/12/10 18:29:23 acolla
+ Some log added to the listen mode
+
+ Revision 1.14 2007/12/07 19:14:36 acolla
+ in AliShuttleTrigger:
+
+ Added automatic collection of new runs on a regular time basis (settable from the configuration)
+
+ in AliShuttleConfig: new members
+
+ - triggerWait: time to wait for DIM trigger (s) before starting automatic collection of new runs
+ - mode: run mode (test, prod) -> used to build log folder (logs or logs_PROD)
+
+ in AliShuttle:
+
+ - logs now stored in logs/#RUN/DET_#RUN.log
+
+ Revision 1.13 2006/11/16 16:16:48 jgrosseo
+ introducing strict run ordering flag
+ removed giving preprocessor name to preprocessor, they have to know their name themselves ;-)
+
Revision 1.12 2006/10/20 15:22:59 jgrosseo
o) Adding time out to the execution of the preprocessors: The Shuttle forks and the parent process monitors the child
o) Merging Collect, CollectAll, CollectNew function
}
//______________________________________________________________________________________________
-AliShuttleTrigger::AliShuttleTrigger(const AliShuttleConfig* config,
- UInt_t timeout, Int_t retries):
+AliShuttleTrigger::AliShuttleTrigger(const AliShuttleConfig* config):
fConfig(config), fShuttle(NULL),
fNotified(kFALSE), fTerminate(kFALSE),
fMutex(), fCondition(&fMutex),
// localStorage (local) CDB storage to be used if mainStorage is unavailable
//
+ if (!fConfig->IsValid()) AliFatal("********** !!!!! Invalid configuration !!!!! **********");
+ UInt_t timeout = fConfig->GetDCSTimeOut();
+ Int_t retries = fConfig->GetDCSRetries();
fShuttle = new AliShuttle(config, timeout, retries);
- TerminateSignalHandler* fQuitSignalHandler = new TerminateSignalHandler(this, kSigQuit);
- TerminateSignalHandler* fInterruptSignalHandler = new TerminateSignalHandler(this, kSigInterrupt);
+ fQuitSignalHandler = new TerminateSignalHandler(this, kSigQuit);
+ fInterruptSignalHandler = new TerminateSignalHandler(this, kSigInterrupt);
gSystem->AddSignalHandler(fQuitSignalHandler);
gSystem->AddSignalHandler(fInterruptSignalHandler);
fTerminate = kFALSE;
- DATENotifier* notifier = new DATENotifier(this, "/DATE/LOGBOOK/UPDATE");
+ DATENotifier* notifier = new DATENotifier(this, "/LOGBOOK/SUBSCRIBE/ECS_EOR");
+ Int_t nTry=0;
+ Int_t nMaxTry = fConfig->GetMaxRetries()+1;
+ Int_t received=0;
+
+ AliInfo("Listening for ECS trigger");
+
while (1) {
fMutex.Lock();
while (!(fNotified || fTerminate)) {
- fCondition.Wait();
+ received=fCondition.TimedWaitRelative(1000*fConfig->GetTriggerWait());
+ if (received==1) break; // 1 = timeout
}
fNotified = kFALSE;
AliInfo("Terminated.");
break;
}
+
+ if (received == 0)
+ {
+ AliInfo("Trigger from ECS received!");
+ } else if (received == 1) {
+ AliInfo(Form("Timeout (%d s) waiting for trigger. "
+ "Starting collection of new runs!",
+ fConfig->GetTriggerWait()));
+ } else {
+ AliInfo("Error receiving trigger from ECS!");
+ break;
+ }
+
+ nTry++;
+ AliInfo(Form("Received %d triggers so far", nTry));
+
+ if (fConfig->GetRunMode() == AliShuttleConfig::kTest)
+ {
+ if(nTry>=nMaxTry)
+ {
+ AliInfo(Form("Collect() ran more than %d times -> Exiting!",
+ nMaxTry));
+ break;
+ }
+ }
Collect();
}