Enlarging window for DCS DPs retrieval for short runs for GRP + Keeping connection...
authorzampolli <chiara.zampolli@cern.ch>
Wed, 29 Oct 2014 11:46:10 +0000 (12:46 +0100)
committerzampolli <chiara.zampolli@cern.ch>
Wed, 29 Oct 2014 11:46:10 +0000 (12:46 +0100)
SHUTTLE/AliShuttle.cxx
SHUTTLE/AliShuttleTrigger.cxx

index 45f2b8d..4c0438a 100644 (file)
@@ -2140,19 +2140,25 @@ TMap* AliShuttle::GetValueSet(const char* host, Int_t port, const TSeqCollection
        AliDCSClient client(host, port, fTimeout, fRetries, multiSplit);
 
        TMap* result = 0;
+       UInt_t startQuery = GetStartTimeDCSQuery();
+       UInt_t endQuery = GetEndTimeDCSQuery();
+       if (fCurrentDetector == "GRP" && (endQuery - startQuery) <= 120) { // enlarging DCS query for GRP when a run is shorter than 2 minutes (i.e. the time of forced archival of GRP DPs)
+         Log(fCurrentDetector.Data(), Form("GetValueSet: run lasting less than 120 seconds, enlarging DCS window for DPs retrival to 130 s"));
+         startQuery = endQuery - 130; // we add 130 s to be sure that there is something (even if the archival is forced after 120 s)
+       }
+
        if (type == kAlias)
        {
                //result = client.GetAliasValues(entries, GetCurrentStartTime()-offset, 
                //      GetCurrentEndTime()+offset);
-               result = client.GetAliasValues(entries, GetStartTimeDCSQuery(), 
-                       GetEndTimeDCSQuery());
+
+               result = client.GetAliasValues(entries, startQuery, endQuery);         
        } 
        else if (type == kDP)
        {
                //result = client.GetDPValues(entries, GetCurrentStartTime()-offset, 
                //      GetCurrentEndTime()+offset);
-                       result = client.GetDPValues(entries, GetStartTimeDCSQuery(), 
-                       GetEndTimeDCSQuery());
+                       result = client.GetDPValues(entries, startQuery, endQuery);
        }
 
        if (result == 0)
index 9105d35..732e60e 100644 (file)
 #include "AliShuttleTrigger.h"
 
 #include <TSystem.h>
+#include <TGrid.h>
 #include <TObjString.h>
 
 #include "AliLog.h"
@@ -247,9 +248,21 @@ void AliShuttleTrigger::Run() {
                fMutex.Lock();
 
                while (!(fNotified || fTerminate)) {
-                       received=fCondition.TimedWaitRelative(1000*fConfig->GetTriggerWait());
-                       CheckTerminate();
-                       if (received==1) break; // 1 = timeout
+                 for (Int_t iwait = 0; iwait < 10; iwait++){
+                   received = fCondition.TimedWaitRelative(1000*fConfig->GetTriggerWait()/10); // to keep the connection to the server alive every minute while waiting for new runs
+                   if (received == 1) {
+                     if (gGrid) {
+                       AliInfo(Form("Keeping the connection to the server alive while waiting for new runs - %d waited from last one", fConfig->GetTriggerWait()/10*iwait));
+                       gGrid->Pwd();
+                     }
+                     else {
+                       AliInfo("No gGrid initialized so far, we cannot keep the connection to the server alive while waiting for new runs");
+                     }
+                   }
+                 }
+                 //received=fCondition.TimedWaitRelative(1000*fConfig->GetTriggerWait());
+                 CheckTerminate();
+                 if (received==1) break; // 1 = timeout
                }
 
                fNotified = kFALSE;
@@ -372,7 +385,7 @@ Bool_t AliShuttleTrigger::SendMailDiskSpace(Short_t percentage)
          to.Remove(to.Length()-1);
        AliDebug(2, Form("to: %s",to.Data()));
 
-       // mail body 
+       // mail body 
        TString bodyFileName;
        bodyFileName.Form("%s/mail.body", fShuttle->GetShuttleLogDir());
        gSystem->ExpandPathName(bodyFileName);