/*
$Log$
+Revision 1.17 2006/10/05 16:20:55 jgrosseo
+adapting to new CDB classes
+
Revision 1.16 2006/10/05 15:46:26 jgrosseo
applying to the new interface
#include <TSQLServer.h>
#include <TSQLResult.h>
#include <TSQLRow.h>
+#include <TMutex.h>
#include <fstream>
+#include <sys/types.h>
+#include <sys/wait.h>
+
ClassImp(AliShuttle)
TString AliShuttle::fgkMainCDB("alien://folder=ShuttleCDB");
fLogbookEntry(0),
fCurrentDetector(""),
fStatusEntry(0),
-fGridError(kFALSE)
+fGridError(kFALSE),
+fMonitoringMutex(0),
+fLastActionTime(0)
{
//
// config: AliShuttleConfig used
fFESlist[iSys].SetOwner(kTRUE);
}
fPreprocessorMap.SetOwner(kTRUE);
-}
-
-//______________________________________________________________________
-AliShuttle::AliShuttle(const AliShuttle& /*other*/):
-AliShuttleInterface(),
-fConfig(0),
-fTimeout(0), fRetries(0),
-fPreprocessorMap(),
-fLogbookEntry(0),
-fCurrentDetector(""),
-fStatusEntry(0),
-fGridError(kFALSE)
-{
-// copy constructor (not implemented)
-
-}
-
-//______________________________________________________________________
-AliShuttle &AliShuttle::operator=(const AliShuttle& /*other*/)
-{
-// assignment operator (not implemented)
-
-return *this;
+
+ fMonitoringMutex = new TMutex();
}
//______________________________________________________________________________________________
if(fServer[iSys]) {
fServer[iSys]->Close();
delete fServer[iSys];
+ fServer[iSys] = 0;
}
if (fStatusEntry){
delete fStatusEntry;
fStatusEntry = 0;
}
+
+ if (fMonitoringMutex)
+ {
+ delete fMonitoringMutex;
+ fMonitoringMutex = 0;
+ }
}
//______________________________________________________________________________________________
return;
}
- Log("SHUTTLE", Form("UpdateShuttleStatus - %s: Changing state from %s to %s", fCurrentDetector.Data(),
- status->GetStatusName(), status->GetStatusName(newStatus)));
+ TString actionStr;
+ actionStr.Form("UpdateShuttleStatus - %s: Changing state from %s to %s", fCurrentDetector.Data(),
+ status->GetStatusName(), status->GetStatusName(newStatus));
+ Log("SHUTTLE", actionStr);
+ SetLastAction(actionStr);
status->SetStatus(newStatus);
if (increaseCount) status->IncreaseCount();
// abort conditions
// TODO we should add two counters, one for PP and one for DCS!
- if ((status->GetStatus() == AliShuttleStatus::kPPStarted ||
- status->GetStatus() == AliShuttleStatus::kPPError) &&
- (status->GetCount() >= fConfig->GetMaxPPRetries() ||
- status->GetCount() >= fConfig->GetMaxRetries())) {
+ if (status->GetCount() >= fConfig->GetMaxRetries()) {
Log("SHUTTLE",
Form("ContinueProcessing - %s failed %d times in status %s - Updating Shuttle Logbook",
fCurrentDetector.Data(),
fCurrentDetector.Data(),
status->GetStatusName(), status->GetCount()));
- UpdateShuttleStatus(AliShuttleStatus::kStarted);
+ UpdateShuttleStatus(AliShuttleStatus::kStarted, kTRUE);
return kTRUE;
}
AliPreprocessor* aPreprocessor =
dynamic_cast<AliPreprocessor*> (fPreprocessorMap.GetValue(fCurrentDetector));
if(!aPreprocessor){
- Log("SHUTTLE",Form("Process - %s: no preprocessor registered. Skipping"));
+ Log("SHUTTLE",Form("Process: no preprocessor registered. Skipping %s", fCurrentDetector.Data()));
continue;
}
AliInfo(Form("\n\n \t\t\t****** run %d - %s: START ******",
GetCurrentRun(), aDetector->GetName()));
- UInt_t result = ProcessCurrentDetector();
- if(!result) {
- hasError = kTRUE;
- AliInfo(Form("\n \t\t\t****** run %d - %s: PREPROCESSOR ERROR ****** \n\n",
- GetCurrentRun(), aDetector->GetName()));
- continue;
- }
+ Int_t pid = fork();
- if(result == 2) {
- AliInfo(Form("\n \t\t\t****** run %d - %s: STORAGE ERROR ****** \n\n",
- GetCurrentRun(), aDetector->GetName()));
- } else {
- AliInfo(Form("\n \t\t\t****** run %d - %s: DONE ****** \n\n",
- GetCurrentRun(), aDetector->GetName()));
- }
+ if (pid < 0)
+ {
+ Log("SHUTTLE", "ERROR: Forking failed");
+ }
+ else if (pid > 0)
+ {
+ // parent
+ AliInfo(Form("In parent process of %d - %s: Starting monitoring", GetCurrentRun(), aDetector->GetName()));
- // Process successful: Update time_processed field in FES logbooks!
- if(fFESCalled[kDAQ]) {
- hasError = (UpdateDAQTable() == kFALSE);
- fFESlist[kDAQ].Clear();
- }
- //if(fFESCalled[kDCS]) {
- // hasError = UpdateDCSTable(aDetector->GetName());
- // fFESlist[kDCS].Clear();
- //}
- //if(fFESCalled[kHLT]) {
- // hasError = UpdateHLTTable(aDetector->GetName());
- // fFESlist[kHLT].Clear();
- //}
+ Long_t begin = time(0);
+
+ int status; // to be used with waitpid, on purpose an int (not Int_t)!
+ while (waitpid(pid, &status, WNOHANG) == 0)
+ {
+ Long_t expiredTime = time(0) - begin;
+
+ if (expiredTime > fConfig->GetPPTimeOut())
+ {
+ Log("SHUTTLE", Form("Process time out. Run time: %d seconds. Killing...", expiredTime));
+ kill(pid, 9);
+
+ hasError = kTRUE;
+
+ gSystem->Sleep(1000);
+ }
+ else
+ {
+ if (expiredTime % 60 == 0)
+ Log("SHUTTLE", Form("Checked process. Run time: %d seconds.", expiredTime));
+
+ gSystem->Sleep(1000);
+ }
+ }
+
+ AliInfo(Form("In parent process of %d - %s: Client has terminated.", GetCurrentRun(), aDetector->GetName()));
+
+ if (WIFEXITED(status))
+ {
+ Int_t returnCode = WEXITSTATUS(status);
+
+ Log("SHUTTLE", Form("The return code is %d", returnCode));
+
+ if (returnCode != 0)
+ hasError = kTRUE;
+ }
+ }
+ else if (pid == 0)
+ {
+ // client
+ AliInfo(Form("In client process of %d - %s", GetCurrentRun(), aDetector->GetName()));
+
+ UInt_t result = ProcessCurrentDetector();
+
+ Int_t returnCode = 0; // will be set to 1 in case of an error
+
+ if (!result) {
+ returnCode = 1;
+ AliInfo(Form("\n \t\t\t****** run %d - %s: PREPROCESSOR ERROR ****** \n\n",
+ GetCurrentRun(), aDetector->GetName()));
+ }
+ else if(result == 2) {
+ AliInfo(Form("\n \t\t\t****** run %d - %s: STORAGE ERROR ****** \n\n",
+ GetCurrentRun(), aDetector->GetName()));
+ } else {
+ AliInfo(Form("\n \t\t\t****** run %d - %s: DONE ****** \n\n",
+ GetCurrentRun(), aDetector->GetName()));
+ }
+
+ if (result > 0)
+ {
+ // Process successful: Update time_processed field in FES logbooks!
+ if(fFESCalled[kDAQ]) {
+ if (UpdateDAQTable() == kFALSE)
+ returnCode = 1;
+ fFESlist[kDAQ].Clear();
+ }
+ //if(fFESCalled[kDCS]) {
+ // if (UpdateDCSTable(aDetector->GetName()) == kFALSE)
+ // returnCode = 1;
+ // fFESlist[kDCS].Clear();
+ //}
+ //if(fFESCalled[kHLT]) {
+ // if (UpdateHLTTable(aDetector->GetName()) == kFALSE)
+ // returnCode = 1;
+ // fFESlist[kHLT].Clear();
+ //}
+ }
+
+ AliInfo(Form("Client process of %d - %s is exiting now with %d.", GetCurrentRun(), aDetector->GetName(), returnCode));
+
+ // the client exits here
+ gSystem->Exit(returnCode);
+
+ AliError("We should never get here!!!");
+ }
}
AliInfo(Form("\n\n \t\t\t^*^*^*^*^*^*^*^*^*^*^*^* run %d: FINISH ^*^*^*^*^*^*^*^*^*^*^*^* \n",
dynamic_cast<AliPreprocessor*> (fPreprocessorMap.GetValue(fCurrentDetector));
aPreprocessor->Initialize(GetCurrentRun(), GetCurrentStartTime(), GetCurrentEndTime());
-
UInt_t aPPResult = aPreprocessor->Process(&aliasMap);
UInt_t returnValue = 0;
if (aPPResult == 0) { // Preprocessor error
- UpdateShuttleStatus(AliShuttleStatus::kPPError, kTRUE);
+ UpdateShuttleStatus(AliShuttleStatus::kPPError);
returnValue = 0;
} else if (fGridError == kFALSE) { // process and Grid storage ok!
UpdateShuttleStatus(AliShuttleStatus::kDone);
gSystem->FreeDirectory(dir);
}
- TString toLog = Form("%s: %s - ", TTimeStamp(time(0)).AsString("s"), detector);
+ TString toLog = Form("%s (%d): %s - ", TTimeStamp(time(0)).AsString("s"), getpid(), detector);
if(GetCurrentRun()>=0 ) toLog += Form("run %d - ", GetCurrentRun());
toLog += Form("%s", message);
logFile.close();
}
-
//______________________________________________________________________________________________
Bool_t AliShuttle::Collect(Int_t run)
{
//
- // Collects conditions data for the given run.
- //
-
- AliInfo(Form("Collecting conditions data for run %d", run));
-
- TString whereClause("where run=");
- whereClause += run;
-
- TObjArray dateEntries;
- if (!QueryShuttleLogbook(whereClause, dateEntries)) {
- AliError("Can't retrieve entries from Shuttle logbook!");
- return kFALSE;
- }
-
- if (!dateEntries.GetEntriesFast()) {
- AliError(Form("Retrieval of parameters for run %d failed!", run));
- return kFALSE;
- }
-
- if (dateEntries.GetEntriesFast() > 1) {
- AliError(Form("There is more than one entry for run <%d> in Shuttle logbook!", run));
- return kFALSE;
- }
-
- if (!RetrieveConditionsData(dateEntries)) {
- AliError("An error occured during conditions data retrieval!");
- return kFALSE;
- }
-
- return kTRUE;
-}
-
-//______________________________________________________________________________________________
-Bool_t AliShuttle::CollectNew()
-{
- //
- // Collects conditions data for all UNPROCESSED run written to DAQ LogBook.
+ // Collects conditions data for all UNPROCESSED run written to DAQ LogBook in case of run = -1 (default)
+ // If a dedicated run is given this run is processed
+ //
// In operational mode, this is the Shuttle function triggered by the EOR signal.
//
- Log("SHUTTLE","CollectNew - Shuttle called. Collecting conditions data for unprocessed runs");
+ if (run == -1)
+ Log("SHUTTLE","Collect - Shuttle called. Collecting conditions data for unprocessed runs");
+ else
+ Log("SHUTTLE", Form("Collect - Shuttle called. Collecting conditions data for run %d", run));
+
+ SetLastAction("Starting");
TString whereClause("where shuttle_done=0");
+ if (run != -1)
+ whereClause += Form(" and run=%d", run);
TObjArray shuttleLogbookEntries;
if (!QueryShuttleLogbook(whereClause, shuttleLogbookEntries)) {
- Log("SHUTTLE", "CollectNew - Can't retrieve entries from Shuttle logbook");
+ Log("SHUTTLE", "Collect - Can't retrieve entries from Shuttle logbook");
return kFALSE;
}
if (!RetrieveConditionsData(shuttleLogbookEntries)) {
- Log("SHUTTLE", "CollectNew - Process of at least one run failed");
- return kFALSE;
- }
-
- return kTRUE;
-}
-
-//______________________________________________________________________________________________
-Bool_t AliShuttle::CollectAll()
-{
- //
- // Collects conditions data for all runs (even if they're already done!) written in Shuttle LogBook.
- //
-
- AliInfo("Collecting conditions data for all runs ...");
-
- TObjArray dateEntries;
- if (!QueryShuttleLogbook("", dateEntries)) {
- AliError("Can't retrieve entries from Shuttle logbook");
- return kFALSE;
- }
-
- if (!RetrieveConditionsData(dateEntries)) {
- AliError("An error occured during conditions data retrieval!");
+ Log("SHUTTLE", "Collect - Process of at least one run failed");
return kFALSE;
}
- return kTRUE;
+ return kTRUE;
}
-
//______________________________________________________________________________________________
Bool_t AliShuttle::RetrieveConditionsData(const TObjArray& dateEntries)
{
return hasError == kFALSE;
}
+
+//______________________________________________________________________________________________
+ULong_t AliShuttle::GetTimeOfLastAction() const
+{
+ ULong_t tmp;
+
+ fMonitoringMutex->Lock();
+
+ tmp = fLastActionTime;
+
+ fMonitoringMutex->UnLock();
+
+ return tmp;
+}
+
+//______________________________________________________________________________________________
+const TString AliShuttle::GetLastAction() const
+{
+ // returns a string description of the last action
+
+ TString tmp;
+
+ fMonitoringMutex->Lock();
+
+ tmp = fLastAction;
+
+ fMonitoringMutex->UnLock();
+
+ return tmp;
+}
+
+//______________________________________________________________________________________________
+void AliShuttle::SetLastAction(const char* action)
+{
+ // updates the monitoring variables
+
+ fMonitoringMutex->Lock();
+
+ fLastAction = action;
+ fLastActionTime = time(0);
+
+ fMonitoringMutex->UnLock();
+}
class TSQLServer;
class AliCDBEntry;
class AliCDBPath;
+class TMutex;
class AliShuttle: public AliShuttleInterface {
public:
virtual void RegisterPreprocessor(AliPreprocessor* preprocessor);
- Bool_t Collect(Int_t run);
- Bool_t CollectNew();
- Bool_t CollectAll();
+ Bool_t Collect(Int_t run = -1);
Bool_t Process(AliShuttleLogbookEntry* entry);
+ // monitoring functions
+ ULong_t GetTimeOfLastAction() const;
+ const TString GetLastAction() const;
+
Int_t GetCurrentRun() const;
UInt_t GetCurrentStartTime() const;
UInt_t GetCurrentEndTime() const;
Bool_t ContinueProcessing();
void UpdateShuttleStatus(AliShuttleStatus::Status newStatus, Bool_t increaseCount = kFALSE);
Bool_t UpdateShuttleLogbook(const char* detector, const char* status=0);
+
+ void SetLastAction(const char* action);
const AliShuttleConfig* fConfig; // pointer to configuration object
AliCDBEntry* fStatusEntry; // last CDB entry containing a AliShuttleStatus retrieved
Bool_t fGridError; // Grid storage error flag
+
+ TMutex* fMonitoringMutex; // mutex to lock the monitoring class members
+ UInt_t fLastActionTime; // time of last action for monitoring
+ TString fLastAction; // string description for last action
//TODO Test only, remove later !
static Bool_t fgkProcessDCS; // flag to enable DCS archive data processing
/*
$Log$
+Revision 1.9 2006/10/02 16:38:39 jgrosseo
+update (alberto):
+fixed memory leaks
+storing of objects that failed to be stored to the grid before
+interfacing of shuttle status table in daq system
+
Revision 1.8 2006/08/15 10:50:00 jgrosseo
effc++ corrections (alberto)
const char* binddn, const char* password, const char* basedn):
fIsValid(kFALSE),
fDAQlbHost(""), fDAQlbUser(""), fDAQlbPass(""),
- fMaxPPRetries(0), fMaxRetries(0), fDetectorMap(), fDetectorList(),
+ fMaxRetries(0), fPPTimeOut(0), fDetectorMap(), fDetectorList(),
fShuttleInstanceHost(""), fProcessedDetectors(), fProcessAll(kFALSE)
{
//
}
fDAQlbPass = anAttribute->GetValue();
- anAttribute = anEntry->GetAttribute("MaxPPRetries");
+ anAttribute = anEntry->GetAttribute("MaxRetries");
if (!anAttribute) {
- AliError("Can't find MaxPPRetries attribute!");
+ AliError("Can't find MaxRetries attribute!");
delete aResult; delete anEntry;
return;
}
TString tmpStr = anAttribute->GetValue();
- fMaxPPRetries = tmpStr.Atoi();
+ fMaxRetries = tmpStr.Atoi();
- anAttribute = anEntry->GetAttribute("MaxRetries");
+ anAttribute = anEntry->GetAttribute("PPTimeOut");
if (!anAttribute) {
- AliError("Can't find MaxRetries attribute!");
+ AliError("Can't find PPTimeOut attribute!");
delete aResult; delete anEntry;
return;
}
tmpStr = anAttribute->GetValue();
- fMaxRetries = tmpStr.Atoi();
+ fPPTimeOut = tmpStr.Atoi();
delete aResult; delete anEntry;
result += "\n\n";
}
- result += Form("Max PP retries = %d - Max total retries = %d\n\n", fMaxPPRetries, fMaxRetries);
+ result += Form("PP time out = %d - Max total retries = %d\n\n", fPPTimeOut, fMaxRetries);
result += Form("DAQ Logbook Configuration \n \tHost: %s - User: %s - ",
fDAQlbHost.Data(), fDAQlbUser.Data());
const char* GetFESlbUser(Int_t system) const {return fFESlbUser[system].Data();}
const char* GetFESlbPass(Int_t system) const {return fFESlbPass[system].Data();}
- Int_t GetMaxPPRetries() const { return fMaxPPRetries; }
Int_t GetMaxRetries() const { return fMaxRetries; }
- const TObjArray* GetDetectors() const;
+ Int_t GetPPTimeOut() const { return fPPTimeOut; }
+
+ const TObjArray* GetDetectors() const;
Bool_t HasDetector(const char* detector) const;
const char* GetDCSHost(const char* detector) const;
TString fFESlbUser[3]; //! username of the [DAQ, DCS, HLT] FES logbook
TString fFESlbPass[3]; //! password of the [DAQ, DCS, HLT] FES logbook
- Int_t fMaxPPRetries; // number of retries of a crashed preprocessor
- Int_t fMaxRetries; // number of retries for all other failures
+ Int_t fMaxRetries; // number of retries of a failed preprocessor
+
+ Int_t fPPTimeOut; // timeout until a preprocessor is canceled
- TMap fDetectorMap; //! Map of the detector-by-detector configuration
+ TMap fDetectorMap; //! Map of the detector-by-detector configuration
TObjArray fDetectorList; //! List of detectors with valid configuration
TString fShuttleInstanceHost; //! Instance of the SHUTTLE
/*
$Log$
+ Revision 1.11 2006/10/02 16:38:39 jgrosseo
+ update (alberto):
+ fixed memory leaks
+ storing of objects that failed to be stored to the grid before
+ interfacing of shuttle status table in daq system
+
Revision 1.10 2006/08/15 10:50:00 jgrosseo
effc++ corrections (alberto)
//
// This class is to deal with DAQ LogBook and DAQ "end of run" notification.
// It has severeal two modes:
-// 1) syncrhnized - Collect(), CollectNew() and CollectAll methods
+// 1) synchronized - Collect()
// 2) asynchronized - Run() - starts listening for DAQ "end of run"
// notification by DIM service.
//
#include "AliShuttleTrigger.h"
#include <TSystem.h>
+
#include "AliLog.h"
#include "AliShuttleConfig.h"
#include "AliShuttle.h"
#include "DATENotifier.h"
ClassImp(TerminateSignalHandler)
-
-//______________________________________________________________________
-TerminateSignalHandler::TerminateSignalHandler(const TerminateSignalHandler& /*other*/):
-TSignalHandler(), fTrigger()
-{
-// copy constructor (not implemented)
-
-}
-
-//______________________________________________________________________
-TerminateSignalHandler &TerminateSignalHandler::operator=(const TerminateSignalHandler& /*other*/)
-{
-// assignment operator (not implemented)
-
-return *this;
-}
+ClassImp(AliShuttleTrigger)
//______________________________________________________________________________________________
-Bool_t TerminateSignalHandler::Notify()
+Bool_t TerminateSignalHandler::Notify()
{
// Sentd terminate command to the Shuttle trigger
return kTRUE;
}
-//______________________________________________________________________________________________
-//______________________________________________________________________________________________
-
-ClassImp(AliShuttleTrigger)
-
//______________________________________________________________________________________________
AliShuttleTrigger::AliShuttleTrigger(const AliShuttleConfig* config,
UInt_t timeout, Int_t retries):
fConfig(config), fShuttle(NULL),
fNotified(kFALSE), fTerminate(kFALSE),
fMutex(), fCondition(&fMutex),
- fQuitSignalHandler(this, kSigQuit),
- fInterruptSignalHandler(this, kSigInterrupt)
+ fQuitSignalHandler(0),
+ fInterruptSignalHandler(0)
{
//
// config - pointer to the AliShuttleConfig object which represents
fShuttle = new AliShuttle(config, timeout, retries);
- gSystem->AddSignalHandler(&fQuitSignalHandler);
- gSystem->AddSignalHandler(&fInterruptSignalHandler);
-
-}
-
+ TerminateSignalHandler* fQuitSignalHandler = new TerminateSignalHandler(this, kSigQuit);
+ TerminateSignalHandler* fInterruptSignalHandler = new TerminateSignalHandler(this, kSigInterrupt);
-
-//______________________________________________________________________
-AliShuttleTrigger::AliShuttleTrigger(const AliShuttleTrigger& /*other*/):
- TObject(), fConfig(), fShuttle(NULL),
- fNotified(kFALSE), fTerminate(kFALSE),
- fMutex(), fCondition(&fMutex),
- fQuitSignalHandler(this, kSigQuit),
- fInterruptSignalHandler(this, kSigInterrupt)
-
-{
-// copy constructor (not implemented)
+ gSystem->AddSignalHandler(fQuitSignalHandler);
+ gSystem->AddSignalHandler(fInterruptSignalHandler);
}
-//______________________________________________________________________
-AliShuttleTrigger &AliShuttleTrigger::operator=(const AliShuttleTrigger& /*other*/)
-{
-// assignment operator (not implemented)
-
-return *this;
-}
-
-
-
-
-
//______________________________________________________________________________________________
AliShuttleTrigger::~AliShuttleTrigger()
{
-// destructor
+ // destructor
- gSystem->RemoveSignalHandler(&fQuitSignalHandler);
- gSystem->RemoveSignalHandler(&fInterruptSignalHandler);
+ gSystem->RemoveSignalHandler(fQuitSignalHandler);
+ gSystem->RemoveSignalHandler(fInterruptSignalHandler);
delete fShuttle;
+
+ delete fQuitSignalHandler;
+ fQuitSignalHandler = 0;
+
+ delete fInterruptSignalHandler;
+ fInterruptSignalHandler = 0;
}
//______________________________________________________________________________________________
Bool_t AliShuttleTrigger::Notify() {
//
- // Trigger CollectNew() methods in asynchronized (listen) mode.
+ // Trigger Collect() methods in asynchronized (listen) mode.
// Usually called automaticly by DATENotifier on "end of run"
// notification event.
//
//
// AliShuttleTrigger main loop for asynchronized (listen) mode.
// It spawns DIM service listener and waits for DAQ "end of run"
- // notification. Calls CollectNew() on notification.
+ // notification. Calls Collect() on notification.
//
fTerminate = kFALSE;
break;
}
- CollectNew();
+ Collect();
}
delete notifier;
Bool_t AliShuttleTrigger::Collect(Int_t run)
{
//
- // Collects conditions data for the given run.
- //
-
- return fShuttle->Collect(run);
-}
-
-//______________________________________________________________________________________________
-Bool_t AliShuttleTrigger::CollectNew()
-{
- //
- // Collects conditions data for all UNPROCESSED run written to DAQ LogBook.
- //
-
- return fShuttle->CollectNew();
-}
-
-//______________________________________________________________________________________________
-Bool_t AliShuttleTrigger::CollectAll()
-{
- //
- // Collects conditions data for all runs (even if they're already done!) written in Shuttle LogBook.
+ // this function creates a thread that runs the shuttle
+ // then it checks if the shuttle is still running by checking the monitoring functions of the shuttle
//
- return fShuttle->CollectAll();
+ return fShuttle->Collect(run);
}
-
public:
TerminateSignalHandler(): TSignalHandler((ESignals) 0,0), fTrigger(0) { }
TerminateSignalHandler(AliShuttleTrigger* trigger, ESignals signal):
- TSignalHandler(signal, kFALSE), fTrigger(trigger) {}
+ TSignalHandler(signal, kFALSE), fTrigger(trigger) {}
virtual ~TerminateSignalHandler() { }
virtual Bool_t Notify();
private:
-
- TerminateSignalHandler(const TerminateSignalHandler& other);
- TerminateSignalHandler& operator= (const TerminateSignalHandler& other);
-
+ TerminateSignalHandler(const TerminateSignalHandler& other);
+ TerminateSignalHandler& operator= (const TerminateSignalHandler& other);
+
AliShuttleTrigger* fTrigger; // pointer to the current AliShuttleTrigger
ClassDef(TerminateSignalHandler, 0)
AliShuttle* GetShuttle() {return fShuttle;}
- Bool_t Collect(Int_t run);
- Bool_t CollectNew();
- Bool_t CollectAll();
+ Bool_t Collect(Int_t run = -1);
virtual Bool_t Notify();
void Terminate();
TMutex fMutex; // Mutex
TCondition fCondition; // Condition
- TerminateSignalHandler fQuitSignalHandler; // Quit signal
- TerminateSignalHandler fInterruptSignalHandler; // Interrupt signal
+ TerminateSignalHandler* fQuitSignalHandler; // Quit signal
+ TerminateSignalHandler* fInterruptSignalHandler; // Interrupt signal
ClassDef(AliShuttleTrigger, 0)
-void Shuttle(const char* param = "listen") {
+Bool_t Shuttle(const char* param = "listen") {
// WARNING: if ldap is built with ssl support it may cause confilcts with the
// AliEn interface. If this happens, grid storage activation must be done BEFORE
Int_t run = paramStr.Atoi();
trigger.Collect(run);
} else if (paramStr == "new") {
- trigger.CollectNew();
- } else if (paramStr == "all") {
- trigger.CollectAll();
+ Bool_t result = trigger.Collect();
} else if (paramStr == "listen") {
trigger.Run();
- } else if (paramStr.BeginsWith("lastrun=")) {
- Int_t run = TString(paramStr(8, paramStr.Length()-7).Data()).Atoi();
- cout << run << endl;
- trigger.SetNewLastRun(run);
} else {
cout<<"Bad parameter: "<<param<<endl;
cout<<"Parameter options: "<<endl;
cout<<"<run> - collect data for the given run"<<endl;
cout<<"new - collect data only for the new runs"<<endl;
- cout<<"all - collect data for all runs"<<endl;
cout<<"listen - start listening for DAQ notification"<<endl;
- cout<<"lastrun=<run> - sets last run manually. use with caution!" << endl;
cout<<"<empty parameter> - the same as 'listen'"<<endl;
}
attributetype ( GLOBAL_CONFIG:1 NAME 'DAQLogbookHost' DESC '' EQUALITY caseIgnoreMatch SUP name )
attributetype ( GLOBAL_CONFIG:2 NAME 'DAQLogbookUser' DESC '' EQUALITY caseIgnoreMatch SUP name )
attributetype ( GLOBAL_CONFIG:3 NAME 'DAQLogbookPassword' DESC '' EQUALITY caseIgnoreMatch SUP name )
-attributetype ( GLOBAL_CONFIG:4 NAME 'MaxPPRetries' DESC 'number of retries of a crashed preprocessor' EQUALITY caseIgnoreMatch SUP name )
-attributetype ( GLOBAL_CONFIG:5 NAME 'MaxRetries' DESC 'number of retries for all other failures' EQUALITY caseIgnoreMatch SUP name )
+attributetype ( GLOBAL_CONFIG:4 NAME 'MaxRetries' DESC 'number of retries for failures of a preprocessor' EQUALITY caseIgnoreMatch SUP name )
+attributetype ( GLOBAL_CONFIG:5 NAME 'PPTimeOut' DESC 'number of seconds until preprocessor is aborted' EQUALITY caseIgnoreMatch SUP name )
objectclass ( GLOBAL_CONFIG
NAME 'AliShuttleGlobalConfig'
DESC 'ALICE: Access to DAQ logbook settings'
SUP top
- MUST (name $ DAQLogbookHost $ DAQLogbookUser $ DAQLogbookPassword $ MaxPPRetries $ MaxRetries) )
+ MUST (name $ DAQLogbookHost $ DAQLogbookUser $ DAQLogbookPassword $ MaxRetries $ PPTimeOut) )
objectidentifier INSTANCE_CONFIG SHUTTLE_BASE:4