]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - SHUTTLE/AliShuttleConfig.cxx
Little changes needed for running with new AliESDEvent
[u/mrichter/AliRoot.git] / SHUTTLE / AliShuttleConfig.cxx
index cba90ba6bd68c8e415d5c0dd59a9ff89e5215c67..28e5d4f73437fb318936d1081d077d57b7be4a03 100644 (file)
 
 /*
 $Log$
+Revision 1.20  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.19  2007/02/28 10:41:56  acolla
+Run type field added in SHUTTLE framework. Run type is read from "run type" logbook and retrieved by
+AliPreprocessor::GetRunType() function.
+Added some ldap definition files.
+
+Revision 1.18  2007/01/23 19:20:03  acolla
+Removed old ldif files, added TOF, MCH ldif files. Added some options in
+AliShuttleConfig::Print. Added in Ali Shuttle: SetShuttleTempDir and
+SetShuttleLogDir
+
+Revision 1.17  2007/01/18 11:17:47  jgrosseo
+changing spaces to tabs ;-)
+
+Revision 1.16  2007/01/18 11:10:35  jgrosseo
+adding the possibility of defining DCS alias and data points with patterns
+first pattern introduced: [N..M] to add all names between the two digits, this works also recursively.
+
 Revision 1.15  2007/01/15 18:27:11  acolla
 implementation of sending mail to subdetector expert in case the preprocessor fails.
 shuttle.schema updated with expert's email entry
@@ -124,6 +156,8 @@ fDCSHost(""),
 fDCSPort(0),
 fDCSAliases(0),
 fDCSDataPoints(0),
+fDCSAliasesComp(0),
+fDCSDataPointsComp(0),
 fResponsibles(0),
 fIsValid(kFALSE),
 fSkipDCSQuery(kFALSE),
@@ -136,6 +170,10 @@ fStrictRunOrder(kFALSE)
        fDCSAliases->SetOwner(1);
        fDCSDataPoints = new TObjArray();
        fDCSDataPoints->SetOwner(1);
+       fDCSAliasesComp = new TObjArray();
+       fDCSAliasesComp->SetOwner(1);
+       fDCSDataPointsComp = new TObjArray();
+       fDCSDataPointsComp->SetOwner(1);
        fResponsibles = new TObjArray();
        fResponsibles->SetOwner(1);
 
@@ -162,18 +200,20 @@ fStrictRunOrder(kFALSE)
                fStrictRunOrder = (Bool_t) strictRunStr.Atoi();
        }
 
-       anAttribute = entry->GetAttribute("responsible"); // MUST
+       anAttribute = entry->GetAttribute("responsible"); // MAY
         if (!anAttribute)
        {
-               AliError(Form("Invalid configuration! No \"responsible\" attribute!"));
-               return;
+               AliDebug(2, "Warning! No \"responsible\" attribute!");
         }
-       const char* aResponsible;
-       while ((aResponsible = anAttribute->GetValue()))
+       else
        {
-               fResponsibles->AddLast(new TObjString(aResponsible));
+               const char* aResponsible;
+               while ((aResponsible = anAttribute->GetValue()))
+               {
+                       fResponsibles->AddLast(new TObjString(aResponsible));
+               }
        }
-
+       
        anAttribute = entry->GetAttribute("DCSHost"); // MAY
        if (!anAttribute)
        {
@@ -203,6 +243,7 @@ fStrictRunOrder(kFALSE)
                const char* anAlias;
                while ((anAlias = anAttribute->GetValue()))
                {
+                       fDCSAliasesComp->AddLast(new TObjString(anAlias));
                        ExpandAndAdd(fDCSAliases, anAlias);
                }
        }
@@ -213,7 +254,8 @@ fStrictRunOrder(kFALSE)
                const char* aDataPoint;
                while ((aDataPoint = anAttribute->GetValue()))
                {
-      ExpandAndAdd(fDCSDataPoints, aDataPoint);
+               fDCSDataPointsComp->AddLast(new TObjString(aDataPoint));
+               ExpandAndAdd(fDCSDataPoints, aDataPoint);
                }
        }
 
@@ -223,58 +265,58 @@ fStrictRunOrder(kFALSE)
 //______________________________________________________________________________________________
 void AliShuttleConfig::AliShuttleConfigHolder::ExpandAndAdd(TObjArray* target, const char* entry)
 {
-  //
-  // adds <entry> to <target> applying expanding of the name
-  // [N..M] creates M-N+1 names with the corresponding digits
-  //
+       //
+       // adds <entry> to <target> applying expanding of the name
+       // [N..M] creates M-N+1 names with the corresponding digits
+       //
 
-  TString entryStr(entry);
+       TString entryStr(entry);
 
-  Int_t begin = entryStr.Index("[");
-  Int_t end = entryStr.Index("]");
-  if (begin != -1 && end != -1 && end > begin)
-  {
-    TString before(entryStr(0, begin));
-    TString after(entryStr(end+1, entryStr.Length()));
+       Int_t begin = entryStr.Index("[");
+       Int_t end = entryStr.Index("]");
+       if (begin != -1 && end != -1 && end > begin)
+       {
+               TString before(entryStr(0, begin));
+               TString after(entryStr(end+1, entryStr.Length()));
 
-    AliDebug(2, Form("Found [] pattern. Splitted input string %s %s", before.Data(), after.Data()));
+               AliDebug(2, Form("Found [] pattern. Splitted input string %s %s", before.Data(), after.Data()));
 
-    Int_t dotdot = entryStr.Index("..");
+               Int_t dotdot = entryStr.Index("..");
 
-    TString nStr(entryStr(begin+1, dotdot-begin-1));
-    TString mStr(entryStr(dotdot+2, end-dotdot-2));
+               TString nStr(entryStr(begin+1, dotdot-begin-1));
+               TString mStr(entryStr(dotdot+2, end-dotdot-2));
 
-    AliDebug(2, Form("Found [N..M] pattern. %s %s", nStr.Data(), mStr.Data()));
+               AliDebug(2, Form("Found [N..M] pattern. %s %s", nStr.Data(), mStr.Data()));
 
-    if (nStr.IsDigit() && mStr.IsDigit())
-    {
-      Int_t n = nStr.Atoi();
-      Int_t m = mStr.Atoi();
+               if (nStr.IsDigit() && mStr.IsDigit())
+               {
+                       Int_t n = nStr.Atoi();
+                       Int_t m = mStr.Atoi();
 
-      Int_t nDigits = nStr.Length();
-      TString formatStr;
-      formatStr.Form("%%s%%0%dd%%s", nDigits);
+                       Int_t nDigits = nStr.Length();
+                       TString formatStr;
+                       formatStr.Form("%%s%%0%dd%%s", nDigits);
 
-      AliDebug(2, Form("Format string is %s", formatStr.Data()));
+                       AliDebug(2, Form("Format string is %s", formatStr.Data()));
 
-      for (Int_t current = n; current<=m; ++current)
-      {
-        TString newEntry;
-        newEntry.Form(formatStr.Data(), before.Data(), current, after.Data());
+                       for (Int_t current = n; current<=m; ++current)
+                       {
+                               TString newEntry;
+                               newEntry.Form(formatStr.Data(), before.Data(), current, after.Data());
 
-        AliDebug(2, Form("Calling recursive with %s", newEntry.Data()));
+                               AliDebug(2, Form("Calling recursive with %s", newEntry.Data()));
 
-        // and go recursive
-        ExpandAndAdd(target, newEntry);
-      }
+                               // and go recursive
+                               ExpandAndAdd(target, newEntry);
+                       }
 
-      // return here because we processed the entries already recursively.
-      return;
-    }
-  }
+                       // return here because we processed the entries already recursively.
+                       return;
+               }
+       }
 
-  AliDebug(2, Form("Adding name %s", entry));
-  target->AddLast(new TObjString(entry));
+       AliDebug(2, Form("Adding name %s", entry));
+       target->AddLast(new TObjString(entry));
 }
 
 //______________________________________________________________________________________________
@@ -294,8 +336,8 @@ AliShuttleConfig::AliShuttleConfig(const char* host, Int_t port,
        const char* binddn, const char* password, const char* basedn):
        fIsValid(kFALSE), fConfigHost(host),
        fDAQlbHost(""), fDAQlbPort(), fDAQlbUser(""), fDAQlbPass(""),
-       fDAQlbDB(""), fDAQlbTable(""),
-       fMaxRetries(0), fPPTimeOut(0), fDetectorMap(), fDetectorList(),
+       fDAQlbDB(""), fDAQlbTable(""), fShuttlelbTable(""), fRunTypelbTable(""),
+       fMaxRetries(0), fPPTimeOut(0), fPPMaxMem(0), fDetectorMap(), fDetectorList(),
        fShuttleInstanceHost(""), fProcessedDetectors(), fProcessAll(kFALSE)
 {
        //
@@ -460,6 +502,21 @@ AliShuttleConfig::AliShuttleConfig(const char* host, Int_t port,
        }
        fDAQlbTable = anAttribute->GetValue();
 
+       anAttribute = anEntry->GetAttribute("ShuttleLogbookTable");
+       if (!anAttribute) {
+               AliError("Can't find ShuttleLogbookTable attribute!");
+               delete aResult; delete anEntry;
+               return;
+       }
+       fShuttlelbTable = anAttribute->GetValue();
+
+       anAttribute = anEntry->GetAttribute("RunTypeLogbookTable");
+       if (!anAttribute) {
+               AliError("Can't find RunTypeLogbookTable attribute!");
+               delete aResult; delete anEntry;
+               return;
+       }
+       fRunTypelbTable = anAttribute->GetValue();
 
        anAttribute = anEntry->GetAttribute("MaxRetries");
        if (!anAttribute) {
@@ -479,6 +536,15 @@ AliShuttleConfig::AliShuttleConfig(const char* host, Int_t port,
        tmpStr = anAttribute->GetValue();
        fPPTimeOut = tmpStr.Atoi();
 
+       anAttribute = anEntry->GetAttribute("PPMaxMem");
+       if (!anAttribute) {
+               AliError("Can't find PPMaxMem attribute!");
+               delete aResult; delete anEntry;
+               return;
+       }
+       tmpStr = anAttribute->GetValue();
+       fPPMaxMem = tmpStr.Atoi();
+       
        delete aResult; delete anEntry;
 
        // FXS configuration (FXS logbook and hosts)
@@ -738,10 +804,14 @@ Bool_t AliShuttleConfig::StrictRunOrder(const char* detector) const
 }
 
 //______________________________________________________________________________________________
-void AliShuttleConfig::Print(Option_t* /*option*/) const
+void AliShuttleConfig::Print(Option_t* option) const
 {
 // print configuration
-       
+// options : "": print configuration for all detectors, aliases and DPs in compacted format
+//          "uncompact": print configuration for all detectors, aliases and DPs in uncompacted format
+//          "DET": print configuration for DET, aliases and DPs in compacted format
+//          "DET, uncompact": print configuration for DET, aliases and DPs in uncompacted format
+
        TString result;
        result += '\n';
 
@@ -762,7 +832,7 @@ void AliShuttleConfig::Print(Option_t* /*option*/) const
                result += "\n";
        }
 
-       result += Form("PP time out = %d - Max total retries = %d\n\n", fPPTimeOut, fMaxRetries);
+       result += Form("PP time out = %d - Max PP memsize = %d KB - Max total retries = %d\n\n", fPPTimeOut, fPPMaxMem, fMaxRetries);
        result += "------------------------------------------------------\n";
 
        result += Form("Logbook Configuration \n\n \tHost: %s:%d; \tUser: %s; ",
@@ -770,8 +840,8 @@ void AliShuttleConfig::Print(Option_t* /*option*/) const
 
 //     result += "Password: ";
 //     result.Append('*', fDAQlbPass.Length());
-       result += Form("\tDB: %s; \tTable: %s",
-               fDAQlbDB.Data(), fDAQlbTable.Data());
+       result += Form("\tDB: %s; \tTables: %s, %s, %s",
+               fDAQlbDB.Data(), fDAQlbTable.Data(), fShuttlelbTable.Data(), fRunTypelbTable.Data());
 
        result += "\n\n";
 
@@ -789,12 +859,16 @@ void AliShuttleConfig::Print(Option_t* /*option*/) const
                // result += Form("FXS Password:",fFXSPass[iSys].Data());
        }
 
+       TString optStr(option);
+
        result += "------------------------------------------------------\n";
        result += "Detector-specific configuration\n\n";
        TIter iter(fDetectorMap.GetTable());
        TPair* aPair;
        while ((aPair = (TPair*) iter.Next())) {
                AliShuttleConfigHolder* aHolder = (AliShuttleConfigHolder*) aPair->Value();
+               if (option != 0 && !optStr.Contains(aHolder->GetDetector()) && optStr.CompareTo("uncompact",TString::kIgnoreCase) != 0 )
+                               continue;
                result += Form("*** %s *** \n", aHolder->GetDetector());
 
                const TObjArray* responsibles = aHolder->GetResponsibles();
@@ -818,7 +892,14 @@ void AliShuttleConfig::Print(Option_t* /*option*/) const
                }
                result += Form("\tAmanda server: %s:%d \n", aHolder->GetDCSHost(), aHolder->GetDCSPort());
 
-               const TObjArray* aliases = aHolder->GetDCSAliases();
+               const TObjArray* aliases = 0;
+               if (optStr.Contains("uncompact",TString::kIgnoreCase))
+               {
+                       aliases = aHolder->GetDCSAliases();
+               } else {
+                       aliases = aHolder->GetCompactDCSAliases();
+               }
+
                if (aliases->GetEntries() != 0)
                {
                        result += "\tDCS Aliases: ";
@@ -831,7 +912,13 @@ void AliShuttleConfig::Print(Option_t* /*option*/) const
                        result += "\n";
                }
 
-               const TObjArray* dataPoints = aHolder->GetDCSDataPoints();
+               const TObjArray* dataPoints = 0;
+               if (optStr.Contains("uncompact",TString::kIgnoreCase))
+               {
+                       dataPoints = aHolder->GetDCSDataPoints();
+               } else {
+                       dataPoints = aHolder->GetCompactDCSDataPoints();
+               }
                if (dataPoints->GetEntries() != 0)
                {
                        result += "\tDCS Data Points: ";