introducing status management: The processing per subdetector is divided into several...
authorjgrosseo <jgrosseo@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 20 Jul 2006 09:54:40 +0000 (09:54 +0000)
committerjgrosseo <jgrosseo@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 20 Jul 2006 09:54:40 +0000 (09:54 +0000)
after each step the status is stored on disk. If the system crashes in any of the steps the Shuttle
can keep track of the number of failures and skips further processing after a certain threshold is
exceeded. These thresholds can be configured in LDAP.

SHUTTLE/AliDCSMessage.cxx
SHUTTLE/AliShuttle.cxx
SHUTTLE/AliShuttle.h
SHUTTLE/AliShuttleConfig.cxx
SHUTTLE/AliShuttleConfig.h
SHUTTLE/AliShuttleTrigger.cxx
SHUTTLE/SHUTTLELinkDef.h
SHUTTLE/libSHUTTLE.pkg
SHUTTLE/schema/shuttle.schema

index c8c8701..28d18b2 100644 (file)
@@ -15,6 +15,9 @@
 
 /*
 $Log$
+Revision 1.4  2006/07/04 14:59:57  jgrosseo
+revision of AliDCSValue: Removed wrapper classes, reduced storage size per value by factor 2
+
 Revision 1.3  2006/06/12 09:11:16  jgrosseo
 coding conventions (Alberto)
 
@@ -401,10 +404,6 @@ void AliDCSMessage::StoreResultSetMessage()
 
   UInt_t valueDataSize = 0;
   while ((aValue = (AliDCSValue*) iter.Next())) {
-    if (AliDCSValue::IsDynamic(fValueType)) {
-      valueDataSize +=  1;
-    }  
-
     valueDataSize += aValue->GetSize();
   }
 
@@ -456,76 +455,6 @@ void AliDCSMessage::StoreResultSetMessage()
       SetUInt(fMessage + cursor, aValue->GetTimeStamp());
       cursor += sizeof(UInt_t);
     }
-/*     } else if (fValueType == AliSimpleValue::kDynBool) {
-    while ((aValue = (AliDCSValue*) iter.Next())) {
-      Int_t dynSize = aValue->GetSimpleValue().
-        GetDynamicSize();
-      SetUByte(fMessage + cursor, dynSize);
-      cursor += 1;
-      for (Int_t k = 0; k < dynSize; k ++) {
-                          SetBool(fMessage + cursor, aValue->
-                                  GetSimpleValue().GetDynBool(k));
-                          cursor += 1;
-      }
-                        SetUInt(fMessage + cursor, aValue->GetTimeStamp());
-                        cursor += sizeof(UInt_t);
-                }
-  } else if (fValueType == AliSimpleValue::kDynByte) {
-    while ((aValue = (AliDCSValue*) iter.Next())) {
-                        Int_t dynSize = aValue->GetSimpleValue().
-                                GetDynamicSize();
-                        SetUByte(fMessage + cursor, dynSize);
-      cursor += 1;     
-                        for (Int_t k = 0; k < dynSize; k ++) {
-                                SetByte(fMessage + cursor, aValue->
-                                        GetSimpleValue().GetDynByte(k));
-                                cursor += sizeof(Char_t);
-                        }
-                        SetUInt(fMessage + cursor, aValue->GetTimeStamp());
-                        cursor += sizeof(UInt_t);
-                }
-  } else if (fValueType == AliSimpleValue::kDynInt) {
-    while ((aValue = (AliDCSValue*) iter.Next())) {
-                        Int_t dynSize = aValue->GetSimpleValue().
-                                GetDynamicSize();
-                        SetUByte(fMessage + cursor, dynSize);
-                        cursor += 1;
-                        for (Int_t k = 0; k < dynSize; k ++) {
-                                SetInt(fMessage + cursor, aValue->
-                                        GetSimpleValue().GetDynInt(k));
-                                cursor += sizeof(Int_t);
-                        }
-                        SetUInt(fMessage + cursor, aValue->GetTimeStamp());
-                        cursor += sizeof(UInt_t);
-                }
-  } else if (fValueType == AliSimpleValue::kDynUInt) {
-    while ((aValue = (AliDCSValue*) iter.Next())) {
-                        Int_t dynSize = aValue->GetSimpleValue().
-                                GetDynamicSize();
-                        SetUByte(fMessage + cursor, dynSize);
-                        cursor += 1;
-                        for (Int_t k = 0; k < dynSize; k ++) {
-                                SetUInt(fMessage + cursor, aValue->
-                                        GetSimpleValue().GetDynUInt(k));
-                                cursor += sizeof(UInt_t);
-                        }
-                        SetUInt(fMessage + cursor, aValue->GetTimeStamp());
-                        cursor += sizeof(UInt_t);
-                }
-  } else if (fValueType == AliSimpleValue::kDynFloat) {
-    while ((aValue = (AliDCSValue*) iter.Next())) {
-                        Int_t dynSize = aValue->GetSimpleValue().
-                                GetDynamicSize();
-                        SetUByte(fMessage + cursor, dynSize);
-                        cursor += 1;
-                        for (Int_t k = 0; k < dynSize; k ++) {
-                                SetFloat(fMessage + cursor, aValue->
-                                        GetSimpleValue().GetDynFloat(k));
-                                cursor += sizeof(Float_t);
-                        }
-                        SetUInt(fMessage + cursor, aValue->GetTimeStamp());
-                        cursor += sizeof(UInt_t);
-                } */
   } else {
     AliError("Invalid or unknown ValueType!");
     return;
index 700a712..7472423 100644 (file)
@@ -15,6 +15,9 @@
 
 /*
 $Log$
+Revision 1.9  2006/07/19 10:09:55  jgrosseo
+new configuration, accesst to DAQ FES (Alberto)
+
 Revision 1.8  2006/07/11 12:44:36  jgrosseo
 adding parameters for extended validity range of data produced by preprocessor
 
@@ -81,11 +84,13 @@ some docs added
 #include "AliCDBManager.h"
 #include "AliCDBStorage.h"
 #include "AliCDBId.h"
+#include "AliCDBEntry.h"
 #include "AliShuttleConfig.h"
 #include "AliDCSClient.h"
 #include "AliLog.h"
 #include "AliPreprocessor.h"
 #include "AliDefaultPreprocessor.h"
+#include "AliShuttleStatus.h"
 
 #include <TSystem.h>
 #include <TObject.h>
@@ -96,10 +101,13 @@ some docs added
 #include <TSQLResult.h>
 #include <TSQLRow.h>
 
+#include <fstream>
+
 ClassImp(AliShuttle)
 
 TString AliShuttle::fgkLocalUri("local://$ALICE_ROOT/SHUTTLE/ShuttleCDB");
 const char* AliShuttle::fgkShuttleTempDir = "$ALICE_ROOT/SHUTTLE/temp";
+const char* AliShuttle::fgkShuttleLogDir = "$ALICE_ROOT/SHUTTLE/log";
 
 const char* AliShuttle::fgkDetectorName[AliShuttle::fgkNDetectors] = {"SPD", "SDD", "SSD", "TPC", "TRD", "TOF",
        "PHOS", "CPV", "RICH", "EMCAL", "MUON_TRK", "MUON_TRG", "FMD", "ZDC", "PMD", "START", "VZERO"};
@@ -114,7 +122,7 @@ AliShuttle::AliShuttle(const AliShuttleConfig* config,
        fTimeout(timeout),
        fRetries(retries), fCurrentRun(-1), fCurrentStartTime(0),
        fCurrentEndTime(0),
-       fLog("")
+  fStatusEntry(0)
 {
        //
        // config: AliShuttleConfig used
@@ -225,7 +233,139 @@ UInt_t AliShuttle::Store(const char* detector,
 }
 
 //______________________________________________________________________________________________
-Bool_t AliShuttle::Process(Int_t run, UInt_t startTime, UInt_t endTime) 
+AliShuttleStatus* AliShuttle::ReadShuttleStatus()
+{
+  // Reads the AliShuttleStatus from the CDB
+
+  if (fStatusEntry)
+  {
+    delete fStatusEntry;
+    fStatusEntry = 0;
+  }
+
+  AliCDBStorage *origStorage = AliCDBManager::Instance()->GetDefaultStorage();
+
+  fStatusEntry = AliCDBManager::Instance()->GetStorage(AliShuttle::GetLocalURI())
+      ->Get(Form("/SHUTTLE/STATUS/%s", fCurrentDetector.Data()), fCurrentRun);
+
+  AliCDBManager::Instance()->SetDefaultStorage(origStorage);
+
+  if (!fStatusEntry)
+    return 0;
+
+  TObject* anObject = fStatusEntry->GetObject();
+  if (anObject == NULL || anObject->IsA() != AliShuttleStatus::Class())
+  {
+    AliError("Invalid object stored to CDB!");
+    return 0;
+  }
+
+  AliShuttleStatus* status = dynamic_cast<AliShuttleStatus*> (anObject);
+  return status;
+}
+
+//______________________________________________________________________________________________
+void AliShuttle::WriteShuttleStatus(AliShuttleStatus* status)
+{
+  // writes the status for one subdetector
+
+  if (fStatusEntry)
+  {
+    delete fStatusEntry;
+    fStatusEntry = 0;
+  }
+
+  AliCDBId id(AliCDBPath("SHUTTLE", "STATUS", fCurrentDetector), fCurrentRun, fCurrentRun);
+
+  fStatusEntry = new AliCDBEntry(status, id, new AliCDBMetaData);
+
+  AliCDBStorage *origStorage = AliCDBManager::Instance()->GetDefaultStorage();
+  AliCDBManager::Instance()->GetStorage(fgkLocalUri)->Put(fStatusEntry);
+  AliCDBManager::Instance()->SetDefaultStorage(origStorage);
+}
+
+//______________________________________________________________________________________________
+void AliShuttle::UpdateShuttleStatus(AliShuttleStatus::Status newStatus, Bool_t increaseCount)
+{
+  // changes the AliShuttleStatus for the given detector and run to the given status
+
+  if (!fStatusEntry)
+  {
+    AliError("UNEXPECTED: fStatusEntry empty");
+    return;
+  }
+
+  TObject* anObject = fStatusEntry->GetObject();
+  AliShuttleStatus* status = dynamic_cast<AliShuttleStatus*> (anObject);
+
+  if (!status)
+  {
+    AliError("UNEXPECTED: status could not be read from current CDB entry");
+    return;
+  }
+
+  Log("SHUTTLE", Form("%s: Changing state from %s to %s", fCurrentDetector.Data(), status->GetStatusName(), status->GetStatusName(newStatus)));
+
+  status->SetStatus(newStatus);
+  if (increaseCount)
+    status->IncreaseCount();
+
+  AliCDBStorage *origStorage = AliCDBManager::Instance()->GetDefaultStorage();
+  AliCDBManager::Instance()->GetStorage(fgkLocalUri)->Put(fStatusEntry);
+  AliCDBManager::Instance()->SetDefaultStorage(origStorage);
+}
+
+//______________________________________________________________________________________________
+Bool_t AliShuttle::ContinueProcessing()
+{
+  // this function reads the AliShuttleStatus information from CDB and
+  // checks if the processing should be continued
+  // if yes it returns kTRUE and updates the AliShuttleStatus with nextStatus
+
+  AliShuttleStatus* status = ReadShuttleStatus();
+  if (!status)
+  {
+    // first time
+
+    Log("SHUTTLE", Form("%s: Processing first time.", fCurrentDetector.Data()));
+    status = new AliShuttleStatus(AliShuttleStatus::kStarted);
+    WriteShuttleStatus(status);
+
+    return kTRUE;
+  }
+
+  if (status->GetStatus() == AliShuttleStatus::kDone)
+  {
+    Log("SHUTTLE", Form("%s already done for run %d", fCurrentDetector.Data(), fCurrentRun));
+    return kFALSE;
+  }
+
+  if (status->GetStatus() == AliShuttleStatus::kFailed)
+  {
+    Log("SHUTTLE", Form("%s already in failed state for run %d", fCurrentDetector.Data(), fCurrentRun));
+    return kFALSE;
+  }
+
+  // if we get here, there is a restart
+
+  // abort conditions
+  if (status->GetStatus() == AliShuttleStatus::kPPStarted && status->GetCount() > fConfig->GetMaxPPRetries() ||
+      status->GetCount() > fConfig->GetMaxRetries())
+  {
+    Log("SHUTTLE", Form("%s, run %d failed to often, %d times, status %s. Skipping processing.", fCurrentDetector.Data(), fCurrentRun, status->GetCount(), status->GetStatusName()));
+
+    return kFALSE;
+  }
+
+  Log("SHUTTLE", Form("Restart of %s, run %d. Got stuck before in %s, count %d", fCurrentDetector.Data(), fCurrentRun, status->GetStatusName(), status->GetCount()));
+
+  UpdateShuttleStatus(AliShuttleStatus::kStarted, kTRUE);
+
+  return kTRUE;
+}
+
+//______________________________________________________________________________________________
+Bool_t AliShuttle::Process(Int_t run, UInt_t startTime, UInt_t endTime)
 {
        //
        // Makes data retrieval for all detectors in the configuration.
@@ -238,10 +378,10 @@ Bool_t AliShuttle::Process(Int_t run, UInt_t startTime, UInt_t endTime)
        AliInfo(Form("\n\n ^*^*^*^*^*^* Processing run %d ^*^*^*^*^*^*", run));
 
        // Initialization
-       ClearLog();
        Bool_t hasError = kFALSE;
        for(Int_t iSys=0;iSys<3;iSys++) fFESCalled[iSys]=kFALSE;
-       fCurrentRun = run;
+
+  fCurrentRun = run;
        fCurrentStartTime = startTime;
        fCurrentEndTime = endTime;
 
@@ -250,9 +390,15 @@ Bool_t AliShuttle::Process(Int_t run, UInt_t startTime, UInt_t endTime)
        TObjString* aDetector;
 
        while ((aDetector = (TObjString*) iter.Next())) {
+    fCurrentDetector = aDetector->String();
+
                Bool_t detectorError=kFALSE;
-               if(!fConfig->HostProcessDetector(aDetector->GetName())) continue;
-               if(!Process(run, startTime, endTime, aDetector->String())) {
+               if (!fConfig->HostProcessDetector(fCurrentDetector)) continue;
+
+    if (ContinueProcessing() == kFALSE)
+      continue;
+
+               if(!Process()) {
                        hasError = kTRUE;
                        detectorError=kTRUE;
                        continue;
@@ -261,7 +407,7 @@ Bool_t AliShuttle::Process(Int_t run, UInt_t startTime, UInt_t endTime)
 
                // Process successful: Update time_processed field in FES logbooks!
                if(fFESCalled[kDAQ]) {
-                       hasError = (UpdateDAQTable(aDetector->GetName()) == kFALSE);
+                       hasError = (UpdateDAQTable() == kFALSE);
                        fFESlist[kDAQ].Clear();
                }
                //if(fFESCalled[kDCS]) {
@@ -272,9 +418,10 @@ Bool_t AliShuttle::Process(Int_t run, UInt_t startTime, UInt_t endTime)
                //      hasError = UpdateHLTTable(aDetector->GetName());
                //      fFESlist[kHLT].Clear();
                //}
-       }
 
-       if(fLog != "") StoreLog(run);
+    UpdateShuttleStatus(AliShuttleStatus::kDone);
+  }
+
        fCurrentRun = -1;
        fCurrentStartTime = 0;
        fCurrentEndTime = 0;
@@ -283,8 +430,7 @@ Bool_t AliShuttle::Process(Int_t run, UInt_t startTime, UInt_t endTime)
 }
 
 //______________________________________________________________________________________________
-Bool_t AliShuttle::Process(Int_t run, UInt_t startTime, UInt_t endTime,
-               const char* detector)
+Bool_t AliShuttle::Process()
 {
        //
         // Makes data retrieval just for one specific detector.
@@ -296,17 +442,20 @@ Bool_t AliShuttle::Process(Int_t run, UInt_t startTime, UInt_t endTime,
        // Returns kFALSE in case of error occured and kTRUE otherwise
        //
 
-       AliInfo(Form("Retrieving values for %s, run %d", detector, run));
+       AliInfo(Form("Retrieving values for %s, run %d", fCurrentDetector.Data(), fCurrentRun));
 
-       if (!fConfig->HasDetector(detector)) {
-               Log(detector, "There isn't any configuration for %s !");
+       if (!fConfig->HasDetector(fCurrentDetector)) {
+               Log(fCurrentDetector, "There isn't any configuration for %s !");
+    UpdateShuttleStatus(AliShuttleStatus::kFailed);
                return kFALSE;
        }
 
-       TString host(fConfig->GetDCSHost(detector));
-       Int_t port = fConfig->GetDCSPort(detector);
+  UpdateShuttleStatus(AliShuttleStatus::kDCSStarted);
 
-       TIter iter(fConfig->GetDCSAliases(detector));
+  TString host(fConfig->GetDCSHost(fCurrentDetector));
+       Int_t port = fConfig->GetDCSPort(fCurrentDetector);
+
+       TIter iter(fConfig->GetDCSAliases(fCurrentDetector));
        TObjString* anAlias;
        TMap aliasMap;
 
@@ -323,33 +472,42 @@ Bool_t AliShuttle::Process(Int_t run, UInt_t startTime, UInt_t endTime,
                }else{
                        TString message = Form("Error while retrieving alias %s !",
                                        anAlias->GetName());
-                       Log(detector, message.Data());
+                       Log(fCurrentDetector, message.Data());
                        hasError = kTRUE;
                }
        }
 
        // even if hasError is TRUE the Shuttle should keep on processing the detector (calib files!)
 
-       if(hasError) return kFALSE;
-       // TODO if(hasError) mark DCS error
+       if (hasError)
+  {
+    UpdateShuttleStatus(AliShuttleStatus::kDCSError);
+    return kFALSE;
+  }
+
+  UpdateShuttleStatus(AliShuttleStatus::kPPStarted);
 
-       AliPreprocessor* aPreprocessor =
-               dynamic_cast<AliPreprocessor*> (fPreprocessorMap.GetValue(detector));
+  AliPreprocessor* aPreprocessor =
+               dynamic_cast<AliPreprocessor*> (fPreprocessorMap.GetValue(fCurrentDetector));
        if(aPreprocessor)
        {
-               aPreprocessor->Initialize(run, startTime, endTime);
+               aPreprocessor->Initialize(fCurrentRun, fCurrentStartTime, fCurrentEndTime);
                hasError = (aPreprocessor->Process(&aliasMap) == 0);
        }else{
     // TODO default behaviour?
-               AliInfo(Form("No Preprocessor for %s: storing TMap of DP arrays into CDB!",detector));
+               AliInfo(Form("No Preprocessor for %s: storing TMap of DP arrays into CDB!", fCurrentDetector.Data()));
                AliCDBMetaData metaData;
-               AliDCSValue dcsValue(startTime, endTime);
+               AliDCSValue dcsValue(fCurrentStartTime, fCurrentEndTime);
                metaData.SetResponsible(Form("Duck, Donald"));
                metaData.SetProperty("StartEndTime", &dcsValue);
                metaData.SetComment("Automatically stored by Shuttle!");
-               hasError = (Store(detector, &aliasMap, &metaData) == 0);
+               hasError = (Store(fCurrentDetector, &aliasMap, &metaData) == 0);
        }
 
+  if (hasError)
+    UpdateShuttleStatus(AliShuttleStatus::kPPError);
+  else
+    UpdateShuttleStatus(AliShuttleStatus::kPPDone);
 
        aliasMap.Delete();
 
@@ -646,12 +804,12 @@ TList* AliShuttle::GetDAQFileSources(const char* detector, const char* id){
 }
 
 //______________________________________________________________________________________________
-Bool_t AliShuttle::UpdateDAQTable(const char* detector){
+Bool_t AliShuttle::UpdateDAQTable(){
 // Update DAQ table filling time_processed field in all rows corresponding to current run and detector
 
        // check connection, in case connect
        if(!Connect(kDAQ)){
-               Log(detector, "UpdateDAQTable: Couldn't connect to DAQ Logbook !");
+               Log(fCurrentDetector, "UpdateDAQTable: Couldn't connect to DAQ Logbook !");
                return kFALSE;
        }
 
@@ -664,7 +822,7 @@ Bool_t AliShuttle::UpdateDAQTable(const char* detector){
                TString aFESentrystr = aFESentry->String();
                TObjArray *aFESarray = aFESentrystr.Tokenize("_!?!_");
                if(!aFESarray || aFESarray->GetEntries() != 2 ) {
-                       Log(detector,Form("UpdateDAQTable: error updating FES entry! string = %s",
+                       Log(fCurrentDetector,Form("UpdateDAQTable: error updating FES entry! string = %s",
                                aFESentrystr.Data()));
                        if(aFESarray) delete aFESarray;
                        return kFALSE;
@@ -672,7 +830,7 @@ Bool_t AliShuttle::UpdateDAQTable(const char* detector){
                const char* fileId = ((TObjString*) aFESarray->At(0))->GetName();
                const char* daqSource = ((TObjString*) aFESarray->At(1))->GetName();
                TString whereClause = Form("where run=%d and detector=\"%s\" and fileId=\"%s\" and DAQsource=\"%s\";",
-                       fCurrentRun,GetDetCode(detector), fileId, daqSource);
+                       fCurrentRun,GetDetCode(fCurrentDetector), fileId, daqSource);
 
                delete aFESarray;
 
@@ -684,7 +842,7 @@ Bool_t AliShuttle::UpdateDAQTable(const char* detector){
                TSQLResult* aResult;
                aResult = dynamic_cast<TSQLResult*> (fServer[kDAQ]->Query(sqlQuery));
                if (!aResult) {
-                       Log(detector, Form("UpdateDAQTable: Can't execute query <%s>!", sqlQuery.Data()));
+                       Log(fCurrentDetector, Form("UpdateDAQTable: Can't execute query <%s>!", sqlQuery.Data()));
                        return kFALSE;
                }
                delete aResult;
@@ -700,14 +858,14 @@ Bool_t AliShuttle::UpdateDAQTable(const char* detector){
                }
 
        if (aResult->GetRowCount() == 0) {
-               Log(detector,
+               Log(fCurrentDetector,
                        Form("GetDAQFileName: No result from SQL query <%s>!", sqlQuery.Data()));
                delete aResult;
                //return 0;
        }
 
        if (aResult->GetRowCount() >1) {
-               Log(detector,
+               Log(fCurrentDetector,
                        Form("GetDAQFileName: More than one row resulting from SQL query <%s>!", sqlQuery.Data()));
                delete aResult;
                //return 0;
@@ -717,7 +875,7 @@ Bool_t AliShuttle::UpdateDAQTable(const char* detector){
                TString processedTimeString(row->GetField(0), row->GetFieldLength(0));
                Int_t processedTime = processedTimeString.Atoi();
                if(processedTime != now.GetSec()){
-                       Log(detector, Form("UpdateDAQTable: Update table error: processed_time=%d, now=%d !",
+                       Log(fCurrentDetector, Form("UpdateDAQTable: Update table error: processed_time=%d, now=%d !",
                                processedTime, now.GetSec()));
                        delete aResult;
                        return kFALSE;
@@ -778,29 +936,19 @@ void AliShuttle::Log(const char* detector, const char* message)
 {
 // Fill log string with a message
 
-       TString toLog = Form("%s - %s", detector, message);
-       AliError(toLog.Data());
+       TString toLog = Form("%s, run %d - %s", detector, GetCurrentRun(), message);
+       AliInfo(toLog.Data());
 
-       fLog += toLog;
-       fLog += "\n";
+  TString fileName;
+  fileName.Form("%s/%s.log", fgkShuttleLogDir, detector);
+  gSystem->ExpandPathName(fileName);
 
-}
+  AliInfo(fileName.Data());
 
-//______________________________________________________________________________________________
-void AliShuttle::StoreLog(Int_t run)
-{
-// store error log string to SHUTTLE/SYSTEM/ERROR (on local storage)
-
-       AliInfo("Printing fLog...");
-       AliInfo(fLog.Data());
-       // Storing log string for runs with errors in "SHUTTLE/SYSTEM/ERRORLOGS"
-       TObjString *logString = new TObjString(fLog);
-       AliCDBId badRunId("SHUTTLE/SYSTEM/ERRORLOGS",run,run);
-       AliCDBMetaData metaData;
-       AliCDBManager::Instance()->GetStorage(fgkLocalUri)
-                                       ->Put(logString, badRunId,&metaData);
-       delete logString;
+  ofstream logFile;
+  logFile.open(fileName, ofstream::out | ofstream::app);
 
+  logFile << toLog.Data() << "\n";
 
+  logFile.close();
 }
-
index e3101cf..334567c 100644 (file)
 #include <TList.h>
 
 #include "AliShuttleInterface.h"
+#include "AliShuttleStatus.h"
 
 class TObject;
 class AliShuttleConfig;
 class AliPreprocessor;
 class AliCDBMetaData;
 class TSQLServer;
+class AliCDBEntry;
 
 class AliShuttle: public AliShuttleInterface {
 public:
@@ -34,8 +36,7 @@ public:
        virtual void RegisterPreprocessor(AliPreprocessor* preprocessor);
 
        Bool_t Process(Int_t run, UInt_t startTime, UInt_t endTime);
-       Bool_t Process(Int_t run, UInt_t startTime, UInt_t endTime,
-               const char* detector);
+       Bool_t Process();
 
        Int_t GetCurrentRun() const {return fCurrentRun;};
        UInt_t GetCurrentStartTime() const {return fCurrentStartTime;};
@@ -60,8 +61,6 @@ public:
 
 
 private:
-
-
        AliShuttle(const AliShuttle& other);
        AliShuttle& operator= (const AliShuttle& other);
 
@@ -71,7 +70,7 @@ private:
        const char* GetDAQFileName(const char* detector, const char* id, const char* source);
        Bool_t RetrieveDAQFile(const char* daqFileName, const char* localFileName);
        TList* GetDAQFileSources(const char* detector, const char* id);
-       Bool_t UpdateDAQTable(const char* detector);
+       Bool_t UpdateDAQTable();
 
        const char* GetDCSFileName(const char* detector, const char* id, const char* source);
 //     Bool_t RetrieveDCSFile(const char* daqFileName const char* localFileName);
@@ -81,9 +80,10 @@ private:
 //     Bool_t RetrieveHLTFile(const char* daqFileName, const char* localFileName;
        TList* GetHLTFileSources(const char* detector, const char* id);
 
-
-       void ClearLog() {fLog = "";}
-       void StoreLog(Int_t run);
+  AliShuttleStatus* ReadShuttleStatus();
+  void WriteShuttleStatus(AliShuttleStatus* status);
+  Bool_t ContinueProcessing();
+  void UpdateShuttleStatus(AliShuttleStatus::Status newStatus, Bool_t increaseCount = kFALSE);
 
        const AliShuttleConfig* fConfig;        //! pointer to configuration object
 
@@ -92,6 +92,7 @@ private:
        static const char* fgkDetectorCode[fgkNDetectors];      //! codes of detectors
        static TString     fgkLocalUri;         //! URI of the local backup storage location
        static const char* fgkShuttleTempDir;   //! base path of SHUTTLE temp folder
+       static const char* fgkShuttleLogDir;    //! path of SHUTTLE log folder
 
        UInt_t fTimeout;        //! DCS server connection timeout parameter
        Int_t fRetries;         //! Number of DCS server connection retries
@@ -102,12 +103,14 @@ private:
        UInt_t fCurrentStartTime;       //! Run Start time
        UInt_t fCurrentEndTime;         //! Run end time
 
+  TString fCurrentDetector; // current detector
+
        TSQLServer *fServer[3];         //! pointer to the three FS logbook servers
 
        Bool_t fFESCalled[3];           //! FES call status
        TList  fFESlist[3];             //! List of files retrieved from each FES
 
-       TString fLog;                   //! log message
+  AliCDBEntry* fStatusEntry; //! last CDB entry containing a AliShuttleStatus retrieved
 
        ClassDef(AliShuttle, 0);
 };
index 4416030..44450dd 100644 (file)
@@ -15,6 +15,9 @@
 
 /*
 $Log$
+Revision 1.6  2006/07/19 10:09:55  jgrosseo
+new configuration, accesst to DAQ FES (Alberto)
+
 Revision 1.5  2006/07/10 13:01:41  jgrosseo
 enhanced storing of last sucessfully processed run (alberto)
 
@@ -274,7 +277,23 @@ AliShuttleConfig::AliShuttleConfig(const char* host, Int_t port,
        }
        fDAQlbPass = anAttribute->GetValue();
 
-       delete anEntry;
+       anAttribute = anEntry->GetAttribute("MaxPPRetries");
+       if (!anAttribute) {
+               AliError("Can't find MaxPPRetries attribute!");
+               return;
+       }
+       TString tmpStr = anAttribute->GetValue();
+  fMaxPPRetries = tmpStr.Atoi();
+
+       anAttribute = anEntry->GetAttribute("MaxRetries");
+       if (!anAttribute) {
+               AliError("Can't find MaxRetries attribute!");
+               return;
+       }
+       tmpStr = anAttribute->GetValue();
+  fMaxRetries = tmpStr.Atoi();
+
+  delete anEntry;
        delete aResult;
 
        // FES configuration (FES logbook and hosts)
index f935988..185ed9d 100644 (file)
@@ -39,6 +39,9 @@ public:
        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;
 
        Bool_t HasDetector(const char* detector) const;
@@ -95,6 +98,8 @@ private:
        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
 
        TMap fDetectorMap;              //! Map of the detector-by-detector configuration
        TObjArray fDetectorList;        //! List of detectors with valid configuration
index 80aa929..a21cf17 100644 (file)
@@ -15,6 +15,9 @@
 
 /*
  $Log$
+ Revision 1.6  2006/07/19 10:09:55  jgrosseo
+ new configuration, accesst to DAQ FES (Alberto)
+
  Revision 1.5  2006/07/10 13:01:41  jgrosseo
  enhanced storing of last sucessfully processed run (alberto)
 
@@ -371,8 +374,6 @@ Bool_t AliShuttleTrigger::CollectNew()
        // Collects conditions data for all new run written to DAQ LogBook.
        //
 
-  // TODO revise this! last run number is ONLY allowed to be written when run was processed successfully!!!
-
        AliInfo("Collecting conditions data for new runs ...");
 
        Int_t lastRun;
index d7bf095..f2d8004 100644 (file)
@@ -22,5 +22,6 @@
 #pragma link C++ class  AliShuttleTrigger;
 #pragma link C++ class  TerminateSignalHandler;
 #pragma link C++ class  AliShuttleTrigger::AliShuttleTriggerDATEEntry;
+#pragma link C++ class  AliShuttleStatus;
 
 #endif
index 3683dae..2312282 100644 (file)
@@ -1,6 +1,6 @@
 SRCS = AliDCSMessage.cxx\
        AliDCSClient.cxx AliShuttle.cxx AliShuttleConfig.cxx\
-        AliShuttleTrigger.cxx
+        AliShuttleTrigger.cxx AliShuttleStatus.cxx
 
 CINTHDRS:= $(patsubst %,$(MODDIR)/%,$(SRCS:.cxx=.h))
 
index ae864c2..da32177 100644 (file)
@@ -38,12 +38,14 @@ objectidentifier GLOBAL_CONFIG SHUTTLE_BASE:3
 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 )
 
 objectclass ( GLOBAL_CONFIG
         NAME 'AliShuttleGlobalConfig'
         DESC 'ALICE: Access to DAQ logbook settings'
         SUP top
-        MUST (name $ DAQLogbookHost $ DAQLogbookUser $ DAQLogbookPassword) )
+        MUST (name $ DAQLogbookHost $ DAQLogbookUser $ DAQLogbookPassword $ MaxPPRetries $ MaxRetries) )
 
 
 objectidentifier INSTANCE_CONFIG SHUTTLE_BASE:4