introducing strict run ordering flag
authorjgrosseo <jgrosseo@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 16 Nov 2006 16:16:48 +0000 (16:16 +0000)
committerjgrosseo <jgrosseo@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 16 Nov 2006 16:16:48 +0000 (16:16 +0000)
removed giving preprocessor name to preprocessor, they have to know their name themselves ;-)

14 files changed:
SHUTTLE/AliShuttle.cxx
SHUTTLE/AliShuttle.h
SHUTTLE/AliShuttleConfig.cxx
SHUTTLE/AliShuttleConfig.h
SHUTTLE/AliShuttleTrigger.cxx
SHUTTLE/Shuttle.C
SHUTTLE/schema/shuttle.schema
SHUTTLE/test/TestITSPreprocessorSPD.cxx
SHUTTLE/test/TestITSPreprocessorSPD.h
SHUTTLE/test/TestRICHPreprocessor.cxx
SHUTTLE/test/TestRICHPreprocessor.h
SHUTTLE/test/TestShuttleLogbook.C
SHUTTLE/test/TestZDCPreprocessor.cxx
SHUTTLE/test/TestZDCPreprocessor.h

index abc17f0..afa94a7 100644 (file)
 
 /*
 $Log$
+Revision 1.19  2006/11/06 14:23:04  jgrosseo
+major update (Alberto)
+o) reading of run parameters from the logbook
+o) online offline naming conversion
+o) standalone DCSclient package
+
 Revision 1.18  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
@@ -184,12 +190,16 @@ fLastAction()
        //
 
        if (!fConfig->IsValid()) AliFatal("********** !!!!! Invalid configuration !!!!! **********");
-       for(int iSys=0;iSys<3;iSys++) {
+       for(int iSys=0;iSys<4;iSys++) {
                fServer[iSys]=0;
-               fFESlist[iSys].SetOwner(kTRUE);
+               if (iSys < 3)
+                       fFESlist[iSys].SetOwner(kTRUE);
        }
        fPreprocessorMap.SetOwner(kTRUE);
-       
+
+       for (UInt_t iDet=0; iDet<NDetectors(); iDet++)
+               fFirstUnprocessed[iDet] = kFALSE;
+
        fMonitoringMutex = new TMutex();
 }
 
@@ -199,7 +209,7 @@ AliShuttle::~AliShuttle()
 // destructor
 
        fPreprocessorMap.DeleteAll();
-       for(int iSys=0;iSys<3;iSys++)
+       for(int iSys=0;iSys<4;iSys++)
                if(fServer[iSys]) {
                        fServer[iSys]->Close();
                        delete fServer[iSys];
@@ -439,6 +449,15 @@ Bool_t AliShuttle::ContinueProcessing()
        }
 
        // if we get here, according to Shuttle logbook subdetector is in UNPROCESSED state
+
+       // check if current run is first unprocessed run for current detector
+       if (fConfig->StrictRunOrder(fCurrentDetector) &&
+               !fFirstUnprocessed[GetDetPos(fCurrentDetector)])
+       {
+               Log("SHUTTLE", Form("ContinueProcessing - %s requires strict run ordering but this is not the first unprocessed run!"));
+               return kFALSE;
+       }
+
        AliShuttleStatus* status = ReadShuttleStatus();
        if (!status) {
                // first time
@@ -537,15 +556,17 @@ Bool_t AliShuttle::Process(AliShuttleLogbookEntry* entry)
        TIter iter(fConfig->GetDetectors());
        TObjString* aDetector = 0;
 
-       while ((aDetector = (TObjString*) iter.Next())) {
+       while ((aDetector = (TObjString*) iter.Next()))
+       {
                fCurrentDetector = aDetector->String();
 
                if (!fConfig->HostProcessDetector(fCurrentDetector)) continue;
 
                AliPreprocessor* aPreprocessor =
                        dynamic_cast<AliPreprocessor*> (fPreprocessorMap.GetValue(fCurrentDetector));
-               if(!aPreprocessor){
-                       Log("SHUTTLE",Form("Process - %s: no preprocessor registered. Skipping", 
+               if (!aPreprocessor)
+               {
+                       Log("SHUTTLE",Form("Process - %s: no preprocessor registered. Skipping",
                                                        fCurrentDetector.Data()));
                        continue;
                }
@@ -556,104 +577,112 @@ Bool_t AliShuttle::Process(AliShuttleLogbookEntry* entry)
                                                GetCurrentRun(), aDetector->GetName()));
 
 
-    Int_t pid = fork();
-
-    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()));
-
-      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!!!");
-    }
+               Int_t pid = fork();
+
+               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()));
+
+                       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",
@@ -663,14 +692,30 @@ Bool_t AliShuttle::Process(AliShuttleLogbookEntry* entry)
        TObjArray checkEntryArray;
        checkEntryArray.SetOwner(1);
        TString whereClause = Form("where run=%d",GetCurrentRun());
-       if(QueryShuttleLogbook(whereClause.Data(), checkEntryArray)) {
+       if (QueryShuttleLogbook(whereClause.Data(), checkEntryArray)) {
 
                AliShuttleLogbookEntry* checkEntry = dynamic_cast<AliShuttleLogbookEntry*>
                                                        (checkEntryArray.At(0));
 
-               if(checkEntry && checkEntry->IsDone()){
-                       Log("SHUTTLE","Process - Shuttle is DONE. Updating logbook");
-                       UpdateShuttleLogbook("shuttle_done");
+               if (checkEntry)
+               {
+                       if (checkEntry->IsDone())
+                       {
+                               Log("SHUTTLE","Process - Shuttle is DONE. Updating logbook");
+                               UpdateShuttleLogbook("shuttle_done");
+                       }
+                       else
+                       {
+                               for (UInt_t iDet=0; iDet<NDetectors(); iDet++)
+                               {
+                                       if (checkEntry->GetDetectorStatus(iDet) == AliShuttleLogbookEntry::kUnprocessed)
+                                       {
+                                               AliDebug(2, Form("Run %d: setting %s as \"not first time unprocessed\"",
+                                                               checkEntry->GetRun(), GetDetName(iDet)));
+                                               fFirstUnprocessed[iDet] = kFALSE;
+                                       }
+                               }
+                       }
                }
        }
 
@@ -761,12 +806,12 @@ Bool_t AliShuttle::QueryShuttleLogbook(const char* whereClause,
 // Call QueryRunParameters to query DAQ logbook for run parameters.
 
        // check connection, in case connect
-       if(!Connect(kDAQ)) return kFALSE;
+       if(!Connect(3)) return kFALSE;
 
        TString sqlQuery;
        sqlQuery = Form("select * from logbook_shuttle %s order by run", whereClause);
 
-       TSQLResult* aResult = fServer[kDAQ]->Query(sqlQuery);
+       TSQLResult* aResult = fServer[3]->Query(sqlQuery);
        if (!aResult) {
                AliError(Form("Can't execute query <%s>!", sqlQuery.Data()));
                return kFALSE;
@@ -826,13 +871,13 @@ AliShuttleLogbookEntry* AliShuttle::QueryRunParameters(Int_t run)
        //
 
        // check connection, in case connect
-       if (!Connect(kDAQ))
+       if (!Connect(3))
                return 0;
 
        TString sqlQuery;
        sqlQuery.Form("select * from logbook where run=%d", run);
 
-       TSQLResult* aResult = fServer[kDAQ]->Query(sqlQuery);
+       TSQLResult* aResult = fServer[3]->Query(sqlQuery);
        if (!aResult) {
                AliError(Form("Can't execute query <%s>!", sqlQuery.Data()));
                return 0;
@@ -952,11 +997,18 @@ Bool_t AliShuttle::TryToStoreAgain(TString& gridURI)
                TIter gridIter(gridIds);
                AliCDBId* aGridId = 0;
                while((aGridId = dynamic_cast<AliCDBId*> (gridIter.Next()))){
-                       // If local object is valid up to infinity we store it anyway
-                       // TODO This does not work! It may hide more recent objects...
-                       if(aLocId.GetLastRun() == AliCDBRunRange::Infinity()) {
-                               // TODO Check that it won't hide more recent files! how????
-                               break;
+                       // If local object is valid up to infinity we store it only if it is
+                       // the first unprocessed run!
+                       if (aLocId.GetLastRun() == AliCDBRunRange::Infinity())
+                       {
+                               if (!fFirstUnprocessed[GetDetPos(fCurrentDetector)])
+                               {
+                                       Log(fCurrentDetector.Data(),
+                                               ("TryToStoreAgain - This object has validity infinite but there are previous unprocessed runs!"));
+                                       continue;
+                               } else {
+                                       break;
+                               }
                        }
                        if(aGridId->GetPath() != aLocId.GetPath()) continue;
                        // skip all objects valid up to infinity
@@ -1092,14 +1144,29 @@ Bool_t AliShuttle::Connect(Int_t system)
        // check connection: if already connected return
        if(fServer[system] && fServer[system]->IsConnected()) return kTRUE;
 
-       TString aFESlbHost= Form("mysql://%s", fConfig->GetFESlbHost(system));
+       TString lbHost, lbUser, lbPass;
+
+       if (system < 3) // FES logbook servers
+       {
+               lbHost = Form("mysql://%s", fConfig->GetFESlbHost(system));
+               lbUser = fConfig->GetFESlbUser(system);
+               lbPass = fConfig->GetFESlbPass(system);
+       } else { // Run & Shuttle logbook servers
+       // TODO Will the Shuttle logbook server be the same as the Run logbook server ???
+               lbHost = Form("mysql://%s", fConfig->GetDAQlbHost());
+               lbUser = fConfig->GetDAQlbUser();
+               lbPass = fConfig->GetDAQlbPass();
+       }
 
-       fServer[system] = TSQLServer::Connect(aFESlbHost,
-                       fConfig->GetFESlbUser(system),
-                       fConfig->GetFESlbPass(system));
+       fServer[system] = TSQLServer::Connect(lbHost.Data(), lbUser.Data(), lbPass.Data());
        if (!fServer[system] || !fServer[system]->IsConnected()) {
+               if(system < 3)
+               {
                AliError(Form("Can't establish connection to FES logbook for %s",
                                        AliShuttleInterface::GetSystemName(system)));
+               } else {
+               AliError("Can't establish connection to Run logbook.");
+               }
                if(fServer[system]) delete fServer[system];
                return kFALSE;
        }
@@ -1118,6 +1185,7 @@ Bool_t AliShuttle::Connect(Int_t system)
                        //aResult = fServer[kHLT]->GetTables("REFSYSLOG");
                        break;
                default:
+                       aResult = fServer[3]->GetTables("REFSYSLOG");
                        break;
        }
 
@@ -1380,7 +1448,7 @@ Bool_t AliShuttle::UpdateDAQTable()
 
                // Query execution
                TSQLResult* aResult;
-               aResult = dynamic_cast<TSQLResult*> (fServer[kDAQ]->Query(sqlQuery));
+               aResult = dynamic_cast<TSQLResult*> (fServer[3]->Query(sqlQuery));
                if (!aResult) {
                        Log(fCurrentDetector, Form("UpdateDAQTable - Can't execute SQL query <%s>", sqlQuery.Data()));
                        return kFALSE;
@@ -1399,7 +1467,7 @@ Bool_t AliShuttle::UpdateShuttleLogbook(const char* detector, const char* status
 // ex. of usage: UpdateShuttleLogbook("PHOS", "DONE") or UpdateShuttleLogbook("shuttle_done")
 
        // check connection, in case connect
-       if(!Connect(kDAQ)){
+       if(!Connect(3)){
                Log("SHUTTLE", "UpdateShuttleLogbook - Couldn't connect to DAQ Logbook.");
                return kFALSE;
        }
@@ -1430,7 +1498,7 @@ Bool_t AliShuttle::UpdateShuttleLogbook(const char* detector, const char* status
 
        // Query execution
        TSQLResult* aResult;
-       aResult = dynamic_cast<TSQLResult*> (fServer[kDAQ]->Query(sqlQuery));
+       aResult = dynamic_cast<TSQLResult*> (fServer[3]->Query(sqlQuery));
        if (!aResult) {
                Log("SHUTTLE", Form("UpdateShuttleLogbook - Can't execute query <%s>", sqlQuery.Data()));
                return kFALSE;
@@ -1525,12 +1593,47 @@ Bool_t AliShuttle::Collect(Int_t run)
                whereClause += Form(" and run=%d", run);
 
        TObjArray shuttleLogbookEntries;
-       if (!QueryShuttleLogbook(whereClause, shuttleLogbookEntries)) {
+       if (!QueryShuttleLogbook(whereClause, shuttleLogbookEntries))
+       {
                Log("SHUTTLE", "Collect - Can't retrieve entries from Shuttle logbook");
                return kFALSE;
        }
 
-       if (!RetrieveConditionsData(shuttleLogbookEntries)) {
+       for (UInt_t iDet=0; iDet<NDetectors(); iDet++)
+               fFirstUnprocessed[iDet] = kTRUE;
+
+       if (run != 1)
+       {
+               // query Shuttle logbook for earlier runs, check if some detectors are unprocessed,
+               // flag them into fFirstUnprocessed array
+               TString whereClause(Form("where shuttle_done=0 and run < %d", run));
+               TObjArray tmpLogbookEntries;
+               if (!QueryShuttleLogbook(whereClause, tmpLogbookEntries))
+               {
+                       Log("SHUTTLE", "Collect - Can't retrieve entries from Shuttle logbook");
+                       return kFALSE;
+               }
+
+               TIter iter(&tmpLogbookEntries);
+               AliShuttleLogbookEntry* anEntry = 0;
+               while ((anEntry = dynamic_cast<AliShuttleLogbookEntry*> (iter.Next())))
+               {
+                       for (UInt_t iDet=0; iDet<NDetectors(); iDet++)
+                       {
+                               if (anEntry->GetDetectorStatus(iDet) == AliShuttleLogbookEntry::kUnprocessed)
+                               {
+                                       AliDebug(2, Form("Run %d: setting %s as \"not first time unprocessed\"",
+                                                       anEntry->GetRun(), GetDetName(iDet)));
+                                       fFirstUnprocessed[iDet] = kFALSE;
+                               }
+                       }
+
+               }
+
+       }
+
+       if (!RetrieveConditionsData(shuttleLogbookEntries))
+       {
                Log("SHUTTLE", "Collect - Process of at least one run failed");
                return kFALSE;
        }
@@ -1563,7 +1666,7 @@ ULong_t AliShuttle::GetTimeOfLastAction() const
        ULong_t tmp;
        
        fMonitoringMutex->Lock();
-       
+
        tmp = fLastActionTime;
        
        fMonitoringMutex->UnLock();
index 7eeb10c..037d176 100644 (file)
@@ -134,17 +134,19 @@ private:
        AliShuttleLogbookEntry* fLogbookEntry;   //! current Shuttle logbook entry
        TString fCurrentDetector; // current detector
 
-       TSQLServer *fServer[3];         // pointer to the three FS logbook servers
+       TSQLServer *fServer[4];         // pointer to the three FES + Run & Shuttle logbook servers
        Bool_t fFESCalled[3];           // FES call status
        TList  fFESlist[3];             // List of files retrieved from each FES
 
        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
 
+       Bool_t fFirstUnprocessed[AliShuttleInterface::kNDetectors];       // array of flags for first unprocessed dets
+
        //TODO Test only, remove later !
        static Bool_t fgkProcessDCS; // flag to enable DCS archive data processing
 
index 38132a6..3bd0902 100644 (file)
 
 /*
 $Log$
+Revision 1.11  2006/11/06 14:23:04  jgrosseo
+major update (Alberto)
+o) reading of run parameters from the logbook
+o) online offline naming conversion
+o) standalone DCSclient package
+
 Revision 1.10  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
@@ -103,7 +109,8 @@ fDetector(""),
 fDCSHost(""),
 fDCSPort(0),
 fIsValid(kFALSE),
-fSkipDCSQuery(kFALSE)
+fSkipDCSQuery(kFALSE),
+fStrictRunOrder(kFALSE)
 {
 // constructor of the shuttle configuration holder
 
@@ -114,6 +121,21 @@ fSkipDCSQuery(kFALSE)
        anAttribute = entry->GetAttribute("det"); // MUST
        fDetector = anAttribute->GetValue();
 
+       anAttribute = entry->GetAttribute("StrictRunOrder"); // MAY
+        if (!anAttribute)
+       {
+               AliWarning(Form("%s did not set StrictRunOrder flag - the default is FALSE",
+                               fDetector.Data()));
+        } else {
+               TString strictRunStr = anAttribute->GetValue();
+               if (!(strictRunStr == "0" || strictRunStr == "1"))
+               {
+                       AliError("Invalid configuration! StrictRunOrder flag must be 0 or 1!");
+                       return;
+               }
+               fStrictRunOrder = (Bool_t) strictRunStr.Atoi();
+       }
+
        anAttribute = entry->GetAttribute("DCSHost"); // MAY
        if (!anAttribute) {
                AliWarning(
@@ -499,6 +521,22 @@ Bool_t AliShuttleConfig::HostProcessDetector(const char* detector) const
 }
 
 //______________________________________________________________________________________________
+Bool_t AliShuttleConfig::StrictRunOrder(const char* detector) const
+{
+       // return TRUE if detector wants strict run ordering of stored data
+
+       AliShuttleConfigHolder* aHolder = (AliShuttleConfigHolder*) fDetectorMap.GetValue(detector);
+        if (!aHolder)
+       {
+                AliError(Form("There isn't configuration for detector: %s",
+                        detector));
+                return kTRUE;
+        }
+
+       return aHolder->StrictRunOrder();
+}
+
+//______________________________________________________________________________________________
 void AliShuttleConfig::Print(Option_t* /*option*/) const
 {
 // print configuration
@@ -542,8 +580,13 @@ void AliShuttleConfig::Print(Option_t* /*option*/) const
        TPair* aPair;
        while ((aPair = (TPair*) iter.Next())) {
                AliShuttleConfigHolder* aHolder = (AliShuttleConfigHolder*) aPair->Value();
-               if(aHolder->SkipDCSQuery()) continue;
-               result += Form("DCS archive DB configuration for *** %s *** \n", aHolder->GetDetector());
+               result += Form("Detector-specific configuration: *** %s *** \n", aHolder->GetDetector());
+               result += Form("\tStrict run ordering flag: %s \n", aHolder->StrictRunOrder() ? "TRUE" : "FALSE");
+               if(aHolder->SkipDCSQuery())
+               {
+                       result += "\n\n";
+                       continue;
+               }
                result += Form("\tAmanda server: %s:%d \n", aHolder->GetDCSHost(), aHolder->GetDCSPort());
 
                result += "\tDCS Aliases: ";
index 9906c3b..dcabee4 100644 (file)
@@ -49,6 +49,7 @@ public:
        const char* GetDCSHost(const char* detector) const;
        Int_t GetDCSPort(const char* detector) const;
        const TObjArray* GetDCSAliases(const char* detector) const;
+       Bool_t StrictRunOrder(const char* detector) const;
 
        void SetProcessAll(Bool_t flag=kTRUE) {fProcessAll=flag;}
        Bool_t ProcessAll() const {return fProcessAll;}
@@ -71,6 +72,7 @@ private:
 
                Bool_t IsValid() const {return fIsValid;}
                Bool_t SkipDCSQuery() const {return fSkipDCSQuery;}
+               Bool_t StrictRunOrder() const {return fStrictRunOrder;}
 
        private:
                TString fDetector;      // Detector name
@@ -79,6 +81,7 @@ private:
                TObjArray* fDCSAliases; // List of DCS aliases to be retrieved
                Bool_t fIsValid;        // flag for the validity of the configuration
                Bool_t fSkipDCSQuery;   // flag - if TRUE (-> DCS config empty) skip DCS archive data query
+               Bool_t fStrictRunOrder; // flag - if TRUE connect data in a strict run ordering
 
 
                ClassDef(AliShuttleConfigHolder, 0);
@@ -103,7 +106,7 @@ private:
 
        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
index 1716fd9..c789f6b 100644 (file)
 
 /*
  $Log$
+ 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
+ o) Removing implementation of empty copy constructors (declaration still there!)
+
  Revision 1.11  2006/10/02 16:38:39  jgrosseo
  update (alberto):
  fixed memory leaks
@@ -120,8 +125,8 @@ AliShuttleTrigger::AliShuttleTrigger(const AliShuttleConfig* config,
 
        fShuttle = new AliShuttle(config, timeout, retries);
 
-  TerminateSignalHandler* fQuitSignalHandler = new TerminateSignalHandler(this, kSigQuit);
-  TerminateSignalHandler* fInterruptSignalHandler = new TerminateSignalHandler(this, kSigInterrupt);
+       TerminateSignalHandler* fQuitSignalHandler = new TerminateSignalHandler(this, kSigQuit);
+       TerminateSignalHandler* fInterruptSignalHandler = new TerminateSignalHandler(this, kSigInterrupt);
 
        gSystem->AddSignalHandler(fQuitSignalHandler);
        gSystem->AddSignalHandler(fInterruptSignalHandler);
index a9717e7..a5077d0 100644 (file)
@@ -39,13 +39,13 @@ Bool_t Shuttle(const char* param = "listen") {
 
        // Add here detectors preprocessor ...
        TestTPCPreprocessor *tpcPrep = new TestTPCPreprocessor(shuttle);
-       TestITSPreprocessorSPD *spdPrep = new TestITSPreprocessorSPD("SPD",shuttle);
-       TestRICHPreprocessor *richPrep = new TestRICHPreprocessor("HMP",shuttle);
-       TestZDCPreprocessor *zdcPrep = new TestZDCPreprocessor("ZDC",shuttle);
+       TestITSPreprocessorSPD *spdPrep = new TestITSPreprocessorSPD(shuttle);
+       TestRICHPreprocessor *richPrep = new TestRICHPreprocessor(shuttle);
+       TestZDCPreprocessor *zdcPrep = new TestZDCPreprocessor(shuttle);
 
        TString paramStr(param);
        
-       if (paramStr.IsDigit()) {
+       if (paramStr.IsDigit() || paramStr == "-1") {
                Int_t run = paramStr.Atoi();
                trigger.Collect(run);
        } else if (paramStr == "new") {
index 9237764..ef6841a 100644 (file)
@@ -6,13 +6,14 @@ attributetype ( DETECTOR_CONFIG:1 NAME 'det'         DESC 'Detector name'
 attributetype ( DETECTOR_CONFIG:2 NAME 'DCSHost'     DESC ''                      EQUALITY caseIgnoreMatch    SUP name )
 attributetype ( DETECTOR_CONFIG:3 NAME 'DCSPort'     DESC ''                                                  SUP ipServicePort )
 attributetype ( DETECTOR_CONFIG:4 NAME 'DCSalias'    DESC ''                      EQUALITY caseIgnoreMatch    SUP name )
+attributetype ( DETECTOR_CONFIG:5 NAME 'StrictRunOrder' DESC 'Strict run ordering flag' EQUALITY caseIgnoreMatch SUP name )
 
 objectclass ( DETECTOR_CONFIG
         NAME 'AliShuttleDetector'
         DESC 'ALICE: Shuttle configuration object.'
         SUP top
         MUST (det)
-        MAY  (DCSHost $ DCSPort $ DCSalias) )
+        MAY  (DCSHost $ DCSPort $ DCSalias $ StrictRunOrder) )
 
 
 objectidentifier SYS_CONFIG SHUTTLE_BASE:2
index e7e3eac..c185088 100644 (file)
@@ -36,8 +36,8 @@ TestITSPreprocessorSPD::TestITSPreprocessorSPD():
 }
 
 //________________________________________________________________________________________
-TestITSPreprocessorSPD::TestITSPreprocessorSPD(const char* detector, AliShuttleInterface* shuttle):
-       AliPreprocessor(detector,shuttle)
+TestITSPreprocessorSPD::TestITSPreprocessorSPD(AliShuttleInterface* shuttle):
+       AliPreprocessor("SPD", shuttle)
 {
 // constructor - shuttle must be instantiated!
 
@@ -69,6 +69,6 @@ UInt_t TestITSPreprocessorSPD::Process(TMap* valueMap)
        AliCDBMetaData metaData;
        metaData.SetComment("This is a test!");
 
-       return Store("Calib", "ITSDataSPD", valueMap, &metaData);
+       return Store("Calib", "ITSDataSPD", valueMap, &metaData, 0, kTRUE);
 }
 
index 75ecd2c..0792cf6 100644 (file)
@@ -10,7 +10,7 @@
 class TestITSPreprocessorSPD: public AliPreprocessor {
 public:
        TestITSPreprocessorSPD();
-       TestITSPreprocessorSPD(const char* detector, AliShuttleInterface* shuttle);
+       TestITSPreprocessorSPD(AliShuttleInterface* shuttle);
 
 protected:
 
index f4a761d..29057bb 100644 (file)
@@ -39,8 +39,8 @@ TestRICHPreprocessor::TestRICHPreprocessor():
 }
 
 //________________________________________________________________________________________
-TestRICHPreprocessor::TestRICHPreprocessor(const char* detector, AliShuttleInterface* shuttle):
-       AliPreprocessor(detector,shuttle)
+TestRICHPreprocessor::TestRICHPreprocessor(AliShuttleInterface* shuttle):
+       AliPreprocessor("HMP", shuttle)
 {
 // constructor - shuttle must be instantiated!
 
@@ -94,8 +94,8 @@ UInt_t TestRICHPreprocessor::Process(TMap* /*valueMap*/)
                printf("\n\n Getting file #%d\n",++i);
                //if(i==1) continue;
                TString filename = GetFile(AliShuttleInterface::kDAQ, "thresholds.txt", source->GetName());
-               if(!filename.Data()) {
-                       AliError(Form("Error retrieving file from source %d failed!", source->GetName()));
+               if(!filename.Length()) {
+                       AliError(Form("Error: retrieval of file from source %s failed!", source->GetName()));
                        delete filesources;
                        return 0;
                }
index 49dc02f..432207f 100644 (file)
@@ -10,7 +10,7 @@
 class TestRICHPreprocessor: public AliPreprocessor {
 public:
        TestRICHPreprocessor();
-       TestRICHPreprocessor(const char* detector, AliShuttleInterface* shuttle);
+       TestRICHPreprocessor(AliShuttleInterface* shuttle);
 
 protected:
 
index af32254..a2a71cc 100644 (file)
@@ -279,15 +279,21 @@ Bool_t DeleteEntries(Int_t runNumber=-1)
 void TestShuttleLogbook(){
 
        gSystem->Load("libSHUTTLE.so");
+       
+       DeleteEntries();
 
        AliShuttleLogbookEntry::Status y[17]={1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};
-       AliShuttleLogbookEntry lb(21242,0,0,y);
+       AliShuttleLogbookEntry lb(21242, y);
        lb.SetDetectorStatus("HMP","Unprocessed"); // RICH
-       lb.SetDetectorStatus("ZDC","Done"); // ZDC
+       lb.SetDetectorStatus("ZDC","Unprocessed"); // ZDC
        lb.SetDetectorStatus("TPC","Unprocessed"); // TPC
+       lb.SetDetectorStatus("SPD","Unprocessed"); // SPD
        lb.Print();
 
        InsertNewRun(lb);
+       InsertNewRun(lb,21243);
        InsertNewRun(lb,21244);
+       InsertNewRun(lb,21245);
+       InsertNewRun(lb,21246);
 
 }
index 54cd284..a46d1b2 100644 (file)
@@ -39,8 +39,8 @@ TestZDCPreprocessor::TestZDCPreprocessor():
 }
 
 //________________________________________________________________________________________
-TestZDCPreprocessor::TestZDCPreprocessor(const char* detector, AliShuttleInterface* shuttle):
-       AliPreprocessor(detector,shuttle)
+TestZDCPreprocessor::TestZDCPreprocessor(AliShuttleInterface* shuttle):
+       AliPreprocessor("ZDC",shuttle)
 {
 // constructor - shuttle must be instantiated!
 
index 911704e..808bdea 100644 (file)
@@ -10,7 +10,7 @@
 class TestZDCPreprocessor: public AliPreprocessor {
 public:
        TestZDCPreprocessor();
-       TestZDCPreprocessor(const char* detector, AliShuttleInterface* shuttle);
+       TestZDCPreprocessor(AliShuttleInterface* shuttle);
 
 protected: