Monalisa started in Collect() function. Alive message to monitor is sent at each...
authoracolla <acolla@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 12 Dec 2007 13:45:35 +0000 (13:45 +0000)
committeracolla <acolla@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 12 Dec 2007 13:45:35 +0000 (13:45 +0000)
SHUTTLE/AliShuttle.cxx
SHUTTLE/AliShuttle.h

index 25575b36b5fca396e25e17d6940a8aab19a83e70..54a6ba745ae7be04d21aa50b4eaacd4b906e0720 100644 (file)
 
 /*
 $Log$
+Revision 1.69  2007/12/12 10:06:29  acolla
+in AliShuttle.cxx: SHUTTLE logbook is updated in case of invalid run times:
+
+time_start==0 && time_end==0
+
+logbook is NOT updated if time_start != 0 && time_end == 0, because it may mean that the run is still ongoing.
+
 Revision 1.68  2007/12/11 10:15:17  acolla
 Added marking SHUTTLE=DONE for invalid runs
 (invalid start time or end time) and runs with totalEvents < 1
@@ -1264,7 +1271,9 @@ void AliShuttle::SendMLInfo()
        mlList.Add(&mlStatus);
        mlList.Add(&mlRetryCount);
 
-       fMonaLisa->SendParameters(&mlList);
+       TString mlID;
+       mlID.Form("%d", GetCurrentRun());
+       fMonaLisa->SendParameters(&mlList, mlID);
 }
 
 //______________________________________________________________________________________________
@@ -1414,9 +1423,6 @@ Bool_t AliShuttle::Process(AliShuttleLogbookEntry* entry)
        Log("SHUTTLE", Form("\t\t\t^*^*^*^*^*^*^*^*^*^*^*^* run %d: START ^*^*^*^*^*^*^*^*^*^*^*^*",
                                        GetCurrentRun()));
 
-       // create ML instance that monitors this run
-       fMonaLisa = new TMonaLisaWriter(fConfig->GetMonitorHost(), fConfig->GetMonitorTable(), Form("%d", GetCurrentRun()));
-
        // Send the information to ML
        TMonaLisaText  mlStatus("SHUTTLE_status", "Processing");
        TMonaLisaText  mlRunType("SHUTTLE_runtype", Form("%s (%s)", entry->GetRunType(), entry->GetRunParameter("log")));
@@ -1425,7 +1431,9 @@ Bool_t AliShuttle::Process(AliShuttleLogbookEntry* entry)
        mlList.Add(&mlStatus);
        mlList.Add(&mlRunType);
 
-       fMonaLisa->SendParameters(&mlList);
+       TString mlID;
+       mlID.Form("%d", GetCurrentRun());
+       fMonaLisa->SendParameters(&mlList, mlID);
 
        if (fLogbookEntry->IsDone())
        {
@@ -1579,9 +1587,12 @@ Bool_t AliShuttle::Process(AliShuttleLogbookEntry* entry)
                                        }
                                        
                                        if (expiredTime % 60 == 0)
+                                       {
                                                Log("SHUTTLE", Form("Process - %s: Checking process. "
                                                        "Run time: %d seconds - Memory consumption: %d KB",
                                                        fCurrentDetector.Data(), expiredTime, mem));
+                                               SendAlive();
+                                       }
                                        
                                        if (mem > fConfig->GetPPMaxMem())
                                        {
@@ -1749,10 +1760,6 @@ Bool_t AliShuttle::Process(AliShuttleLogbookEntry* entry)
                }
        }
 
-       // remove ML instance
-       delete fMonaLisa;
-       fMonaLisa = 0;
-
        fLogbookEntry = 0;
 
        return hasError == kFALSE;
@@ -2058,7 +2065,7 @@ AliShuttleLogbookEntry* AliShuttle::QueryRunParameters(Int_t run)
                
                Log("SHUTTLE", Form("Marking SHUTTLE done for run %d", run));
                fLogbookEntry = entry;  
-               if (!UpdateShuttleLogbook("shuttle_done"))
+               if (!UpdateShuttleLogbook("shuttle_ignored"))
                {
                        AliError(Form("Could not update logbook for run %d !", run));
                }
@@ -2102,7 +2109,7 @@ AliShuttleLogbookEntry* AliShuttle::QueryRunParameters(Int_t run)
                
                Log("SHUTTLE", Form("Marking SHUTTLE done for run %d", run));
                fLogbookEntry = entry;  
-               if (!UpdateShuttleLogbook("shuttle_done"))
+               if (!UpdateShuttleLogbook("shuttle_ignored"))
                {
                        AliError(Form("Could not update logbook for run %d !", run));
                }
@@ -2772,11 +2779,11 @@ Bool_t AliShuttle::UpdateShuttleLogbook(const char* detector, const char* status
 
        TString detName(detector);
        TString setClause;
-       if(detName == "shuttle_done")
+       if (detName == "shuttle_done" || detName == "shuttle_ignored")
        {
                setClause = "set shuttle_done=1";
 
-               if (fMonaLisa)
+               if (detName == "shuttle_done")
                {
                        // Send the information to ML
                        TMonaLisaText  mlStatus("SHUTTLE_status", "Done");
@@ -2784,7 +2791,9 @@ Bool_t AliShuttle::UpdateShuttleLogbook(const char* detector, const char* status
                        TList mlList;
                        mlList.Add(&mlStatus);
                
-                       fMonaLisa->SendParameters(&mlList);
+                       TString mlID;
+                       mlID.Form("%d", GetCurrentRun());
+                       fMonaLisa->SendParameters(&mlList, mlID);
                }
        } else {
                TString statusStr(status);
@@ -2946,6 +2955,19 @@ TString AliShuttle::GetLogFileName(const char* detector) const
        return fileName;
 }
 
+//______________________________________________________________________________________________
+void AliShuttle::SendAlive()
+{
+       // sends alive message to ML
+       
+       TMonaLisaText mlStatus("SHUTTLE_status", "Alive");
+
+       TList mlList;
+       mlList.Add(&mlStatus);
+
+       fMonaLisa->SendParameters(&mlList, "__PROCESSINGINFO__");
+}
+
 //______________________________________________________________________________________________
 Bool_t AliShuttle::Collect(Int_t run)
 {
@@ -2963,6 +2985,13 @@ Bool_t AliShuttle::Collect(Int_t run)
 
        SetLastAction("Starting");
 
+       // create ML instance
+       if (!fMonaLisa)
+               fMonaLisa = new TMonaLisaWriter(fConfig->GetMonitorHost(), fConfig->GetMonitorTable());
+               
+
+       SendAlive();
+
        TString whereClause("where shuttle_done=0");
        if (run != -1)
                whereClause += Form(" and run=%d", run);
index d94378f315f2e1c4e006b3f8cd20c8866ce71d67..4ff0dbc91eca22f562ac5a1f82b645c6da1ff23d 100644 (file)
@@ -127,6 +127,7 @@ private:
 
        void SetLastAction(const char* action);
        
+       void SendAlive();
        void SendMLInfo();
 
        const AliShuttleConfig* fConfig;        // pointer to configuration object