1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
18 Revision 1.21 2007/04/27 07:06:48 jgrosseo
19 GetFileSources returns empty list in case of no files, but successful query
20 No mails sent in testmode
22 Revision 1.20 2007/04/04 10:33:36 jgrosseo
23 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.
24 In case of an error with the Grid, the Shuttle will retry the storing later, the preprocessor does not need to be run again.
26 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.
28 3) New function StoreReferenceFile to _directly_ store a file (without opening it) to the reference storage.
30 4) The memory usage of the preprocessor is monitored. If it exceeds 2 GB it is terminated.
32 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.
33 If you always need DCS data (like before), you do not need to implement it.
35 6) The run type has been added to the monitoring page
37 Revision 1.19 2007/02/28 10:41:56 acolla
38 Run type field added in SHUTTLE framework. Run type is read from "run type" logbook and retrieved by
39 AliPreprocessor::GetRunType() function.
40 Added some ldap definition files.
42 Revision 1.18 2007/01/23 19:20:03 acolla
43 Removed old ldif files, added TOF, MCH ldif files. Added some options in
44 AliShuttleConfig::Print. Added in Ali Shuttle: SetShuttleTempDir and
47 Revision 1.17 2007/01/18 11:17:47 jgrosseo
48 changing spaces to tabs ;-)
50 Revision 1.16 2007/01/18 11:10:35 jgrosseo
51 adding the possibility of defining DCS alias and data points with patterns
52 first pattern introduced: [N..M] to add all names between the two digits, this works also recursively.
54 Revision 1.15 2007/01/15 18:27:11 acolla
55 implementation of sending mail to subdetector expert in case the preprocessor fails.
56 shuttle.schema updated with expert's email entry
58 Revision 1.13 2006/12/07 08:51:26 jgrosseo
60 table, db names in ldap configuration
61 added GRP preprocessor
62 DCS data can also be retrieved by data point
64 Revision 1.12 2006/11/16 16:16:48 jgrosseo
65 introducing strict run ordering flag
66 removed giving preprocessor name to preprocessor, they have to know their name themselves ;-)
68 Revision 1.11 2006/11/06 14:23:04 jgrosseo
69 major update (Alberto)
70 o) reading of run parameters from the logbook
71 o) online offline naming conversion
72 o) standalone DCSclient package
74 Revision 1.10 2006/10/20 15:22:59 jgrosseo
75 o) Adding time out to the execution of the preprocessors: The Shuttle forks and the parent process monitors the child
76 o) Merging Collect, CollectAll, CollectNew function
77 o) Removing implementation of empty copy constructors (declaration still there!)
79 Revision 1.9 2006/10/02 16:38:39 jgrosseo
82 storing of objects that failed to be stored to the grid before
83 interfacing of shuttle status table in daq system
85 Revision 1.8 2006/08/15 10:50:00 jgrosseo
86 effc++ corrections (alberto)
88 Revision 1.7 2006/07/20 09:54:40 jgrosseo
89 introducing status management: The processing per subdetector is divided into several steps,
90 after each step the status is stored on disk. If the system crashes in any of the steps the Shuttle
91 can keep track of the number of failures and skips further processing after a certain threshold is
92 exceeded. These thresholds can be configured in LDAP.
94 Revision 1.6 2006/07/19 10:09:55 jgrosseo
95 new configuration, accesst to DAQ FES (Alberto)
97 Revision 1.5 2006/07/10 13:01:41 jgrosseo
98 enhanced storing of last sucessfully processed run (alberto)
100 Revision 1.4 2006/06/12 09:11:16 jgrosseo
101 coding conventions (Alberto)
103 Revision 1.3 2006/06/06 14:26:40 jgrosseo
104 o) removed files that were moved to STEER
105 o) shuttle updated to follow the new interface (Alberto)
107 Revision 1.7 2006/05/12 09:07:16 colla
109 New configuration complete
111 Revision 1.2 2006/03/07 07:52:34 hristov
112 New version (B.Yordanov)
114 Revision 1.4 2005/11/19 14:20:31 byordano
115 logbook config added to AliShuttleConfig
117 Revision 1.3 2005/11/17 19:24:25 byordano
118 TList changed to TObjArray in AliShuttleConfig
120 Revision 1.2 2005/11/17 14:43:23 byordano
123 Revision 1.1.1.1 2005/10/28 07:33:58 hristov
124 Initial import as subdirectory in AliRoot
126 Revision 1.1.1.1 2005/09/12 22:11:40 byordano
129 Revision 1.3 2005/08/30 09:13:02 byordano
136 // This class keeps the AliShuttle configuration.
137 // It reads the configuration for LDAP server.
138 // For every child entry in basedn which has schema type 'shuttleConfig'
139 // it creates a detector configuration. This configuration includes:
140 // DCS server host and port and the set of aliases for which data from
141 // will be retrieved (used by AliShuttle).
145 #include "AliShuttleConfig.h"
146 #include "AliShuttleInterface.h"
151 #include <TObjString.h>
152 #include <TLDAPResult.h>
153 #include <TLDAPEntry.h>
154 #include <TLDAPAttribute.h>
157 AliShuttleConfig::AliShuttleDCSConfigHolder::AliShuttleDCSConfigHolder(const TLDAPEntry* entry):
163 fDCSDataPointsComp(0),
166 // constructor of the shuttle DCS configuration holder
168 TLDAPAttribute* anAttribute;
169 fDCSAliases = new TObjArray();
170 fDCSAliases->SetOwner(1);
171 fDCSDataPoints = new TObjArray();
172 fDCSDataPoints->SetOwner(1);
173 fDCSAliasesComp = new TObjArray();
174 fDCSAliasesComp->SetOwner(1);
175 fDCSDataPointsComp = new TObjArray();
176 fDCSDataPointsComp->SetOwner(1);
179 anAttribute = entry->GetAttribute("dcsHost");
182 AliError("Unexpected: no DCS host!");
186 fDCSHost = anAttribute->GetValue();
188 anAttribute = entry->GetAttribute("dcsPort");
191 AliError("Unexpected: no DCS port!");
194 TString portStr = anAttribute->GetValue();
195 fDCSPort = portStr.Atoi();
197 anAttribute = entry->GetAttribute("dcsAlias"); // MAY
201 while ((anAlias = anAttribute->GetValue()))
203 fDCSAliasesComp->AddLast(new TObjString(anAlias));
204 ExpandAndAdd(fDCSAliases, anAlias);
208 anAttribute = entry->GetAttribute("dcsDP"); // MAY
211 const char* aDataPoint;
212 while ((aDataPoint = anAttribute->GetValue()))
214 fDCSDataPointsComp->AddLast(new TObjString(aDataPoint));
215 ExpandAndAdd(fDCSDataPoints, aDataPoint);
222 //______________________________________________________________________________________________
223 void AliShuttleConfig::AliShuttleDCSConfigHolder::ExpandAndAdd(TObjArray* target, const char* entry)
226 // adds <entry> to <target> applying expanding of the name
227 // [N..M] creates M-N+1 names with the corresponding digits
230 TString entryStr(entry);
232 Int_t begin = entryStr.Index("[");
233 Int_t end = entryStr.Index("]");
234 if (begin != -1 && end != -1 && end > begin)
236 TString before(entryStr(0, begin));
237 TString after(entryStr(end+1, entryStr.Length()));
239 AliDebug(2, Form("Found [] pattern. Splitted input string %s %s", before.Data(), after.Data()));
241 Int_t dotdot = entryStr.Index("..");
243 TString nStr(entryStr(begin+1, dotdot-begin-1));
244 TString mStr(entryStr(dotdot+2, end-dotdot-2));
246 AliDebug(2, Form("Found [N..M] pattern. %s %s", nStr.Data(), mStr.Data()));
248 if (nStr.IsDigit() && mStr.IsDigit())
250 Int_t n = nStr.Atoi();
251 Int_t m = mStr.Atoi();
253 Int_t nDigits = nStr.Length();
255 formatStr.Form("%%s%%0%dd%%s", nDigits);
257 AliDebug(2, Form("Format string is %s", formatStr.Data()));
259 for (Int_t current = n; current<=m; ++current)
262 newEntry.Form(formatStr.Data(), before.Data(), current, after.Data());
264 AliDebug(2, Form("Calling recursive with %s", newEntry.Data()));
267 ExpandAndAdd(target, newEntry);
270 // return here because we processed the entries already recursively.
275 AliDebug(2, Form("Adding name %s", entry));
276 target->AddLast(new TObjString(entry));
279 //______________________________________________________________________________________________
280 AliShuttleConfig::AliShuttleDCSConfigHolder::~AliShuttleDCSConfigHolder()
282 // destructor of the shuttle configuration holder
285 delete fDCSDataPoints;
286 delete fDCSAliasesComp;
287 delete fDCSDataPointsComp;
290 //______________________________________________________________________________________________
291 AliShuttleConfig::AliShuttleDetConfigHolder::AliShuttleDetConfigHolder(const TLDAPEntry* entry):
296 fSkipDCSQuery(kFALSE),
297 fStrictRunOrder(kFALSE)
299 // constructor of the shuttle configuration holder
301 TLDAPAttribute* anAttribute;
303 fResponsibles = new TObjArray();
304 fResponsibles->SetOwner(1);
305 fDCSConfig = new TObjArray();
306 fDCSConfig->SetOwner(1);
308 anAttribute = entry->GetAttribute("det"); // MUST
311 AliError(Form("No \"det\" attribute!"));
314 fDetector = anAttribute->GetValue();
316 anAttribute = entry->GetAttribute("strictRunOrder"); // MAY
319 AliWarning(Form("%s did not set strictRunOrder flag - the default is FALSE",
322 TString strictRunStr = anAttribute->GetValue();
323 if (!(strictRunStr == "0" || strictRunStr == "1"))
325 AliError("strictRunOrder flag must be 0 or 1!");
328 fStrictRunOrder = (Bool_t) strictRunStr.Atoi();
331 anAttribute = entry->GetAttribute("responsible"); // MAY
334 AliDebug(2, "Warning! No \"responsible\" attribute!");
338 const char* aResponsible;
339 while ((aResponsible = anAttribute->GetValue()))
341 fResponsibles->AddLast(new TObjString(aResponsible));
348 //______________________________________________________________________________________________
349 AliShuttleConfig::AliShuttleDetConfigHolder::~AliShuttleDetConfigHolder()
351 // destructor of the shuttle configuration holder
353 delete fResponsibles;
357 //______________________________________________________________________________________________
358 const char* AliShuttleConfig::AliShuttleDetConfigHolder::GetDCSHost(Int_t iServ) const
361 // returns DCS server host
364 if (iServ < 0 || iServ >= GetNServers()) return 0;
366 AliShuttleDCSConfigHolder *aHolder = dynamic_cast<AliShuttleDCSConfigHolder *>
367 (fDCSConfig->At(iServ));
369 return aHolder->GetDCSHost();
372 //______________________________________________________________________________________________
373 Int_t AliShuttleConfig::AliShuttleDetConfigHolder::GetDCSPort(Int_t iServ) const
376 // returns DCS server port
379 if (iServ < 0 || iServ >= GetNServers()) return 0;
381 AliShuttleDCSConfigHolder *aHolder = dynamic_cast<AliShuttleDCSConfigHolder *>
382 (fDCSConfig->At(iServ));
384 return aHolder->GetDCSPort();
387 //______________________________________________________________________________________________
388 const TObjArray* AliShuttleConfig::AliShuttleDetConfigHolder::GetDCSAliases(Int_t iServ) const
391 // returns collection of TObjString which represents the set of aliases
392 // which used for data retrieval for particular detector
395 if (iServ < 0 || iServ >= GetNServers()) return 0;
397 AliShuttleDCSConfigHolder *aHolder = dynamic_cast<AliShuttleDCSConfigHolder *>
398 (fDCSConfig->At(iServ));
400 return aHolder->GetDCSAliases();
403 //______________________________________________________________________________________________
404 const TObjArray* AliShuttleConfig::AliShuttleDetConfigHolder::GetDCSDataPoints(Int_t iServ) const
407 // returns collection of TObjString which represents the set of aliases
408 // which used for data retrieval for particular detector
411 if (iServ < 0 || iServ >= GetNServers()) return 0;
413 AliShuttleDCSConfigHolder *aHolder = dynamic_cast<AliShuttleDCSConfigHolder *>
414 (fDCSConfig->At(iServ));
416 return aHolder->GetDCSDataPoints();
419 //______________________________________________________________________________________________
420 const TObjArray* AliShuttleConfig::AliShuttleDetConfigHolder::GetCompactDCSAliases(Int_t iServ) const
423 // returns collection of TObjString which represents the set of aliases
424 // which used for data retrieval for particular detector (Compact style)
427 if (iServ < 0 || iServ >= GetNServers()) return 0;
429 AliShuttleDCSConfigHolder *aHolder = dynamic_cast<AliShuttleDCSConfigHolder *>
430 (fDCSConfig->At(iServ));
432 return aHolder->GetCompactDCSAliases();
435 //______________________________________________________________________________________________
436 const TObjArray* AliShuttleConfig::AliShuttleDetConfigHolder::GetCompactDCSDataPoints(Int_t iServ) const
439 // returns collection of TObjString which represents the set of aliases
440 // which used for data retrieval for particular detector (Compact style)
443 if (iServ < 0 || iServ >= GetNServers()) return 0;
445 AliShuttleDCSConfigHolder *aHolder = dynamic_cast<AliShuttleDCSConfigHolder *>
446 (fDCSConfig->At(iServ));
448 return aHolder->GetCompactDCSDataPoints();
451 //______________________________________________________________________________________________
452 void AliShuttleConfig::AliShuttleDetConfigHolder::AddDCSConfig(AliShuttleDCSConfigHolder* holder)
455 // adds a DCS configuration set in the array of DCS configurations
459 fDCSConfig->AddLast(holder);
462 ClassImp(AliShuttleConfig)
464 //______________________________________________________________________________________________
465 AliShuttleConfig::AliShuttleConfig(const char* host, Int_t port,
466 const char* binddn, const char* password, const char* basedn):
481 fShuttleInstanceHost(""),
482 fProcessedDetectors(),
487 // host: ldap server host
488 // port: ldap server port
489 // binddn: binddn used for ldap binding (simple bind is used!).
490 // password: password for binddn
491 // basedn: this is basedn whose childeren entries which have
494 fDetectorMap.SetOwner(1);
495 fDetectorList.SetOwner(0); //fDetectorList and fDetectorMap share the same object!
496 fProcessedDetectors.SetOwner();
498 TLDAPServer aServer(host, port, binddn, password, 3);
500 if (!aServer.IsConnected()) {
501 AliError(Form("Can't connect to ldap server %s:%d",
506 // reads configuration for the shuttle running on this machine
508 TLDAPResult* aResult = 0;
509 TLDAPEntry* anEntry = 0;
516 globalList.SetOwner(1);
520 hostList.SetOwner(1);
522 aResult = aServer.Search(basedn, LDAP_SCOPE_SUBTREE, 0, 0);
526 AliError(Form("Can't find configuration with base DN: %s !", basedn));
530 while ((anEntry = aResult->GetNext()))
532 TString dn = anEntry->GetDn();
534 if (dn.BeginsWith("dcsHost="))
536 dcsList.Add(anEntry);
538 else if (dn.BeginsWith("det="))
540 detList.Add(anEntry);
542 else if (dn.BeginsWith("name=globalConfig"))
544 globalList.Add(anEntry);
546 else if (dn.BeginsWith("system="))
548 sysList.Add(anEntry);
550 else if (dn.BeginsWith("shuttleHost="))
552 hostList.Add(anEntry);
564 result += SetGlobalConfig(&globalList);
565 result += SetSysConfig(&sysList);
566 result += SetDetConfig(&detList,&dcsList);
567 result += SetHostConfig(&hostList);
571 AliError("Configuration is INVALID!");
579 //______________________________________________________________________________________________
580 AliShuttleConfig::~AliShuttleConfig()
584 fDetectorMap.DeleteAll();
585 fDetectorList.Clear();
586 fProcessedDetectors.Delete();
589 //______________________________________________________________________________________________
590 const TObjArray* AliShuttleConfig::GetDetectors() const
593 // returns collection of TObjString which contains the name
594 // of every detector which is in the configuration.
597 return &fDetectorList;
600 //______________________________________________________________________________________________
601 Bool_t AliShuttleConfig::HasDetector(const char* detector) const
604 // checks for paricular detector in the configuration.
606 return fDetectorMap.GetValue(detector) != NULL;
609 //______________________________________________________________________________________________
610 Int_t AliShuttleConfig::GetNServers(const char* detector) const
613 // returns number of DCS servers for detector
616 AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) fDetectorMap.GetValue(detector);
618 AliError(Form("There isn't configuration for detector: %s",
623 return aHolder->GetNServers();
627 //______________________________________________________________________________________________
628 const char* AliShuttleConfig::GetDCSHost(const char* detector, Int_t iServ) const
631 // returns i-th DCS server host used by particular detector
634 AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) fDetectorMap.GetValue(detector);
636 AliError(Form("There isn't configuration for detector: %s",
641 return aHolder->GetDCSHost(iServ);
644 //______________________________________________________________________________________________
645 Int_t AliShuttleConfig::GetDCSPort(const char* detector, Int_t iServ) const
648 // returns i-th DCS server port used by particular detector
652 AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) fDetectorMap.GetValue(detector);
654 AliError(Form("There isn't configuration for detector: %s",
659 return aHolder->GetDCSPort(iServ);
662 //______________________________________________________________________________________________
663 const TObjArray* AliShuttleConfig::GetDCSAliases(const char* detector, Int_t iServ) const
666 // returns collection of TObjString which represents the i-th set of aliases
667 // which used for data retrieval for particular detector
670 AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) fDetectorMap.GetValue(detector);
672 AliError(Form("There isn't configuration for detector: %s",
677 return aHolder->GetDCSAliases(iServ);
680 //______________________________________________________________________________________________
681 const TObjArray* AliShuttleConfig::GetDCSDataPoints(const char* detector, Int_t iServ) const
684 // returns collection of TObjString which represents the set of aliases
685 // which used for data retrieval for particular detector
688 AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) fDetectorMap.GetValue(detector);
690 AliError(Form("There isn't configuration for detector: %s",
695 return aHolder->GetDCSDataPoints(iServ);
698 //______________________________________________________________________________________________
699 const TObjArray* AliShuttleConfig::GetCompactDCSAliases(const char* detector, Int_t iServ) const
702 // returns collection of TObjString which represents the i-th set of aliases
703 // which used for data retrieval for particular detector (Compact style)
706 AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) fDetectorMap.GetValue(detector);
708 AliError(Form("There isn't configuration for detector: %s",
713 return aHolder->GetCompactDCSAliases(iServ);
716 //______________________________________________________________________________________________
717 const TObjArray* AliShuttleConfig::GetCompactDCSDataPoints(const char* detector, Int_t iServ) const
720 // returns collection of TObjString which represents the set of aliases
721 // which used for data retrieval for particular detector (Compact style)
724 AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) fDetectorMap.GetValue(detector);
726 AliError(Form("There isn't configuration for detector: %s",
731 return aHolder->GetCompactDCSDataPoints(iServ);
734 //______________________________________________________________________________________________
735 const TObjArray* AliShuttleConfig::GetResponsibles(const char* detector) const
738 // returns collection of TObjString which represents the list of mail addresses
739 // of the detector's responsible(s)
742 AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) fDetectorMap.GetValue(detector);
744 AliError(Form("There isn't configuration for detector: %s",
749 return aHolder->GetResponsibles();
752 //______________________________________________________________________________________________
753 Bool_t AliShuttleConfig::HostProcessDetector(const char* detector) const
755 // return TRUE if detector is handled by host or if fProcessAll is TRUE
757 if(fProcessAll) return kTRUE;
758 TIter iter(&fProcessedDetectors);
760 while((detName = (TObjString*) iter.Next())){
761 if(detName->String() == detector) return kTRUE;
766 //______________________________________________________________________________________________
767 Bool_t AliShuttleConfig::StrictRunOrder(const char* detector) const
769 // return TRUE if detector wants strict run ordering of stored data
771 AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) fDetectorMap.GetValue(detector);
774 AliError(Form("There isn't configuration for detector: %s",
779 return aHolder->StrictRunOrder();
782 //______________________________________________________________________________________________
783 UInt_t AliShuttleConfig::SetGlobalConfig(TList* list)
785 // Set the global configuration (DAQ Logbook + preprocessor monitoring settings)
787 TLDAPEntry* anEntry = 0;
788 TLDAPAttribute* anAttribute = 0;
790 if (list->GetEntries() == 0)
792 AliError("Global configuration not found!");
795 else if (list->GetEntries() > 1)
797 AliError("More than one global configuration found!");
801 anEntry = dynamic_cast<TLDAPEntry*> (list->At(0));
805 AliError("Unexpected! Global list does not contain a TLDAPEntry");
810 anAttribute = anEntry->GetAttribute("daqLbHost");
812 AliError("Can't find daqLbHost attribute!");
815 fDAQlbHost = anAttribute->GetValue();
817 anAttribute = anEntry->GetAttribute("daqLbPort"); // MAY
820 fDAQlbPort = ((TString) anAttribute->GetValue()).Atoi();
822 fDAQlbPort = 3306; // mysql
825 anAttribute = anEntry->GetAttribute("daqLbUser");
827 AliError("Can't find daqLbUser attribute!");
830 fDAQlbUser = anAttribute->GetValue();
832 anAttribute = anEntry->GetAttribute("daqLbPasswd");
834 AliError("Can't find daqLbPasswd attribute!");
837 fDAQlbPass = anAttribute->GetValue();
839 anAttribute = anEntry->GetAttribute("daqLbDB");
841 AliError("Can't find daqLbDB attribute!");
844 fDAQlbDB = anAttribute->GetValue();
846 anAttribute = anEntry->GetAttribute("daqLbTable");
848 AliError("Can't find daqLbTable attribute!");
851 fDAQlbTable = anAttribute->GetValue();
853 anAttribute = anEntry->GetAttribute("shuttleLbTable");
855 AliError("Can't find shuttleLbTable attribute!");
858 fShuttlelbTable = anAttribute->GetValue();
860 anAttribute = anEntry->GetAttribute("runTypeLbTable");
862 AliError("Can't find runTypeLbTable attribute!");
865 fRunTypelbTable = anAttribute->GetValue();
867 anAttribute = anEntry->GetAttribute("ppmaxRetries");
869 AliError("Can't find ppmaxRetries attribute!");
872 TString tmpStr = anAttribute->GetValue();
873 fMaxRetries = tmpStr.Atoi();
875 anAttribute = anEntry->GetAttribute("ppTimeOut");
877 AliError("Can't find ppTimeOut attribute!");
880 tmpStr = anAttribute->GetValue();
881 fPPTimeOut = tmpStr.Atoi();
883 anAttribute = anEntry->GetAttribute("ppMaxMem");
885 AliError("Can't find ppMaxMem attribute!");
888 tmpStr = anAttribute->GetValue();
889 fPPMaxMem = tmpStr.Atoi();
896 //______________________________________________________________________________________________
897 UInt_t AliShuttleConfig::SetSysConfig(TList* list)
899 // Set the online FXS configuration (DAQ + DCS + HLT)
901 TLDAPEntry* anEntry = 0;
902 TLDAPAttribute* anAttribute = 0;
904 if (list->GetEntries() != 3)
906 AliError(Form("Wrong number of online systems found: %d !", list->GetEntries()));
911 Int_t iSys=0, count = 0;
912 while ((anEntry = dynamic_cast<TLDAPEntry*> (iter.Next())))
914 anAttribute = anEntry->GetAttribute("system");
915 TString sysName = anAttribute->GetValue();
917 if (sysName == "DAQ")
922 else if (sysName == "DCS")
927 else if (sysName == "HLT")
933 anAttribute = anEntry->GetAttribute("dbHost");
935 AliError(Form ("Can't find dbHost attribute for %s!!",
936 AliShuttleInterface::GetSystemName(iSys)));
939 fFXSdbHost[iSys] = anAttribute->GetValue();
941 anAttribute = anEntry->GetAttribute("dbPort"); // MAY
944 fFXSdbPort[iSys] = ((TString) anAttribute->GetValue()).Atoi();
946 fFXSdbPort[iSys] = 3306; // mysql
949 anAttribute = anEntry->GetAttribute("dbUser");
951 AliError(Form ("Can't find dbUser attribute for %s!!",
952 AliShuttleInterface::GetSystemName(iSys)));
955 fFXSdbUser[iSys] = anAttribute->GetValue();
957 anAttribute = anEntry->GetAttribute("dbPasswd");
959 AliError(Form ("Can't find dbPasswd attribute for %s!!",
960 AliShuttleInterface::GetSystemName(iSys)));
963 fFXSdbPass[iSys] = anAttribute->GetValue();
965 anAttribute = anEntry->GetAttribute("dbName");
967 AliError(Form ("Can't find dbName attribute for %s!!",
968 AliShuttleInterface::GetSystemName(iSys)));
972 fFXSdbName[iSys] = anAttribute->GetValue();
973 anAttribute = anEntry->GetAttribute("dbTable");
975 AliError(Form ("Can't find dbTable attribute for %s!!",
976 AliShuttleInterface::GetSystemName(iSys)));
979 fFXSdbTable[iSys] = anAttribute->GetValue();
981 anAttribute = anEntry->GetAttribute("fxsHost");
983 AliError(Form ("Can't find fxsHost attribute for %s!!",
984 AliShuttleInterface::GetSystemName(iSys)));
987 fFXSHost[iSys] = anAttribute->GetValue();
989 anAttribute = anEntry->GetAttribute("fxsPort"); // MAY
992 fFXSPort[iSys] = ((TString) anAttribute->GetValue()).Atoi();
994 fFXSPort[iSys] = 22; // scp port number
997 anAttribute = anEntry->GetAttribute("fxsUser");
999 AliError(Form ("Can't find fxsUser attribute for %s!!",
1000 AliShuttleInterface::GetSystemName(iSys)));
1003 fFXSUser[iSys] = anAttribute->GetValue();
1005 anAttribute = anEntry->GetAttribute("fxsPasswd");
1006 if (anAttribute) fFXSPass[iSys] = anAttribute->GetValue();
1010 AliError(Form("Wrong system configuration! (code = %d)", count));
1017 //______________________________________________________________________________________________
1018 UInt_t AliShuttleConfig::SetDetConfig(TList* detList, TList* dcsList)
1020 // Set the detector configuration (general settings + DCS amanda server and alias/DP lists)
1022 TLDAPEntry* anEntry = 0;
1024 TIter iter(detList);
1025 while ((anEntry = dynamic_cast<TLDAPEntry*> (iter.Next())))
1028 AliShuttleDetConfigHolder* detHolder = new AliShuttleDetConfigHolder(anEntry);
1030 if (!detHolder->IsValid()) {
1031 AliError("Detector configuration error!");
1036 TObjString* detStr = new TObjString(detHolder->GetDetector());
1038 // Look for DCS Configuration
1039 TIter dcsIter(dcsList);
1040 TLDAPEntry *dcsEntry = 0;
1041 while ((dcsEntry = dynamic_cast<TLDAPEntry*> (dcsIter.Next())))
1043 TString dn = dcsEntry->GetDn();
1044 if(dn.Contains(detStr->GetName())) {
1045 AliDebug(2, Form("Found DCS configuration: dn = %s",dn.Data()));
1046 AliShuttleDCSConfigHolder* dcsHolder = new AliShuttleDCSConfigHolder(dcsEntry);
1047 if (!dcsHolder->IsValid()) {
1048 AliError("DCS configuration error!");
1053 detHolder->AddDCSConfig(dcsHolder);
1058 fDetectorMap.Add(detStr, detHolder);
1059 fDetectorList.AddLast(detStr);
1065 //______________________________________________________________________________________________
1066 UInt_t AliShuttleConfig::SetHostConfig(TList* list)
1068 // Set the Shuttle machines configuration (which detectors processes each machine)
1070 TLDAPEntry* anEntry = 0;
1071 TLDAPAttribute* anAttribute = 0;
1073 fShuttleInstanceHost = gSystem->HostName();
1076 while ((anEntry = dynamic_cast<TLDAPEntry*> (iter.Next())))
1079 TString dn(anEntry->GetDn());
1080 if (!dn.Contains(Form("shuttleHost=%s", fShuttleInstanceHost.Data()))) continue;
1084 anAttribute = anEntry->GetAttribute("detectors");
1085 const char *detName;
1086 while((detName = anAttribute->GetValue())){
1087 TObjString *objDet= new TObjString(detName);
1088 fProcessedDetectors.Add(objDet);
1097 //______________________________________________________________________________________________
1098 void AliShuttleConfig::Print(Option_t* option) const
1100 // print configuration
1101 // options : "": print configuration for all detectors, aliases and DPs in compacted format
1102 // "uncompact": print configuration for all detectors, aliases and DPs in uncompacted format
1103 // "DET": print configuration for DET, aliases and DPs in compacted format
1104 // "DET, uncompact": print configuration for DET, aliases and DPs in uncompacted format
1109 result += "####################################################\n";
1110 result += Form(" Shuttle configuration from %s \n", fConfigHost.Data());
1111 result += "####################################################\n";
1112 result += Form("\nShuttle running on %s \n", fShuttleInstanceHost.Data());
1115 result += Form("All detectors will be processed! \n");
1117 result += "Detectors processed by this host: ";
1118 TIter it(&fProcessedDetectors);
1120 while ((aDet = (TObjString*) it.Next())) {
1121 result += Form("%s ", aDet->String().Data());
1126 result += Form("PP time out = %d - max PP mem size = %d KB - max retries = %d\n\n",
1127 fPPTimeOut, fPPMaxMem, fMaxRetries);
1128 result += "------------------------------------------------------\n";
1130 result += Form("Logbook Configuration \n\n \tHost: %s:%d; \tUser: %s; ",
1131 fDAQlbHost.Data(), fDAQlbPort, fDAQlbUser.Data());
1133 // result += "Password: ";
1134 // result.Append('*', fDAQlbPass.Length());
1135 result += Form("\tDB: %s; \tTables: %s, %s, %s",
1136 fDAQlbDB.Data(), fDAQlbTable.Data(), fShuttlelbTable.Data(), fRunTypelbTable.Data());
1140 result += "------------------------------------------------------\n";
1141 result += "FXS configuration\n\n";
1143 for(int iSys=0;iSys<3;iSys++){
1144 result += Form("*** %s ***\n", AliShuttleInterface::GetSystemName(iSys));
1145 result += Form("\tDB host: %s:%d; \tUser: %s; \tName: %s; \tTable: %s\n",
1146 fFXSdbHost[iSys].Data(), fFXSdbPort[iSys], fFXSdbUser[iSys].Data(),
1147 fFXSdbName[iSys].Data(), fFXSdbTable[iSys].Data());
1148 // result += Form("DB Password:",fFXSdbPass[iSys].Data());
1149 result += Form("\tFXS host: %s:%d; \tUser: %s\n\n", fFXSHost[iSys].Data(), fFXSPort[iSys],
1150 fFXSUser[iSys].Data());
1151 // result += Form("FXS Password:",fFXSPass[iSys].Data());
1154 TString optStr(option);
1156 result += "------------------------------------------------------\n";
1157 result += "Detector-specific configuration\n\n";
1159 TIter iter(fDetectorMap.GetTable());
1162 AliInfo(Form("Option = %s", option));
1164 while ((aPair = (TPair*) iter.Next())) {
1165 AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) aPair->Value();
1166 if (optStr != "" && !optStr.Contains(aHolder->GetDetector()) &&
1167 optStr.CompareTo("uncompact",TString::kIgnoreCase) != 0 )
1170 result += Form("*** %s *** \n", aHolder->GetDetector());
1172 const TObjArray* responsibles = aHolder->GetResponsibles();
1173 if (responsibles->GetEntries() != 0)
1175 result += "\tDetector responsible(s): ";
1176 TIter it(responsibles);
1177 TObjString* aResponsible;
1178 while ((aResponsible = (TObjString*) it.Next()))
1180 result += Form("%s ", aResponsible->String().Data());
1185 result += Form("\tStrict run ordering: %s \n\n", aHolder->StrictRunOrder() ? "YES" : "NO");
1187 const TObjArray* dcsConfig = aHolder->GetDCSConfig();
1189 AliShuttleDCSConfigHolder* dcsHolder = 0;
1190 TIter dcsIter(dcsConfig);
1192 while ((dcsHolder = dynamic_cast<AliShuttleDCSConfigHolder*> (dcsIter.Next())))
1194 result += Form("\tAmanda server [%d]: %s:%d \n", count,
1195 dcsHolder->GetDCSHost(), dcsHolder->GetDCSPort());
1197 const TObjArray* aliases = 0;
1198 if (optStr.Contains("uncompact",TString::kIgnoreCase))
1200 aliases = dcsHolder->GetDCSAliases();
1202 aliases = dcsHolder->GetCompactDCSAliases();
1205 if (aliases->GetEntries() != 0)
1207 result += Form("\tDCS Aliases [%d]: ", count);
1209 TObjString* anAlias;
1210 while ((anAlias = (TObjString*) it.Next()))
1212 result += Form("%s ", anAlias->String().Data());
1217 const TObjArray* dataPoints = 0;
1218 if (optStr.Contains("uncompact",TString::kIgnoreCase))
1220 dataPoints = dcsHolder->GetDCSDataPoints();
1222 dataPoints = dcsHolder->GetCompactDCSDataPoints();
1224 if (dataPoints->GetEntries() != 0)
1226 result += Form("\tDCS Data Points [%d]: ", count);
1227 TIter it(dataPoints);
1228 TObjString* aDataPoint;
1229 while ((aDataPoint = (TObjString*) it.Next())) {
1230 result += Form("%s ", aDataPoint->String().Data());
1238 if(!fIsValid) result += "\n\n********** !!!!! Configuration is INVALID !!!!! **********\n";