]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - SHUTTLE/AliShuttleTrigger.cxx
CMake: Retrieve Git information
[u/mrichter/AliRoot.git] / SHUTTLE / AliShuttleTrigger.cxx
index e4225b9f11bac1fa7c7ecb9b00f91e564e40e15b..732e60edf84348b3e8b7847a4930aa42c7bfd138 100644 (file)
 #include "AliShuttleTrigger.h"
 
 #include <TSystem.h>
+#include <TGrid.h>
 #include <TObjString.h>
 
 #include "AliLog.h"
@@ -217,7 +218,7 @@ void AliShuttleTrigger::CheckTerminate()
        if (strlen(fConfig->GetTerminateFilePath()) == 0)
                return;
 
-       if (gSystem->AccessPathName(fConfig->GetTerminateFilePath()))
+       if (gSystem->AccessPathName(fConfig->GetTerminateFilePath()) == kFALSE)
        {
                AliInfo("Terminate file exists. Terminating Shuttle...");
                fTerminate = kTRUE;
@@ -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;
@@ -287,6 +300,7 @@ void AliShuttleTrigger::Run() {
                }
        
                Collect();
+               CheckTerminate();
        }
 
        delete notifier;
@@ -308,7 +322,7 @@ Bool_t AliShuttleTrigger::Collect(Int_t run)
 
        gSystem->GetFsInfo(fConfig->GetShuttleFileSystem(), &id, &bsize, &blocks, &bfree);
 
-       AliInfo(Form("n. of free blocks = %d, total n. of blocks = %d",bfree,blocks));
+       AliInfo(Form("n. of free blocks = %ld, total n. of blocks = %ld",bfree,blocks));
        Int_t spaceFree = (Int_t)(((Float_t)bfree/(Float_t)blocks)*100);
 
        if (spaceFree < fConfig->GetFreeDiskWarningThreshold()) {
@@ -371,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);