]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - SHUTTLE/AliShuttle.cxx
Corrected.
[u/mrichter/AliRoot.git] / SHUTTLE / AliShuttle.cxx
index 6116bf4cd2a5234ed1c81b706def495536db8bb2..a804d77acaec0abd32bdc330a75730790ed72698 100644 (file)
@@ -1215,7 +1215,8 @@ Bool_t AliShuttle::ContinueProcessing()
                Bool_t increaseCount = kTRUE;
                if (status->GetStatus() == AliShuttleStatus::kDCSError || 
                    status->GetStatus() == AliShuttleStatus::kDCSStarted ||
-                   status->GetStatus() == AliShuttleStatus::kFXSError)
+                   status->GetStatus() == AliShuttleStatus::kFXSError ||
+                   status->GetStatus() == AliShuttleStatus::kOCDBError)
                                increaseCount = kFALSE;
                                
                UpdateShuttleStatus(AliShuttleStatus::kStarted, increaseCount);
@@ -1437,7 +1438,16 @@ Bool_t AliShuttle::Process(AliShuttleLogbookEntry* entry)
                                        AliShuttleStatus *currentStatus = ReadShuttleStatus();
                                        AliShuttleStatus::Status newStatus = AliShuttleStatus::kInvalid;
                                        
-                                       if (currentStatus->GetStatus() <= AliShuttleStatus::kPPDone)
+                                       if (currentStatus->GetStatus() == AliShuttleStatus::kDCSStarted)
+                                       {
+                                               // in case the pp goes in TimeOut while retrieving the DCS DPs
+                                               // set status to kDCSError
+                                               
+                                               logMsg.Form("Process - Process of %s timed out while retrieving the DCS DataPoints. Run time: %d seconds. Killing... and setting status to DCSError.",
+                                                               fCurrentDetector.Data(), expiredTime);
+                                               newStatus = AliShuttleStatus::kDCSError;
+                                       }
+                                       else if (currentStatus->GetStatus() <= AliShuttleStatus::kPPDone)
                                        {
                                                // in case pp not yet done set status to kPPTimeOut
                                        
@@ -1598,7 +1608,7 @@ Bool_t AliShuttle::Process(AliShuttleLogbookEntry* entry)
                        else if (success == 0)
                        {
                                Log("SHUTTLE", 
-                                       Form("\t\t\t****** run %d - %s: PP ERROR ******",
+                                       Form("\t\t\t****** run %d - %s: ERROR ******",
                                                GetCurrentRun(), aDetector->GetName()));
                        }
 
@@ -1696,6 +1706,15 @@ Int_t AliShuttle::ProcessCurrentDetector()
                return 2;
        }
        
+       // checking if OCDB is reachable
+       AliCDBEntry* testEntry = GetFromOCDB("SHUTTLE","GRP/CTP/DummyConfig");
+       if (!testEntry){
+               // OCDB is not accessible, going in OCDBError for current detector
+               AliError("OCDB Test entry not accessible");
+               UpdateShuttleStatus(AliShuttleStatus::kOCDBError);
+               return 0;
+       }
+
        TMap* dcsMap = new TMap();
        
        aPreprocessor->Initialize(GetCurrentRun(), GetCurrentStartTime(), GetCurrentEndTime());
@@ -2022,38 +2041,50 @@ AliShuttleLogbookEntry* AliShuttle::QueryRunParameters(Int_t run)
        UInt_t startTime = entry->GetStartTime();
        UInt_t endTime = entry->GetEndTime();
        Bool_t ecsSuccess = entry->GetECSSuccess();
-       
-       TString totEventsStr = entry->GetRunParameter("totalEvents");  
-       Int_t totEvents = totEventsStr.Atoi();
+       TString runType = entry->GetRunType();
+       TString tmpdaqstartTime = entry->GetRunParameter("DAQ_time_start");
+       UInt_t daqstartTime = tmpdaqstartTime.Atoi();
        
        UInt_t now = time(0);
-       // TODO make this a configuration parameter
        Int_t dcsDelay = fConfig->GetDCSDelay()+fConfig->GetDCSQueryOffset();
-       
-       // runs are accepted if they have ecsSuccess set or more than 1 event
-       if (startTime != 0 && endTime != 0 && endTime > startTime && (totEvents > 1 || ecsSuccess) && (endTime < now - dcsDelay))
-       {
-               if (ecsSuccess == kFALSE)
-                       Log("SHUTTLE", Form("Processing run %d although in status ECS failure, Reason: %s", run, entry->GetRunParameter("eor_reason")));
-               return entry;
-       }
 
        Bool_t skip = kFALSE;
                                
-       if (endTime != 0 && endTime >= now - dcsDelay)
-       {
-               Log("SHUTTLE", Form("Skipping run %d for now, because DCS buffer time is not yet expired", run));
-       }
-       else if (totEvents <= 1) 
-       {
-               Log("SHUTTLE", Form("QueryRunParameters - Run %d has 1 event or less - Skipping!", run));
-               skip = kTRUE;
-       }
-       else
-       {
-               Log("SHUTTLE", Form("QueryRunParameters - Invalid parameters for Run %d: "
-                       "startTime = %d, endTime = %d. Skipping (Shuttle won't be marked as DONE)!",
-                       run, startTime, endTime));
+       // runs are processed if
+       //   a) runType is PHYSICS and ecsSuccess is set
+       //   b) runType is not PHYSICS and (ecsSuccess is set or DAQ_time_start is non-0)
+       // effectively this means that all runs are processed that started properly (ecsSucess behaviour is different for PHYSICS and non-PHYSICS runs (check with ECS!)
+       if (startTime != 0 && endTime != 0) {
+               if (endTime > startTime) { 
+                       if (endTime >= now - dcsDelay) {
+                               Log("SHUTTLE", Form("Skipping run %d for now, because DCS buffer time is not yet expired", run));
+                       } else {
+                               if (runType == "PHYSICS") {
+                                       if (ecsSuccess) {
+                                               return entry;
+                                       } else {
+                                               Log("SHUTTLE", Form("QueryRunParameters - Run type for run %d is PHYSICS but ECS success flag not set (Reason = %s) - Skipping!", run, entry->GetRunParameter("eor_reason")));
+                                               skip = kTRUE;
+                                       } 
+                               } else {
+                                       if (ecsSuccess || daqstartTime > 0) {
+                                               if (ecsSuccess == kFALSE)
+                                                       Log("SHUTTLE", Form("Processing run %d although in status ECS failure (Reason: %s), since run type != PHYSICS and DAQ_time_start != 0", run, entry->GetRunParameter("eor_reason")));
+                                               return entry;
+                                       } else {
+                                               Log("SHUTTLE", Form("QueryRunParameters - Run type for run %d is %s, ECS success flag was not set (Reason = %s) and DAQ_time_start was NULL - Skipping!", run, runType.Data(), entry->GetRunParameter("eor_reason")));
+                                               skip = kTRUE;
+                                       }
+                               }
+                       }
+               } else {
+                       Log("SHUTTLE", Form("QueryRunParameters - Invalid parameters for run %d: startTime equal to endTime: %d %d - Skipping!", run, startTime, endTime));
+                       skip = kTRUE;
+               }
+       } else {
+         Log("SHUTTLE", Form("QueryRunParameters - Invalid parameters for Run %d: "
+                             "startTime = %d, endTime = %d. Skipping (Shuttle won't be marked as DONE)!",
+                             run, startTime, endTime));
        }
        
        if (skip)