Method for touching a file on the grid after processing a run in case of shuttle...
authorzampolli <zampolli@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 3 Apr 2008 12:52:22 +0000 (12:52 +0000)
committerzampolli <zampolli@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 3 Apr 2008 12:52:22 +0000 (12:52 +0000)
SHUTTLE/AliShuttle.cxx
SHUTTLE/AliShuttle.h

index 16bc3c65d74862695ed7577cfb20915039a8ac1a..a40805b6565753c55a7d57f2325ae6ec7536cd42 100644 (file)
@@ -57,6 +57,7 @@
 #include <TFile.h>
 #include <TGrid.h>
 #include <TGridResult.h>
+#include <TMap.h>
 
 #include <TMonaLisaWriter.h>
 
@@ -2584,15 +2585,21 @@ Bool_t AliShuttle::UpdateShuttleLogbook(const char* detector, const char* status
 
                if (detName == "shuttle_done")
                {
-                       // Send the information to ML
-                       TMonaLisaText  mlStatus("SHUTTLE_status", "Done");
+                       if (TouchFile()==kTRUE){
+                               //Send the information to ML
+                               TMonaLisaText  mlStatus("SHUTTLE_status", "Done");
 
-                       TList mlList;
-                       mlList.Add(&mlStatus);
-               
-                       TString mlID;
-                       mlID.Form("%d", GetCurrentRun());
-                       fMonaLisa->SendParameters(&mlList, mlID);
+                               TList mlList;
+                               mlList.Add(&mlStatus);
+                               
+                               TString mlID;
+                               mlID.Form("%d", GetCurrentRun());
+                               fMonaLisa->SendParameters(&mlList, mlID);
+                       }
+                       else{
+                               return kFALSE;
+                       }
+                                       
                }
        } else {
                TString statusStr(status);
@@ -3211,3 +3218,49 @@ void AliShuttle::SetShuttleLogDir(const char* logDir)
 
        fgkShuttleLogDir = gSystem->ExpandPathName(logDir);
 }
+//______________________________________________________________________________________________
+Bool_t AliShuttle::TouchFile()
+{
+       //
+       // touching a file on the grid if run has been DONE
+       //
+       
+       if (!gGrid)
+       {
+               Log("SHUTTLE",Form("No TGrid connection estabilished!"));
+               Log("SHUTTLE",Form("Could not touch file for run %i",GetCurrentRun()));
+               return kFALSE;
+       }
+
+       TString command;
+       command.Form("touch /alice/data/%d/%s/SHUTTLE_DONE/shuttle_done_%i", GetCurrentYear(), GetLHCPeriod(),GetCurrentRun());
+       TGridResult *resultTouch = dynamic_cast<TGridResult*>(gGrid->Command(command));
+       if (resultTouch){
+               TMap *mapTouch = dynamic_cast<TMap*>(resultTouch->At(0));
+               if (mapTouch){
+                       TObjString *valueTouch = dynamic_cast<TObjString*>(mapTouch->GetValue("__result__"));
+                       if (valueTouch){
+                               if (valueTouch->GetString()=="1"){
+                               return kTRUE;
+                               }       
+                               else {
+                                       Log("SHUTTLE",Form("No value for __result__ key set in the map for touching command"));
+                               }
+                       }
+                       else {
+                               Log("SHUTTLE",Form("No value set in the map for touching command"));
+                       }
+               }
+               else {
+                       Log("SHUTTLE",Form("No map for touching command"));
+               }
+       }
+
+       else {
+               Log("SHUTTLE",Form("No result for touching command"));
+       }
+       Log("SHUTTLE",Form("Could not touch file for run %i",GetCurrentRun()));
+       return kFALSE;
+}
+
+
index 583d1358030a0be533aa6d1ade236b67a71fae6b..643168e4c6b0a310e84676b994694071593372d4 100644 (file)
@@ -130,6 +130,7 @@ private:
        
        void SendAlive();
        void SendMLInfo();
+       virtual Bool_t TouchFile();
 
        const AliShuttleConfig* fConfig;        // pointer to configuration object