1. Re-organization of function calls in TestPreprocessor to make it more meaningful.
authoracolla <acolla@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 4 Apr 2007 16:26:38 +0000 (16:26 +0000)
committeracolla <acolla@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 4 Apr 2007 16:26:38 +0000 (16:26 +0000)
2. Added missing dependency in test preprocessors.
3. in AliShuttle.cxx: processing time and memory consumption info on a single line.

SHUTTLE/AliShuttle.cxx
SHUTTLE/TestShuttle/AliTestPreprocessor.cxx
SHUTTLE/TestShuttle/TestPreprocessor.C
SHUTTLE/test/TestHMPIDPreprocessor.cxx
SHUTTLE/test/TestHMPIDPreprocessor.h
SHUTTLE/test/TestTPCPreprocessor.cxx
SHUTTLE/test/TestTRDPreprocessor.cxx
SHUTTLE/test/TestZDCPreprocessor.cxx

index 3b2b4b7..d5acf21 100644 (file)
 
 /*
 $Log$
+Revision 1.34  2007/04/04 10:33:36  jgrosseo
+1) Storing of files to the Grid is now done _after_ your preprocessors succeeded. This is transparent, which means that you can still use the same functions (Store, StoreReferenceData) to store files to the Grid. However, the Shuttle first stores them locally and transfers them after the preprocessor finished. The return code of these two functions has changed from UInt_t to Bool_t which gives you the success of the storing.
+In case of an error with the Grid, the Shuttle will retry the storing later, the preprocessor does not need to be run again.
+
+2) The meaning of the return code of the preprocessor has changed. 0 is now success and any other value means failure. This value is stored in the log and you can use it to keep details about the error condition.
+
+3) New function StoreReferenceFile to _directly_ store a file (without opening it) to the reference storage.
+
+4) The memory usage of the preprocessor is monitored. If it exceeds 2 GB it is terminated.
+
+5) New function AliPreprocessor::ProcessDCS(). If you do not need to have DCS data in all cases, you can skip the processing by implemting this function and returning kFALSE under certain conditions. E.g. if there is a certain run type.
+If you always need DCS data (like before), you do not need to implement it.
+
+6) The run type has been added to the monitoring page
+
 Revision 1.33  2007/04/03 13:56:01  acolla
 Grid Storage at the end of preprocessing. Added virtual method to disable DCS query according to the
 run type.
@@ -1084,9 +1099,6 @@ Bool_t AliShuttle::Process(AliShuttleLogbookEntry* entry)
                                }
                                else
                                {
-                                       if (expiredTime % 60 == 0)
-                                               Log("SHUTTLE", Form("Checked process. Run time: %d seconds.",
-                                                               expiredTime));
                                        gSystem->Sleep(1000);
                                        
                                        TString checkStr;
@@ -1117,7 +1129,8 @@ Bool_t AliShuttle::Process(AliShuttleLogbookEntry* entry)
                                        }
                                        
                                        if (expiredTime % 60 == 0)
-                                               Log("SHUTTLE", Form("The process consumes %d KB of memory.", mem));
+                                               Log("SHUTTLE", Form("%s: Checking process. Run time: %d seconds - Memory consumption: %d KB",
+                                                               fCurrentDetector.Data(), expiredTime, mem));
                                        
                                        if (mem > fConfig->GetPPMaxMem())
                                        {
index 476dd25..66d4339 100644 (file)
@@ -68,8 +68,11 @@ UInt_t AliTestPreprocessor::Process(TMap* dcsAliasMap)
   // Fills data into a AliTestDataDCS object
 
   if (!dcsAliasMap)
-    return 1;
-
+  {
+       Log("ERROR: No DCS map provided by SHUTTLE!");
+       return 1;
+  }
+  
   // The processing of the DCS input data is forwarded to AliTestDataDCS
   fData->ProcessData(*dcsAliasMap);
 
@@ -79,23 +82,35 @@ UInt_t AliTestPreprocessor::Process(TMap* dcsAliasMap)
   TString runType = GetRunType();
   Log(Form("Run type for run %d: %s", fRun, runType.Data()));
 
-  TString fileName = GetFile(kDAQ, "PEDESTALS", "GDC");
-  if (fileName.Length() > 0)
-    Log(Form("Got the file %s, now we can extract some values.", fileName.Data()));
-  //TODO here the file could be opened, some values extracted and  written to e.g. fData
+  // Example of how to retrieve the list of sources that produced the file with id DRIFTVELOCITY
+  TList* sourceList = GetFileSources(kDAQ, "DRIFTVELOCITY");
+  if (!sourceList)
+  {
+       Log("Error: No sources found for id DRIFTVELOCITY!");
+       return 1;
+  }
+  
+  // TODO We have the list of sources that produced the files with Id DRIFTVELOCITY. 
+  // Now we will loop on the list and we'll query the files one by one. 
+  Log("The following sources produced files with the id DRIFTVELOCITY");
+  sourceList->Print();
+  
+  TIter iter(sourceList);
+  TObjString *source = 0;
+  while((source=dynamic_cast<TObjString*> (iter.Next()))){
+       TString fileName = GetFile(kDAQ, "DRIFTVELOCITY", source->GetName());
+       if (fileName.Length() > 0)
+               Log(Form("Got the file %s, now we can extract some values.", fileName.Data()));
+  }
 
-  //Example to store a file directly to the reference storage
-  if (!StoreReferenceFile(fileName, "InputData.root"))
+  delete sourceList;
+
+  // Example to store a file directly to the reference storage
+  // Suppose we have queried the file from the FXS. Now the file is available locally and is called "file1.root".
+  const char* refFileName="file1.root";
+  if (!StoreReferenceFile(refFileName, "InputData.root"))
        return 1;
   
-  TList* list = GetFileSources(kDAQ, "DRIFTVELOCITY");
-  if (list)
-  {
-    Log("The following sources produced files with the id DRIFTVELOCITY");
-    list->Print();
-    delete list;
-  }
-  //TODO here the files could be opened, some values extracted and  written to e.g. fData
 
   // Example of how to retrieve a run parameter using GetRunParameter function
   // TODO Here the parameter must be set manually with SetInputRunParameter function,
index 4b005c7..73ab495 100644 (file)
@@ -63,10 +63,9 @@ void TestPreprocessor()
   // Three files originating from different LDCs but with the same id are also added
   // Note that the test preprocessor name is TPC. The name of the detector's preprocessor must follow
   // the "online" naming convention ALICE-INT-2003-039.
-  shuttle->AddInputFile(AliShuttleInterface::kDAQ, "TPC", "PEDESTALS", "GDC", "file1.root");
   shuttle->AddInputFile(AliShuttleInterface::kDAQ, "TPC", "DRIFTVELOCITY", "LDC0", "file2a.root");
   shuttle->AddInputFile(AliShuttleInterface::kDAQ, "TPC", "DRIFTVELOCITY", "LDC1", "file2b.root");
-  shuttle->AddInputFile(AliShuttleInterface::kDAQ, "TPC", "DRIFTVELOCITY", "LDC2", "file2b.root");
+  shuttle->AddInputFile(AliShuttleInterface::kDAQ, "TPC", "DRIFTVELOCITY", "LDC2", "file2c.root");
 
   // TODO(3)
   //
index c75cdb2..203b1fb 100644 (file)
@@ -27,6 +27,7 @@
 #include <TTimeStamp.h>
 #include <TObjString.h>
 #include <TSystem.h>
+#include <TList.h>
 
 ClassImp(TestHMPIDPreprocessor)
 
@@ -62,18 +63,29 @@ void TestHMPIDPreprocessor::Initialize(Int_t run, UInt_t startTime,
 }
 
 //________________________________________________________________________________________
+Bool_t TestHMPIDPreprocessor::ProcessDCS() 
+{
+// Initialize preprocessor
+
+       TString runType = GetRunType();
+       if(runType == "LED") return kFALSE;
+       return kTRUE;
+}
+
+
+//________________________________________________________________________________________
 UInt_t TestHMPIDPreprocessor::Process(TMap* /*valueMap*/)
 {
 // process data retrieved by the Shuttle
 
-       UInt_t result = kFALSE;
+       Bool_t result = kFALSE;
 
        // Get run type and start the processing algorithm accordingly
        TString runType = GetRunType();
        if (runType.Length()==0)
        {
                Log("Undefined run type!");
-               return 0;
+               return 1;
        }
 
        Log(Form("Run type: %s", runType.Data()));
@@ -85,7 +97,7 @@ UInt_t TestHMPIDPreprocessor::Process(TMap* /*valueMap*/)
 
                if(!filesources) {
                        AliError(Form("No sources found for thresholds.txt for run %d !", fRun));
-                       return 0;
+                       return 2;
                }
 
                AliInfo("Here's the list of sources for thresholds.txt");
@@ -97,11 +109,12 @@ UInt_t TestHMPIDPreprocessor::Process(TMap* /*valueMap*/)
                while((source=dynamic_cast<TObjString*> (iter.Next()))){
                        printf("\n\n Getting file #%d\n",++i);
                        //if(i==1) continue;
-                       TString filename = GetFile(AliShuttleInterface::kDAQ, "DAQFile", source->GetName());
+                       //TString filename = GetFile(AliShuttleInterface::kDAQ, "DAQFile", source->GetName());
+                       TString filename = "DAQfile.txt";
                        if(!filename.Length()) {
                                AliError(Form("Error: retrieval of file from source %s failed!", source->GetName()));
                                delete filesources;
-                               return 0;
+                               return 3;
                        }
                        TString command = Form("more %s",filename.Data());
                        gSystem->Exec(command.Data());
@@ -122,7 +135,7 @@ UInt_t TestHMPIDPreprocessor::Process(TMap* /*valueMap*/)
                TString filename = GetFile(AliShuttleInterface::kDCS, "DCSFile", 0);
                if(!filename.Length()) {
                        AliError(Form("Error: retrieval of file from DCS failed!"));
-                       return 0;
+                       return 4;
                }
                TString command = Form("more %s", filename.Data());
                gSystem->Exec(command.Data());
@@ -132,7 +145,7 @@ UInt_t TestHMPIDPreprocessor::Process(TMap* /*valueMap*/)
                AliCDBMetaData metaData;
                result = Store("Calib", "DCSData", &filenameObj, &metaData);
 
-       } else if (runType == "GAINS")
+       } else if (runType == "LED")
        {
 
                // HLT
@@ -140,7 +153,7 @@ UInt_t TestHMPIDPreprocessor::Process(TMap* /*valueMap*/)
 
                if(!filesources) {
                        Log(Form("No sources found for HLTFile for run %d !", fRun));
-                       return 0;
+                       return 5;
                }
 
                AliInfo("Here's the list of sources for HLTFile");
@@ -152,11 +165,12 @@ UInt_t TestHMPIDPreprocessor::Process(TMap* /*valueMap*/)
                while((source=dynamic_cast<TObjString*> (iter.Next()))){
                        printf("\n\n Getting file #%d\n",++i);
                        //if(i==1) continue;
-                       TString filename = GetFile(AliShuttleInterface::kHLT, "HLTFile", source->GetName());
+                       //TString filename = GetFile(AliShuttleInterface::kHLT, "HLTFile", source->GetName());
+                       TString filename="HLTfile.txt";
                        if(!filename.Length()) {
                                AliError(Form("Error: retrieval of file from source %s failed!", source->GetName()));
                                delete filesources;
-                               return 0;
+                               return 6;
                        }
                        TString command = Form("more %s",filename.Data());
                        gSystem->Exec(command.Data());
@@ -172,8 +186,13 @@ UInt_t TestHMPIDPreprocessor::Process(TMap* /*valueMap*/)
        } else {
                Log(Form("Unknown run type: %s", runType.Data()));
        }
-
-       AliInfo(Form("result = %d",result));
-       return result;
+       
+       if(!result) 
+       {
+               Log("Storage error!");
+               return 100;
+       }
+       
+       return 0;
 }
 
index b37c21c..04c0075 100644 (file)
@@ -18,6 +18,8 @@ protected:
                         UInt_t endTime);
 
         virtual UInt_t Process(TMap* valueSet);
+       
+       virtual Bool_t ProcessDCS();
 
        ClassDef(TestHMPIDPreprocessor, 0);
 };
index fabeaf6..cc0f7b2 100644 (file)
@@ -26,6 +26,7 @@
 #include <TTimeStamp.h>
 #include <TObjString.h>
 #include <TH2F.h>
+#include <TList.h>
 
 ClassImp(TestTPCPreprocessor)
 
index 3a8fa83..cc217a5 100644 (file)
@@ -27,6 +27,7 @@
 #include <TTimeStamp.h>
 #include <TObjString.h>
 #include <TSystem.h>
+#include <TList.h>
 
 ClassImp(TestTRDPreprocessor)
 
index a46d1b2..d37cb00 100644 (file)
@@ -27,6 +27,7 @@
 #include <TTimeStamp.h>
 #include <TObjString.h>
 #include <TSystem.h>
+#include <TList.h>
 
 ClassImp(TestZDCPreprocessor)