#include "AliShuttleTrigger.h"
#include <TSystem.h>
+#include <TGrid.h>
#include <TObjString.h>
#include "AliLog.h"
fCondition.Signal();
}
+//______________________________________________________________________________________________
+void AliShuttleTrigger::CheckTerminate()
+{
+ //
+ // Checks if the Shuttle got an external terminate request by a created file
+ // This is an alternative to the signal which causes problems with the API libraries
+ //
+
+ if (strlen(fConfig->GetTerminateFilePath()) == 0)
+ return;
+
+ if (gSystem->AccessPathName(fConfig->GetTerminateFilePath()) == kFALSE)
+ {
+ AliInfo("Terminate file exists. Terminating Shuttle...");
+ fTerminate = kTRUE;
+ }
+}
+
//______________________________________________________________________________________________
void AliShuttleTrigger::Run() {
//
fMutex.Lock();
while (!(fNotified || fTerminate)) {
- received=fCondition.TimedWaitRelative(1000*fConfig->GetTriggerWait());
- 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;
}
Collect();
+ CheckTerminate();
}
delete notifier;
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()) {
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);
TString subject;
TString body;
+ Int_t percentage_used = 100 - percentage;
subject = Form("%s CRITICAL Disk Space usage exceeds %d%c!",
- tmpStr.Data(),percentage,'%');
+ tmpStr.Data(),percentage_used,'%');
AliDebug(2, Form("subject: %s", subject.Data()));
- Int_t percentage_used = 100 - percentage;
body = "Dear SHUTTLE experts, \n\n";
body += "The usage of the disk space on the shuttle machine has overcome \n";