]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - SHUTTLE/AliShuttle.cxx
Allow fixing of local parameters for solver
[u/mrichter/AliRoot.git] / SHUTTLE / AliShuttle.cxx
index 5e5bdc459cf7e3f2ad1343c8a47e73e201f23b97..a9ead41837285ffaecc95715bcc2335a0b6e82e2 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)
@@ -2907,7 +2938,7 @@ const char* AliShuttle::GetLHCPeriod() const
 }
 
 //______________________________________________________________________________________________
-void AliShuttle::Log(const char* detector, const char* message)
+void AliShuttle::Log(const char* detector, const char* message, UInt_t level)
 {
        //
        // Fill log string with a message
@@ -2934,7 +2965,7 @@ void AliShuttle::Log(const char* detector, const char* message)
                toLog += Form("run %d - ", GetCurrentRun());
        toLog += Form("%s", message);
 
-       AliInfo(toLog.Data());
+       AliLog::Message(level, toLog, MODULENAME(), ClassName(), FUNCTIONNAME(), __FILE__, __LINE__);
        
        // if we redirect the log output already to the file, leave here
        if (fOutputRedirected && strcmp(detector, "SHUTTLE") != 0)
@@ -3449,7 +3480,7 @@ const char* AliShuttle::GetTriggerConfiguration()
        
        if (result->GetRowCount() == 0)
        {
-               Log("SHUTTLE", "ERROR: Trigger configuration not found in logbook_trigger_config");
+               Log("SHUTTLE", "WARNING: Trigger configuration not found in logbook_trigger_config");
                delete result;
                return 0;
        }
@@ -3496,7 +3527,7 @@ const char* AliShuttle::GetCTPTimeParams()
        
        if (result->GetRowCount() == 0)
        {
-               Log("SHUTTLE", "ERROR: CTP time params not found in logbook_trigger_config");
+               Log("SHUTTLE", "WARNING: CTP time params not found in logbook_trigger_config");
                delete result;
                return 0;
        }
@@ -3518,7 +3549,7 @@ const char* AliShuttle::GetCTPTimeParams()
        delete result;
        result = 0;
        
-       Log("SHUTTLE", Form("Found trigger configuration: %s", triggerTimeParams.Data()));
+       Log("SHUTTLE", Form("Found trigger time parameters: %s", triggerTimeParams.Data()));
        
        return triggerTimeParams;
 }