]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
enhanced storing of last sucessfully processed run (alberto)
authorjgrosseo <jgrosseo@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 10 Jul 2006 13:01:41 +0000 (13:01 +0000)
committerjgrosseo <jgrosseo@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 10 Jul 2006 13:01:41 +0000 (13:01 +0000)
SHUTTLE/AliShuttle.cxx
SHUTTLE/AliShuttle.h
SHUTTLE/AliShuttleConfig.cxx
SHUTTLE/AliShuttleTrigger.cxx
SHUTTLE/AliShuttleTrigger.h

index f2ebf09ba263dcc1e2cf909807c5b0d200527750..564b811aca50ab7b8411d0619673a878221a18e5 100644 (file)
@@ -15,6 +15,9 @@
 
 /*
 $Log$
 
 /*
 $Log$
+Revision 1.5  2006/07/04 14:59:57  jgrosseo
+revision of AliDCSValue: Removed wrapper classes, reduced storage size per value by factor 2
+
 Revision 1.4  2006/06/12 09:11:16  jgrosseo
 coding conventions (Alberto)
 
 Revision 1.4  2006/06/12 09:11:16  jgrosseo
 coding conventions (Alberto)
 
@@ -94,14 +97,12 @@ AliShuttle::AliShuttle(const AliShuttleConfig* config,
 {
        //
        // config: AliShuttleConfig used
 {
        //
        // config: AliShuttleConfig used
-       // mainStorage: underlying AliCDBStorage
-       // localStorage (local) CDB storage to be used if mainStorage is unavailable
        // timeout: timeout used for AliDCSClient connection
        // retries: the number of retries in case of connection error.
        //
 
        // timeout: timeout used for AliDCSClient connection
        // retries: the number of retries in case of connection error.
        //
 
-       /*AliDefaultPreprocessor* pp = *///new AliDefaultPreprocessor("DEFAULT", this);
-  // TODO
+       //new AliDefaultPreprocessor("DEFAULT", this);
+
 }
 
 //______________________________________________________________________
 }
 
 //______________________________________________________________________
@@ -156,15 +157,16 @@ UInt_t AliShuttle::Store(const char* detector,
        //         1 if stored in main (Grid) storage
        //         2 if stored in backup (Local) storage
 
        //         1 if stored in main (Grid) storage
        //         2 if stored in backup (Local) storage
 
-       if (!(AliCDBManager::Instance()->IsDefaultStorageSet())) {
-               AliError("No CDB storage set!");
-               return 0;
-       }
 
        AliCDBId id(AliCDBPath(detector, "DCS", "Data"),
                GetCurrentRun(), GetCurrentRun());
 
 
        AliCDBId id(AliCDBPath(detector, "DCS", "Data"),
                GetCurrentRun(), GetCurrentRun());
 
-       UInt_t result = (UInt_t) AliCDBManager::Instance()->Put(object, id, metaData);
+       UInt_t result = 0;
+       if (!(AliCDBManager::Instance()->IsDefaultStorageSet())) {
+               Log(detector, "No CDB storage set!");
+       } else {
+               result = (UInt_t) AliCDBManager::Instance()->Put(object, id, metaData);
+       }
        if(!result) {
 
                Log(detector, "Error while storing object in main storage!");
        if(!result) {
 
                Log(detector, "Error while storing object in main storage!");
@@ -211,7 +213,7 @@ Bool_t AliShuttle::Process(Int_t run, UInt_t startTime, UInt_t endTime)
 
        if(fLog != "") StoreLog(run);
 
 
        if(fLog != "") StoreLog(run);
 
-       return !hasError;
+       return hasError == kFALSE;
 }
 
 //______________________________________________________________________________________________
 }
 
 //______________________________________________________________________________________________
@@ -252,6 +254,8 @@ Bool_t AliShuttle::Process(Int_t run, UInt_t startTime, UInt_t endTime,
        while ((anAlias = (TObjString*) iter.Next())) {
                TObjArray valueSet;
                result = GetValueSet(host, port, anAlias->String(), valueSet);
        while ((anAlias = (TObjString*) iter.Next())) {
                TObjArray valueSet;
                result = GetValueSet(host, port, anAlias->String(), valueSet);
+               //AliInfo(Form("Port = %d",port));
+               //result = kTRUE;
                if(result) {
                        aliasMap.Add(anAlias->Clone(), valueSet.Clone());
                }else{
                if(result) {
                        aliasMap.Add(anAlias->Clone(), valueSet.Clone());
                }else{
@@ -262,28 +266,32 @@ Bool_t AliShuttle::Process(Int_t run, UInt_t startTime, UInt_t endTime,
                }
        }
 
                }
        }
 
+       if(hasError) return kFALSE;
+
        AliPreprocessor* aPreprocessor =
                dynamic_cast<AliPreprocessor*> (fPreprocessorMap.GetValue(detector));
        AliPreprocessor* aPreprocessor =
                dynamic_cast<AliPreprocessor*> (fPreprocessorMap.GetValue(detector));
-       if(!aPreprocessor) {
-               AliInfo(Form("No Preprocessor for %s: Using default Preprocessor!",detector));
-               aPreprocessor = dynamic_cast<AliPreprocessor*> (fPreprocessorMap.GetValue("DEFAULT"));
+       if(aPreprocessor)
+       {
+               aPreprocessor->Initialize(run, startTime, endTime);
+               hasError = (aPreprocessor->Process(&aliasMap) == 0);
+       }else{
+               AliInfo(Form("No Preprocessor for %s: storing TMap of DP arrays into CDB!",detector));
+               AliCDBMetaData metaData;
+               metaData.SetResponsible(Form("Duck, Donald"));
+               metaData.SetProperty("StartEndTime",
+                       new AliDCSValue(startTime, endTime));
+               metaData.SetComment("Automatically stored by Shuttle!");
+               hasError = (Store(detector, &aliasMap, &metaData) == 0);
        }
 
        }
 
-  if (aPreprocessor)
-  {
-    aPreprocessor->Initialize(run, startTime, endTime);
-    hasError = (aPreprocessor->Process(&aliasMap) != 0);
-  }
-  else
-    AliWarning(Form("No preprocessor for %s available", detector));
 
 
-  aliasMap.Delete();
+       aliasMap.Delete();
 
        fCurrentRun = -1;
        fCurrentStartTime = 0;
        fCurrentEndTime = 0;
 
 
        fCurrentRun = -1;
        fCurrentStartTime = 0;
        fCurrentEndTime = 0;
 
-       return !hasError;
+       return hasError == kFALSE;
 }
 
 //______________________________________________________________________________________________
 }
 
 //______________________________________________________________________________________________
@@ -368,3 +376,4 @@ void AliShuttle::StoreLog(Int_t run)
 
 
 }
 
 
 }
+
index a63af32a661d345cd4173ef92b65020e29fe3b50..17885f2ff6626b95c21ce767f74edcafef8067fe 100644 (file)
@@ -11,7 +11,7 @@
 // This class is the main manager for 
 // AliShuttle. It organizes the data retrieval
 // from DCS and call the interface methods of
 // This class is the main manager for 
 // AliShuttle. It organizes the data retrieval
 // from DCS and call the interface methods of
-// AliCDBPreProcessor.
+// AliPreprocessor.
 //
 
 #include <TMap.h>
 //
 
 #include <TMap.h>
index 2de198405c7b7f6b3ae0250aa3f559dc9f581f9f..3ff815957028d816b1e7f932fa997e3958b50632 100644 (file)
@@ -15,6 +15,9 @@
 
 /*
 $Log$
 
 /*
 $Log$
+Revision 1.4  2006/06/12 09:11:16  jgrosseo
+coding conventions (Alberto)
+
 Revision 1.3  2006/06/06 14:26:40  jgrosseo
 o) removed files that were moved to STEER
 o) shuttle updated to follow the new interface (Alberto)
 Revision 1.3  2006/06/06 14:26:40  jgrosseo
 o) removed files that were moved to STEER
 o) shuttle updated to follow the new interface (Alberto)
@@ -131,7 +134,8 @@ AliShuttleConfig::AliShuttleConfigHolder::AliShuttleConfigHolder(const TLDAPEntr
        fIsValid = kTRUE;
 }
 
        fIsValid = kTRUE;
 }
 
-AliShuttleConfig::AliShuttleConfigHolder::~AliShuttleConfigHolder() 
+//______________________________________________________________________________________________
+AliShuttleConfig::AliShuttleConfigHolder::~AliShuttleConfigHolder()
 {
 // destructor of the shuttle configuration holder
 
 {
 // destructor of the shuttle configuration holder
 
@@ -140,7 +144,8 @@ AliShuttleConfig::AliShuttleConfigHolder::~AliShuttleConfigHolder()
 
 ClassImp(AliShuttleConfig)
 
 
 ClassImp(AliShuttleConfig)
 
-AliShuttleConfig::AliShuttleConfig(const char* host, Int_t port, 
+//______________________________________________________________________________________________
+AliShuttleConfig::AliShuttleConfig(const char* host, Int_t port,
        const char* binddn, const char* password, const char* basedn):
        fIsValid(kFALSE),
        fProcessAll(kFALSE)
        const char* binddn, const char* password, const char* basedn):
        fIsValid(kFALSE),
        fProcessAll(kFALSE)
@@ -283,14 +288,16 @@ AliShuttleConfig::AliShuttleConfig(const char* host, Int_t port,
        fIsValid = kTRUE;
 }
 
        fIsValid = kTRUE;
 }
 
-AliShuttleConfig::~AliShuttleConfig() 
+//______________________________________________________________________________________________
+AliShuttleConfig::~AliShuttleConfig()
 {
 // destructor
 
        fDetectorMap.DeleteAll();
 }
 
 {
 // destructor
 
        fDetectorMap.DeleteAll();
 }
 
-const TObjArray* AliShuttleConfig::GetDetectors() const 
+//______________________________________________________________________________________________
+const TObjArray* AliShuttleConfig::GetDetectors() const
 {
        //
        // returns collection of TObjString which contains the name
 {
        //
        // returns collection of TObjString which contains the name
@@ -300,7 +307,8 @@ const TObjArray* AliShuttleConfig::GetDetectors() const
        return &fDetectorList;
 }
 
        return &fDetectorList;
 }
 
-Bool_t AliShuttleConfig::HasDetector(const char* detector) const 
+//______________________________________________________________________________________________
+Bool_t AliShuttleConfig::HasDetector(const char* detector) const
 {
        //
        // checks for paricular detector in the configuration.
 {
        //
        // checks for paricular detector in the configuration.
@@ -308,7 +316,8 @@ Bool_t AliShuttleConfig::HasDetector(const char* detector) const
        return fDetectorMap.GetValue(detector) != NULL;
 }
 
        return fDetectorMap.GetValue(detector) != NULL;
 }
 
-const char* AliShuttleConfig::GetDCSHost(const char* detector) const 
+//______________________________________________________________________________________________
+const char* AliShuttleConfig::GetDCSHost(const char* detector) const
 {
        //
        // returns DCS server host used by particular detector
 {
        //
        // returns DCS server host used by particular detector
@@ -324,7 +333,8 @@ const char* AliShuttleConfig::GetDCSHost(const char* detector) const
        return aHolder->GetDCSHost();
 }
 
        return aHolder->GetDCSHost();
 }
 
-Int_t AliShuttleConfig::GetDCSPort(const char* detector) const 
+//______________________________________________________________________________________________
+Int_t AliShuttleConfig::GetDCSPort(const char* detector) const
 {
        //
         // returns DCS server port used by particular detector
 {
        //
         // returns DCS server port used by particular detector
@@ -341,7 +351,8 @@ Int_t AliShuttleConfig::GetDCSPort(const char* detector) const
        return aHolder->GetDCSPort();
 }
 
        return aHolder->GetDCSPort();
 }
 
-const TObjArray* AliShuttleConfig::GetDCSAliases(const char* detector) const 
+//______________________________________________________________________________________________
+const TObjArray* AliShuttleConfig::GetDCSAliases(const char* detector) const
 {
        //
        // returns collection of TObjString which represents the set of aliases
 {
        //
        // returns collection of TObjString which represents the set of aliases
@@ -358,7 +369,8 @@ const TObjArray* AliShuttleConfig::GetDCSAliases(const char* detector) const
        return aHolder->GetDCSAliases();
 }
 
        return aHolder->GetDCSAliases();
 }
 
-const TObjArray* AliShuttleConfig::GetDAQFileIDs(const char* detector) const 
+//______________________________________________________________________________________________
+const TObjArray* AliShuttleConfig::GetDAQFileIDs(const char* detector) const
 {
        //
        // returns collection of TObjString which represents the set of DAQ file IDs
 {
        //
        // returns collection of TObjString which represents the set of DAQ file IDs
@@ -375,7 +387,8 @@ const TObjArray* AliShuttleConfig::GetDAQFileIDs(const char* detector) const
        return aHolder->GetDAQFileIDs();
 }
 
        return aHolder->GetDAQFileIDs();
 }
 
-Bool_t AliShuttleConfig::HostProcessDetector(const char* detector) const 
+//______________________________________________________________________________________________
+Bool_t AliShuttleConfig::HostProcessDetector(const char* detector) const
 {
        // return TRUE if detector is handled by host or if fProcessAll is TRUE
 
 {
        // return TRUE if detector is handled by host or if fProcessAll is TRUE
 
@@ -388,6 +401,7 @@ Bool_t AliShuttleConfig::HostProcessDetector(const char* detector) const
        return kFALSE;
 }
 
        return kFALSE;
 }
 
+//______________________________________________________________________________________________
 void AliShuttleConfig::Print(Option_t* /*option*/) const 
 {
 // print configuration
 void AliShuttleConfig::Print(Option_t* /*option*/) const 
 {
 // print configuration
index 28a644c525e58e413d1599805930654702826752..9f8f778cfd84f431595622668037993d780210c4 100644 (file)
@@ -15,6 +15,9 @@
 
 /*
  $Log$
 
 /*
  $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)
 
  Revision 1.3  2006/06/12 09:11:16  jgrosseo
  coding conventions (Alberto)
 
@@ -214,7 +217,7 @@ void AliShuttleTrigger::Run() {
 
 //______________________________________________________________________________________________
 Bool_t AliShuttleTrigger::RetrieveDATEEntries(const char* whereClause,
 
 //______________________________________________________________________________________________
 Bool_t AliShuttleTrigger::RetrieveDATEEntries(const char* whereClause,
-               TObjArray& entries, Int_t& lastRun) 
+               TObjArray& entries)
 {
 // Retrieve start time and end time for all runs in the DAQ logbook
 // that aren't processed yet
 {
 // Retrieve start time and end time for all runs in the DAQ logbook
 // that aren't processed yet
@@ -253,8 +256,6 @@ Bool_t AliShuttleTrigger::RetrieveDATEEntries(const char* whereClause,
                return kFALSE;
        }
 
                return kFALSE;
        }
 
-       lastRun = 0;
-
        TSQLRow* aRow;
        while ((aRow = aResult->Next())) {
                TString runString(aRow->GetField(0), aRow->GetFieldLength(0));
        TSQLRow* aRow;
        while ((aRow = aResult->Next())) {
                TString runString(aRow->GetField(0), aRow->GetFieldLength(0));
@@ -285,15 +286,12 @@ Bool_t AliShuttleTrigger::RetrieveDATEEntries(const char* whereClause,
                }
 
                entries.AddLast(new AliShuttleTriggerDATEEntry(run, startTime, endTime));
                }
 
                entries.AddLast(new AliShuttleTriggerDATEEntry(run, startTime, endTime));
-               if (lastRun < run) {
-                       lastRun = run;
-               }
                delete aRow;
        }
 
        delete aResult;
        
                delete aRow;
        }
 
        delete aResult;
        
-       aServer->Shutdown();
+       aServer->Close();
        delete aServer;
 
        entries.SetOwner(1);
        delete aServer;
 
        entries.SetOwner(1);
@@ -302,7 +300,7 @@ Bool_t AliShuttleTrigger::RetrieveDATEEntries(const char* whereClause,
 }
 
 //______________________________________________________________________________________________
 }
 
 //______________________________________________________________________________________________
-Bool_t AliShuttleTrigger::RetrieveConditionsData(const TObjArray& dateEntries)
+Bool_t AliShuttleTrigger::RetrieveConditionsData(const TObjArray& dateEntries, Int_t &lastRun)
 {
 // Retrieve conditions data for all runs that aren't processed yet
 
 {
 // Retrieve conditions data for all runs that aren't processed yet
 
@@ -310,19 +308,24 @@ Bool_t AliShuttleTrigger::RetrieveConditionsData(const TObjArray& dateEntries)
 
        TIter iter(&dateEntries);
        AliShuttleTriggerDATEEntry* anEntry;
 
        TIter iter(&dateEntries);
        AliShuttleTriggerDATEEntry* anEntry;
+       lastRun=-1;
        while ((anEntry = (AliShuttleTriggerDATEEntry*) iter.Next())) {
        while ((anEntry = (AliShuttleTriggerDATEEntry*) iter.Next())) {
+               Bool_t processError = kFALSE;
+               if(lastRun == -1) lastRun = anEntry->GetRun();
                if(!fShuttle->Process(anEntry->GetRun(),
                                anEntry->GetStartTime(),
                                anEntry->GetEndTime())) {
                if(!fShuttle->Process(anEntry->GetRun(),
                                anEntry->GetStartTime(),
                                anEntry->GetEndTime())) {
-                       hasError = kTRUE;
+                                       processError = kTRUE;
+                                       hasError = kTRUE;
                }
                }
+               if(!processError) lastRun = anEntry->GetRun();
        }
 
        }
 
-       return !hasError;
+       return hasError == kFALSE;
 }
 
 //______________________________________________________________________________________________
 }
 
 //______________________________________________________________________________________________
-Bool_t AliShuttleTrigger::Collect(Int_t run) 
+Bool_t AliShuttleTrigger::Collect(Int_t run)
 {
        //
        // Collects conditions date for the given run.
 {
        //
        // Collects conditions date for the given run.
@@ -333,9 +336,8 @@ Bool_t AliShuttleTrigger::Collect(Int_t run)
        TString whereClause("where run = ");
        whereClause += run;
 
        TString whereClause("where run = ");
        whereClause += run;
 
-       Int_t lastRun;
        TObjArray dateEntries;
        TObjArray dateEntries;
-       if (!RetrieveDATEEntries(whereClause, dateEntries, lastRun)) {
+       if (!RetrieveDATEEntries(whereClause, dateEntries)) {
                AliError("Can't retrieve entries from DAQ log book.");
                return kFALSE;
         }
                AliError("Can't retrieve entries from DAQ log book.");
                return kFALSE;
         }
@@ -351,7 +353,8 @@ Bool_t AliShuttleTrigger::Collect(Int_t run)
                return kFALSE;
        }
 
                return kFALSE;
        }
 
-       if (!RetrieveConditionsData(dateEntries)) {
+       Int_t lastRun;
+       if (!RetrieveConditionsData(dateEntries, lastRun)) {
                AliError("An error occured during conditions data retrieval!");
                return kFALSE;
        }
                AliError("An error occured during conditions data retrieval!");
                return kFALSE;
        }
@@ -383,10 +386,11 @@ Bool_t AliShuttleTrigger::CollectNew()
                }
                AliDCSValue* simpleValue = (AliDCSValue*) anObject;
                lastRun = simpleValue->GetInt();
                }
                AliDCSValue* simpleValue = (AliDCSValue*) anObject;
                lastRun = simpleValue->GetInt();
+               AliInfo(Form("Last run successfully stored: %d",lastRun));
                delete cdbEntry;
        } else {
                delete cdbEntry;
        } else {
-               AliWarning("There isn't last run stored! Starting from run 21200");
-               lastRun = 21200; // TODO maybe exit here
+               AliWarning("There isn't last run stored! Starting from run 21240");
+               lastRun = 21240; // TODO maybe exit here
        }
 
        AliInfo(Form("Last run number <%d>", lastRun));
        }
 
        AliInfo(Form("Last run number <%d>", lastRun));
@@ -396,11 +400,16 @@ Bool_t AliShuttleTrigger::CollectNew()
 
        Int_t newLastRun;
        TObjArray dateEntries;
 
        Int_t newLastRun;
        TObjArray dateEntries;
-       if (!RetrieveDATEEntries(whereClause, dateEntries, newLastRun)) {
+       if (!RetrieveDATEEntries(whereClause, dateEntries)) {
                AliError("Can't retrieve entries from DAQ log book.");
                return kFALSE;
        }
 
                AliError("Can't retrieve entries from DAQ log book.");
                return kFALSE;
        }
 
+       if (!RetrieveConditionsData(dateEntries, newLastRun)) {
+               AliError("Process of at least one run failed!");
+               // return kFALSE;
+       }
+       
        if (newLastRun > lastRun) {
                AliDCSValue lastRunObj(newLastRun, 0);
                AliCDBMetaData metaData;
        if (newLastRun > lastRun) {
                AliDCSValue lastRunObj(newLastRun, 0);
                AliCDBMetaData metaData;
@@ -415,11 +424,7 @@ Bool_t AliShuttleTrigger::CollectNew()
                }
        }
 
                }
        }
 
-       if (!RetrieveConditionsData(dateEntries)) {
-               AliError("An error occured during conditions data retrieval!");
-               return kFALSE;
-       }
-
+       
        return kTRUE;
 }
 
        return kTRUE;
 }
 
@@ -434,12 +439,12 @@ Bool_t AliShuttleTrigger::CollectAll()
 
        Int_t lastRun;
        TObjArray dateEntries;
 
        Int_t lastRun;
        TObjArray dateEntries;
-       if (!RetrieveDATEEntries("", dateEntries, lastRun)) {
+       if (!RetrieveDATEEntries("", dateEntries)) {
                AliError("Can't retrieve entries from DAQ log book.");
                return kFALSE;
        }
 
                AliError("Can't retrieve entries from DAQ log book.");
                return kFALSE;
        }
 
-       if (!RetrieveConditionsData(dateEntries)) {
+       if (!RetrieveConditionsData(dateEntries, lastRun)) {
                AliError("An error occured during conditions data retrieval!");
                return kFALSE;
        }
                AliError("An error occured during conditions data retrieval!");
                return kFALSE;
        }
index bd453c836424175c27cb37c47670e620b36f9ec6..804a0e2abb01ce5a2f9a179ef75e8875ad95f38f 100644 (file)
@@ -82,9 +82,8 @@ private:
                ClassDef(AliShuttleTriggerDATEEntry, 0)
        };
 
                ClassDef(AliShuttleTriggerDATEEntry, 0)
        };
 
-       Bool_t RetrieveDATEEntries(const char* whereClause, TObjArray& entries,
-                       Int_t& lastRun);
-       Bool_t RetrieveConditionsData(const TObjArray& dateEntries);
+       Bool_t RetrieveDATEEntries(const char* whereClause, TObjArray& entries);
+       Bool_t RetrieveConditionsData(const TObjArray& dateEntries, Int_t& lastRun);
 
        const AliShuttleConfig* fConfig;
        //AliCDBStorage* fLocalStorage;
 
        const AliShuttleConfig* fConfig;
        //AliCDBStorage* fLocalStorage;