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.24 2007/10/24 10:44:08 acolla
22 Revision 1.23 2007/09/28 15:27:40 acolla
24 AliDCSClient "multiSplit" option added in the DCS configuration
25 in AliDCSMessage: variable MAX_BODY_SIZE set to 500000
27 Revision 1.22 2007/09/27 16:53:13 acolla
28 Detectors can have more than one AMANDA server. SHUTTLE queries the servers sequentially,
29 merges the dcs aliases/DPs in one TMap and sends it to the preprocessor.
31 Revision 1.21 2007/04/27 07:06:48 jgrosseo
32 GetFileSources returns empty list in case of no files, but successful query
33 No mails sent in testmode
35 Revision 1.20 2007/04/04 10:33:36 jgrosseo
36 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.
37 In case of an error with the Grid, the Shuttle will retry the storing later, the preprocessor does not need to be run again.
39 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.
41 3) New function StoreReferenceFile to _directly_ store a file (without opening it) to the reference storage.
43 4) The memory usage of the preprocessor is monitored. If it exceeds 2 GB it is terminated.
45 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.
46 If you always need DCS data (like before), you do not need to implement it.
48 6) The run type has been added to the monitoring page
50 Revision 1.19 2007/02/28 10:41:56 acolla
51 Run type field added in SHUTTLE framework. Run type is read from "run type" logbook and retrieved by
52 AliPreprocessor::GetRunType() function.
53 Added some ldap definition files.
55 Revision 1.18 2007/01/23 19:20:03 acolla
56 Removed old ldif files, added TOF, MCH ldif files. Added some options in
57 AliShuttleConfig::Print. Added in Ali Shuttle: SetShuttleTempDir and
60 Revision 1.17 2007/01/18 11:17:47 jgrosseo
61 changing spaces to tabs ;-)
63 Revision 1.16 2007/01/18 11:10:35 jgrosseo
64 adding the possibility of defining DCS alias and data points with patterns
65 first pattern introduced: [N..M] to add all names between the two digits, this works also recursively.
67 Revision 1.15 2007/01/15 18:27:11 acolla
68 implementation of sending mail to subdetector expert in case the preprocessor fails.
69 shuttle.schema updated with expert's email entry
71 Revision 1.13 2006/12/07 08:51:26 jgrosseo
73 table, db names in ldap configuration
74 added GRP preprocessor
75 DCS data can also be retrieved by data point
77 Revision 1.12 2006/11/16 16:16:48 jgrosseo
78 introducing strict run ordering flag
79 removed giving preprocessor name to preprocessor, they have to know their name themselves ;-)
81 Revision 1.11 2006/11/06 14:23:04 jgrosseo
82 major update (Alberto)
83 o) reading of run parameters from the logbook
84 o) online offline naming conversion
85 o) standalone DCSclient package
87 Revision 1.10 2006/10/20 15:22:59 jgrosseo
88 o) Adding time out to the execution of the preprocessors: The Shuttle forks and the parent process monitors the child
89 o) Merging Collect, CollectAll, CollectNew function
90 o) Removing implementation of empty copy constructors (declaration still there!)
92 Revision 1.9 2006/10/02 16:38:39 jgrosseo
95 storing of objects that failed to be stored to the grid before
96 interfacing of shuttle status table in daq system
98 Revision 1.8 2006/08/15 10:50:00 jgrosseo
99 effc++ corrections (alberto)
101 Revision 1.7 2006/07/20 09:54:40 jgrosseo
102 introducing status management: The processing per subdetector is divided into several steps,
103 after each step the status is stored on disk. If the system crashes in any of the steps the Shuttle
104 can keep track of the number of failures and skips further processing after a certain threshold is
105 exceeded. These thresholds can be configured in LDAP.
107 Revision 1.6 2006/07/19 10:09:55 jgrosseo
108 new configuration, accesst to DAQ FES (Alberto)
110 Revision 1.5 2006/07/10 13:01:41 jgrosseo
111 enhanced storing of last sucessfully processed run (alberto)
113 Revision 1.4 2006/06/12 09:11:16 jgrosseo
114 coding conventions (Alberto)
116 Revision 1.3 2006/06/06 14:26:40 jgrosseo
117 o) removed files that were moved to STEER
118 o) shuttle updated to follow the new interface (Alberto)
120 Revision 1.7 2006/05/12 09:07:16 colla
122 New configuration complete
124 Revision 1.2 2006/03/07 07:52:34 hristov
125 New version (B.Yordanov)
127 Revision 1.4 2005/11/19 14:20:31 byordano
128 logbook config added to AliShuttleConfig
130 Revision 1.3 2005/11/17 19:24:25 byordano
131 TList changed to TObjArray in AliShuttleConfig
133 Revision 1.2 2005/11/17 14:43:23 byordano
136 Revision 1.1.1.1 2005/10/28 07:33:58 hristov
137 Initial import as subdirectory in AliRoot
139 Revision 1.1.1.1 2005/09/12 22:11:40 byordano
142 Revision 1.3 2005/08/30 09:13:02 byordano
149 // This class keeps the AliShuttle configuration.
150 // It reads the configuration for LDAP server.
151 // For every child entry in basedn which has schema type 'shuttleConfig'
152 // it creates a detector configuration. This configuration includes:
153 // DCS server host and port and the set of aliases for which data from
154 // will be retrieved (used by AliShuttle).
158 #include "AliShuttleConfig.h"
159 #include "AliShuttleInterface.h"
164 #include <TObjString.h>
165 #include <TLDAPResult.h>
166 #include <TLDAPEntry.h>
167 #include <TLDAPAttribute.h>
170 AliShuttleConfig::AliShuttleDCSConfigHolder::AliShuttleDCSConfigHolder(const TLDAPEntry* entry):
177 fDCSDataPointsComp(0),
180 // constructor of the shuttle DCS configuration holder
182 TLDAPAttribute* anAttribute;
183 fDCSAliases = new TObjArray();
184 fDCSAliases->SetOwner(1);
185 fDCSDataPoints = new TObjArray();
186 fDCSDataPoints->SetOwner(1);
187 fDCSAliasesComp = new TObjArray();
188 fDCSAliasesComp->SetOwner(1);
189 fDCSDataPointsComp = new TObjArray();
190 fDCSDataPointsComp->SetOwner(1);
193 anAttribute = entry->GetAttribute("dcsHost");
196 AliError("Unexpected: no DCS host!");
200 fDCSHost = anAttribute->GetValue();
202 anAttribute = entry->GetAttribute("dcsPort");
205 AliError("Unexpected: no DCS port!");
208 TString portStr = anAttribute->GetValue();
209 fDCSPort = portStr.Atoi();
211 anAttribute = entry->GetAttribute("multiSplit"); // MAY
214 TString multiSplitStr = anAttribute->GetValue();
215 fMultiSplit = multiSplitStr.Atoi();
216 if(fMultiSplit == 0) {
217 AliError("MultiSplit must be a positive integer!");
223 anAttribute = entry->GetAttribute("dcsAlias"); // MAY
227 while ((anAlias = anAttribute->GetValue()))
229 fDCSAliasesComp->AddLast(new TObjString(anAlias));
230 ExpandAndAdd(fDCSAliases, anAlias);
234 anAttribute = entry->GetAttribute("dcsDP"); // MAY
237 const char* aDataPoint;
238 while ((aDataPoint = anAttribute->GetValue()))
240 fDCSDataPointsComp->AddLast(new TObjString(aDataPoint));
241 ExpandAndAdd(fDCSDataPoints, aDataPoint);
248 //______________________________________________________________________________________________
249 void AliShuttleConfig::AliShuttleDCSConfigHolder::ExpandAndAdd(TObjArray* target, const char* entry)
252 // adds <entry> to <target> applying expanding of the name
253 // [N..M] creates M-N+1 names with the corresponding digits
256 TString entryStr(entry);
258 Int_t begin = entryStr.Index("[");
259 Int_t end = entryStr.Index("]");
260 if (begin != -1 && end != -1 && end > begin)
262 TString before(entryStr(0, begin));
263 TString after(entryStr(end+1, entryStr.Length()));
265 AliDebug(2, Form("Found [] pattern. Splitted input string %s %s", before.Data(), after.Data()));
267 Int_t dotdot = entryStr.Index("..");
269 TString nStr(entryStr(begin+1, dotdot-begin-1));
270 TString mStr(entryStr(dotdot+2, end-dotdot-2));
272 AliDebug(2, Form("Found [N..M] pattern. %s %s", nStr.Data(), mStr.Data()));
274 if (nStr.IsDigit() && mStr.IsDigit())
276 Int_t n = nStr.Atoi();
277 Int_t m = mStr.Atoi();
279 Int_t nDigits = nStr.Length();
281 formatStr.Form("%%s%%0%dd%%s", nDigits);
283 AliDebug(2, Form("Format string is %s", formatStr.Data()));
285 for (Int_t current = n; current<=m; ++current)
288 newEntry.Form(formatStr.Data(), before.Data(), current, after.Data());
290 AliDebug(2, Form("Calling recursive with %s", newEntry.Data()));
293 ExpandAndAdd(target, newEntry);
296 // return here because we processed the entries already recursively.
301 AliDebug(2, Form("Adding name %s", entry));
302 target->AddLast(new TObjString(entry));
305 //______________________________________________________________________________________________
306 AliShuttleConfig::AliShuttleDCSConfigHolder::~AliShuttleDCSConfigHolder()
308 // destructor of the shuttle configuration holder
311 delete fDCSDataPoints;
312 delete fDCSAliasesComp;
313 delete fDCSDataPointsComp;
316 //______________________________________________________________________________________________
317 AliShuttleConfig::AliShuttleDetConfigHolder::AliShuttleDetConfigHolder(const TLDAPEntry* entry):
322 fSkipDCSQuery(kFALSE),
323 fStrictRunOrder(kFALSE)
325 // constructor of the shuttle configuration holder
327 TLDAPAttribute* anAttribute;
329 fResponsibles = new TObjArray();
330 fResponsibles->SetOwner(1);
331 fDCSConfig = new TObjArray();
332 fDCSConfig->SetOwner(1);
334 anAttribute = entry->GetAttribute("det"); // MUST
337 AliError(Form("No \"det\" attribute!"));
340 fDetector = anAttribute->GetValue();
342 anAttribute = entry->GetAttribute("strictRunOrder"); // MAY
345 AliWarning(Form("%s did not set strictRunOrder flag - the default is FALSE",
348 TString strictRunStr = anAttribute->GetValue();
349 if (!(strictRunStr == "0" || strictRunStr == "1"))
351 AliError("strictRunOrder flag must be 0 or 1!");
354 fStrictRunOrder = (Bool_t) strictRunStr.Atoi();
357 anAttribute = entry->GetAttribute("responsible"); // MAY
360 AliDebug(2, "Warning! No \"responsible\" attribute!");
364 const char* aResponsible;
365 while ((aResponsible = anAttribute->GetValue()))
367 fResponsibles->AddLast(new TObjString(aResponsible));
374 //______________________________________________________________________________________________
375 AliShuttleConfig::AliShuttleDetConfigHolder::~AliShuttleDetConfigHolder()
377 // destructor of the shuttle configuration holder
379 delete fResponsibles;
383 //______________________________________________________________________________________________
384 const char* AliShuttleConfig::AliShuttleDetConfigHolder::GetDCSHost(Int_t iServ) const
387 // returns DCS server host
390 if (iServ < 0 || iServ >= GetNServers()) return 0;
392 AliShuttleDCSConfigHolder *aHolder = dynamic_cast<AliShuttleDCSConfigHolder *>
393 (fDCSConfig->At(iServ));
395 return aHolder->GetDCSHost();
398 //______________________________________________________________________________________________
399 Int_t AliShuttleConfig::AliShuttleDetConfigHolder::GetDCSPort(Int_t iServ) const
402 // returns DCS server port
405 if (iServ < 0 || iServ >= GetNServers()) return 0;
407 AliShuttleDCSConfigHolder *aHolder = dynamic_cast<AliShuttleDCSConfigHolder *>
408 (fDCSConfig->At(iServ));
410 return aHolder->GetDCSPort();
413 //______________________________________________________________________________________________
414 Int_t AliShuttleConfig::AliShuttleDetConfigHolder::GetMultiSplit(Int_t iServ) const
417 // returns DCS "multi split" value
420 if (iServ < 0 || iServ >= GetNServers()) return 0;
422 AliShuttleDCSConfigHolder *aHolder = dynamic_cast<AliShuttleDCSConfigHolder *>
423 (fDCSConfig->At(iServ));
425 return aHolder->GetMultiSplit();
428 //______________________________________________________________________________________________
429 const TObjArray* AliShuttleConfig::AliShuttleDetConfigHolder::GetDCSAliases(Int_t iServ) const
432 // returns collection of TObjString which represents the set of aliases
433 // which used for data retrieval for particular detector
436 if (iServ < 0 || iServ >= GetNServers()) return 0;
438 AliShuttleDCSConfigHolder *aHolder = dynamic_cast<AliShuttleDCSConfigHolder *>
439 (fDCSConfig->At(iServ));
441 return aHolder->GetDCSAliases();
444 //______________________________________________________________________________________________
445 const TObjArray* AliShuttleConfig::AliShuttleDetConfigHolder::GetDCSDataPoints(Int_t iServ) const
448 // returns collection of TObjString which represents the set of aliases
449 // which used for data retrieval for particular detector
452 if (iServ < 0 || iServ >= GetNServers()) return 0;
454 AliShuttleDCSConfigHolder *aHolder = dynamic_cast<AliShuttleDCSConfigHolder *>
455 (fDCSConfig->At(iServ));
457 return aHolder->GetDCSDataPoints();
460 //______________________________________________________________________________________________
461 const TObjArray* AliShuttleConfig::AliShuttleDetConfigHolder::GetCompactDCSAliases(Int_t iServ) const
464 // returns collection of TObjString which represents the set of aliases
465 // which used for data retrieval for particular detector (Compact style)
468 if (iServ < 0 || iServ >= GetNServers()) return 0;
470 AliShuttleDCSConfigHolder *aHolder = dynamic_cast<AliShuttleDCSConfigHolder *>
471 (fDCSConfig->At(iServ));
473 return aHolder->GetCompactDCSAliases();
476 //______________________________________________________________________________________________
477 const TObjArray* AliShuttleConfig::AliShuttleDetConfigHolder::GetCompactDCSDataPoints(Int_t iServ) const
480 // returns collection of TObjString which represents the set of aliases
481 // which used for data retrieval for particular detector (Compact style)
484 if (iServ < 0 || iServ >= GetNServers()) return 0;
486 AliShuttleDCSConfigHolder *aHolder = dynamic_cast<AliShuttleDCSConfigHolder *>
487 (fDCSConfig->At(iServ));
489 return aHolder->GetCompactDCSDataPoints();
492 //______________________________________________________________________________________________
493 void AliShuttleConfig::AliShuttleDetConfigHolder::AddDCSConfig(AliShuttleDCSConfigHolder* holder)
496 // adds a DCS configuration set in the array of DCS configurations
500 fDCSConfig->AddLast(holder);
503 ClassImp(AliShuttleConfig)
505 //______________________________________________________________________________________________
506 AliShuttleConfig::AliShuttleConfig(const char* host, Int_t port,
507 const char* binddn, const char* password, const char* basedn):
524 fShuttleInstanceHost(""),
525 fProcessedDetectors(),
530 // host: ldap server host
531 // port: ldap server port
532 // binddn: binddn used for ldap binding (simple bind is used!).
533 // password: password for binddn
534 // basedn: this is basedn whose childeren entries which have
537 fDetectorMap.SetOwner(1);
538 fDetectorList.SetOwner(0); //fDetectorList and fDetectorMap share the same object!
539 fProcessedDetectors.SetOwner();
541 TLDAPServer aServer(host, port, binddn, password, 3);
543 if (!aServer.IsConnected()) {
544 AliError(Form("Can't connect to ldap server %s:%d",
549 // reads configuration for the shuttle running on this machine
551 TLDAPResult* aResult = 0;
552 TLDAPEntry* anEntry = 0;
559 globalList.SetOwner(1);
563 hostList.SetOwner(1);
565 aResult = aServer.Search(basedn, LDAP_SCOPE_SUBTREE, 0, 0);
569 AliError(Form("Can't find configuration with base DN: %s !", basedn));
573 while ((anEntry = aResult->GetNext()))
575 TString dn = anEntry->GetDn();
577 if (dn.BeginsWith("dcsHost="))
579 dcsList.Add(anEntry);
581 else if (dn.BeginsWith("det="))
583 detList.Add(anEntry);
585 else if (dn.BeginsWith("name=globalConfig"))
587 globalList.Add(anEntry);
589 else if (dn.BeginsWith("system="))
591 sysList.Add(anEntry);
593 else if (dn.BeginsWith("shuttleHost="))
595 hostList.Add(anEntry);
607 result += SetGlobalConfig(&globalList);
608 result += SetSysConfig(&sysList);
609 result += SetDetConfig(&detList,&dcsList);
610 result += SetHostConfig(&hostList);
614 AliError("Configuration is INVALID!");
622 //______________________________________________________________________________________________
623 AliShuttleConfig::~AliShuttleConfig()
627 fDetectorMap.DeleteAll();
628 fDetectorList.Clear();
629 fProcessedDetectors.Delete();
632 //______________________________________________________________________________________________
633 const TObjArray* AliShuttleConfig::GetDetectors() const
636 // returns collection of TObjString which contains the name
637 // of every detector which is in the configuration.
640 return &fDetectorList;
643 //______________________________________________________________________________________________
644 Bool_t AliShuttleConfig::HasDetector(const char* detector) const
647 // checks for paricular detector in the configuration.
649 return fDetectorMap.GetValue(detector) != NULL;
652 //______________________________________________________________________________________________
653 Int_t AliShuttleConfig::GetNServers(const char* detector) const
656 // returns number of DCS servers for detector
659 AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) fDetectorMap.GetValue(detector);
661 AliError(Form("There isn't configuration for detector: %s",
666 return aHolder->GetNServers();
670 //______________________________________________________________________________________________
671 const char* AliShuttleConfig::GetDCSHost(const char* detector, Int_t iServ) const
674 // returns i-th DCS server host used by particular detector
677 AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) fDetectorMap.GetValue(detector);
679 AliError(Form("There isn't configuration for detector: %s",
684 return aHolder->GetDCSHost(iServ);
687 //______________________________________________________________________________________________
688 Int_t AliShuttleConfig::GetDCSPort(const char* detector, Int_t iServ) const
691 // returns i-th DCS server port used by particular detector
695 AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) fDetectorMap.GetValue(detector);
697 AliError(Form("There isn't configuration for detector: %s",
702 return aHolder->GetDCSPort(iServ);
705 //______________________________________________________________________________________________
706 Int_t AliShuttleConfig::GetMultiSplit(const char* detector, Int_t iServ) const
709 // returns i-th DCS "multi split" value
713 AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) fDetectorMap.GetValue(detector);
715 AliError(Form("There isn't configuration for detector: %s",
720 return aHolder->GetMultiSplit(iServ);
723 //______________________________________________________________________________________________
724 const TObjArray* AliShuttleConfig::GetDCSAliases(const char* detector, Int_t iServ) const
727 // returns collection of TObjString which represents the i-th set of aliases
728 // which used for data retrieval for particular detector
731 AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) fDetectorMap.GetValue(detector);
733 AliError(Form("There isn't configuration for detector: %s",
738 return aHolder->GetDCSAliases(iServ);
741 //______________________________________________________________________________________________
742 const TObjArray* AliShuttleConfig::GetDCSDataPoints(const char* detector, Int_t iServ) const
745 // returns collection of TObjString which represents the set of aliases
746 // which used for data retrieval for particular detector
749 AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) fDetectorMap.GetValue(detector);
751 AliError(Form("There isn't configuration for detector: %s",
756 return aHolder->GetDCSDataPoints(iServ);
759 //______________________________________________________________________________________________
760 const TObjArray* AliShuttleConfig::GetCompactDCSAliases(const char* detector, Int_t iServ) const
763 // returns collection of TObjString which represents the i-th set of aliases
764 // which used for data retrieval for particular detector (Compact style)
767 AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) fDetectorMap.GetValue(detector);
769 AliError(Form("There isn't configuration for detector: %s",
774 return aHolder->GetCompactDCSAliases(iServ);
777 //______________________________________________________________________________________________
778 const TObjArray* AliShuttleConfig::GetCompactDCSDataPoints(const char* detector, Int_t iServ) const
781 // returns collection of TObjString which represents the set of aliases
782 // which used for data retrieval for particular detector (Compact style)
785 AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) fDetectorMap.GetValue(detector);
787 AliError(Form("There isn't configuration for detector: %s",
792 return aHolder->GetCompactDCSDataPoints(iServ);
795 //______________________________________________________________________________________________
796 const TObjArray* AliShuttleConfig::GetResponsibles(const char* detector) const
799 // returns collection of TObjString which represents the list of mail addresses
800 // of the detector's responsible(s)
803 AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) fDetectorMap.GetValue(detector);
805 AliError(Form("There isn't configuration for detector: %s",
810 return aHolder->GetResponsibles();
813 //______________________________________________________________________________________________
814 Bool_t AliShuttleConfig::HostProcessDetector(const char* detector) const
816 // return TRUE if detector is handled by host or if fProcessAll is TRUE
818 if(fProcessAll) return kTRUE;
819 TIter iter(&fProcessedDetectors);
821 while((detName = (TObjString*) iter.Next())){
822 if(detName->String() == detector) return kTRUE;
827 //______________________________________________________________________________________________
828 Bool_t AliShuttleConfig::StrictRunOrder(const char* detector) const
830 // return TRUE if detector wants strict run ordering of stored data
832 AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) fDetectorMap.GetValue(detector);
835 AliError(Form("There isn't configuration for detector: %s",
840 return aHolder->StrictRunOrder();
843 //______________________________________________________________________________________________
844 UInt_t AliShuttleConfig::SetGlobalConfig(TList* list)
846 // Set the global configuration (DAQ Logbook + preprocessor monitoring settings)
848 TLDAPEntry* anEntry = 0;
849 TLDAPAttribute* anAttribute = 0;
851 if (list->GetEntries() == 0)
853 AliError("Global configuration not found!");
856 else if (list->GetEntries() > 1)
858 AliError("More than one global configuration found!");
862 anEntry = dynamic_cast<TLDAPEntry*> (list->At(0));
866 AliError("Unexpected! Global list does not contain a TLDAPEntry");
871 anAttribute = anEntry->GetAttribute("daqLbHost");
873 AliError("Can't find daqLbHost attribute!");
876 fDAQlbHost = anAttribute->GetValue();
878 anAttribute = anEntry->GetAttribute("daqLbPort"); // MAY
881 fDAQlbPort = ((TString) anAttribute->GetValue()).Atoi();
883 fDAQlbPort = 3306; // mysql
886 anAttribute = anEntry->GetAttribute("daqLbUser");
888 AliError("Can't find daqLbUser attribute!");
891 fDAQlbUser = anAttribute->GetValue();
893 anAttribute = anEntry->GetAttribute("daqLbPasswd");
895 AliError("Can't find daqLbPasswd attribute!");
898 fDAQlbPass = anAttribute->GetValue();
900 anAttribute = anEntry->GetAttribute("daqLbDB");
902 AliError("Can't find daqLbDB attribute!");
905 fDAQlbDB = anAttribute->GetValue();
907 anAttribute = anEntry->GetAttribute("daqLbTable");
909 AliError("Can't find daqLbTable attribute!");
912 fDAQlbTable = anAttribute->GetValue();
914 anAttribute = anEntry->GetAttribute("shuttleLbTable");
916 AliError("Can't find shuttleLbTable attribute!");
919 fShuttlelbTable = anAttribute->GetValue();
921 anAttribute = anEntry->GetAttribute("runTypeLbTable");
923 AliError("Can't find runTypeLbTable attribute!");
926 fRunTypelbTable = anAttribute->GetValue();
928 anAttribute = anEntry->GetAttribute("ppmaxRetries");
930 AliError("Can't find ppmaxRetries attribute!");
933 TString tmpStr = anAttribute->GetValue();
934 fMaxRetries = tmpStr.Atoi();
936 anAttribute = anEntry->GetAttribute("ppTimeOut");
938 AliError("Can't find ppTimeOut attribute!");
941 tmpStr = anAttribute->GetValue();
942 fPPTimeOut = tmpStr.Atoi();
944 anAttribute = anEntry->GetAttribute("ppMaxMem");
946 AliError("Can't find ppMaxMem attribute!");
949 tmpStr = anAttribute->GetValue();
950 fPPMaxMem = tmpStr.Atoi();
952 anAttribute = anEntry->GetAttribute("monitorHost");
954 AliError("Can't find monitorHost attribute!");
957 fMonitorHost = anAttribute->GetValue();
959 anAttribute = anEntry->GetAttribute("monitorTable");
961 AliError("Can't find monitorTable attribute!");
964 fMonitorTable = anAttribute->GetValue();
971 //______________________________________________________________________________________________
972 UInt_t AliShuttleConfig::SetSysConfig(TList* list)
974 // Set the online FXS configuration (DAQ + DCS + HLT)
976 TLDAPEntry* anEntry = 0;
977 TLDAPAttribute* anAttribute = 0;
979 if (list->GetEntries() != 3)
981 AliError(Form("Wrong number of online systems found: %d !", list->GetEntries()));
986 Int_t iSys=0, count = 0;
987 while ((anEntry = dynamic_cast<TLDAPEntry*> (iter.Next())))
989 anAttribute = anEntry->GetAttribute("system");
990 TString sysName = anAttribute->GetValue();
992 if (sysName == "DAQ")
997 else if (sysName == "DCS")
1002 else if (sysName == "HLT")
1008 anAttribute = anEntry->GetAttribute("dbHost");
1010 AliError(Form ("Can't find dbHost attribute for %s!!",
1011 AliShuttleInterface::GetSystemName(iSys)));
1014 fFXSdbHost[iSys] = anAttribute->GetValue();
1016 anAttribute = anEntry->GetAttribute("dbPort"); // MAY
1019 fFXSdbPort[iSys] = ((TString) anAttribute->GetValue()).Atoi();
1021 fFXSdbPort[iSys] = 3306; // mysql
1024 anAttribute = anEntry->GetAttribute("dbUser");
1026 AliError(Form ("Can't find dbUser attribute for %s!!",
1027 AliShuttleInterface::GetSystemName(iSys)));
1030 fFXSdbUser[iSys] = anAttribute->GetValue();
1032 anAttribute = anEntry->GetAttribute("dbPasswd");
1034 AliError(Form ("Can't find dbPasswd attribute for %s!!",
1035 AliShuttleInterface::GetSystemName(iSys)));
1038 fFXSdbPass[iSys] = anAttribute->GetValue();
1040 anAttribute = anEntry->GetAttribute("dbName");
1042 AliError(Form ("Can't find dbName attribute for %s!!",
1043 AliShuttleInterface::GetSystemName(iSys)));
1047 fFXSdbName[iSys] = anAttribute->GetValue();
1048 anAttribute = anEntry->GetAttribute("dbTable");
1050 AliError(Form ("Can't find dbTable attribute for %s!!",
1051 AliShuttleInterface::GetSystemName(iSys)));
1054 fFXSdbTable[iSys] = anAttribute->GetValue();
1056 anAttribute = anEntry->GetAttribute("fxsHost");
1058 AliError(Form ("Can't find fxsHost attribute for %s!!",
1059 AliShuttleInterface::GetSystemName(iSys)));
1062 fFXSHost[iSys] = anAttribute->GetValue();
1064 anAttribute = anEntry->GetAttribute("fxsPort"); // MAY
1067 fFXSPort[iSys] = ((TString) anAttribute->GetValue()).Atoi();
1069 fFXSPort[iSys] = 22; // scp port number
1072 anAttribute = anEntry->GetAttribute("fxsUser");
1074 AliError(Form ("Can't find fxsUser attribute for %s!!",
1075 AliShuttleInterface::GetSystemName(iSys)));
1078 fFXSUser[iSys] = anAttribute->GetValue();
1080 anAttribute = anEntry->GetAttribute("fxsPasswd");
1081 if (anAttribute) fFXSPass[iSys] = anAttribute->GetValue();
1085 AliError(Form("Wrong system configuration! (code = %d)", count));
1092 //______________________________________________________________________________________________
1093 UInt_t AliShuttleConfig::SetDetConfig(TList* detList, TList* dcsList)
1095 // Set the detector configuration (general settings + DCS amanda server and alias/DP lists)
1097 TLDAPEntry* anEntry = 0;
1099 TIter iter(detList);
1100 while ((anEntry = dynamic_cast<TLDAPEntry*> (iter.Next())))
1103 AliShuttleDetConfigHolder* detHolder = new AliShuttleDetConfigHolder(anEntry);
1105 if (!detHolder->IsValid()) {
1106 AliError("Detector configuration error!");
1111 TObjString* detStr = new TObjString(detHolder->GetDetector());
1113 // Look for DCS Configuration
1114 TIter dcsIter(dcsList);
1115 TLDAPEntry *dcsEntry = 0;
1116 while ((dcsEntry = dynamic_cast<TLDAPEntry*> (dcsIter.Next())))
1118 TString dn = dcsEntry->GetDn();
1119 if(dn.Contains(detStr->GetName())) {
1120 AliDebug(2, Form("Found DCS configuration: dn = %s",dn.Data()));
1121 AliShuttleDCSConfigHolder* dcsHolder = new AliShuttleDCSConfigHolder(dcsEntry);
1122 if (!dcsHolder->IsValid()) {
1123 AliError("DCS configuration error!");
1128 detHolder->AddDCSConfig(dcsHolder);
1133 fDetectorMap.Add(detStr, detHolder);
1134 fDetectorList.AddLast(detStr);
1140 //______________________________________________________________________________________________
1141 UInt_t AliShuttleConfig::SetHostConfig(TList* list)
1143 // Set the Shuttle machines configuration (which detectors processes each machine)
1145 TLDAPEntry* anEntry = 0;
1146 TLDAPAttribute* anAttribute = 0;
1148 fShuttleInstanceHost = gSystem->HostName();
1151 while ((anEntry = dynamic_cast<TLDAPEntry*> (iter.Next())))
1154 TString dn(anEntry->GetDn());
1155 if (!dn.Contains(Form("shuttleHost=%s", fShuttleInstanceHost.Data()))) continue;
1159 anAttribute = anEntry->GetAttribute("detectors");
1160 const char *detName;
1161 while((detName = anAttribute->GetValue())){
1162 TObjString *objDet= new TObjString(detName);
1163 fProcessedDetectors.Add(objDet);
1172 //______________________________________________________________________________________________
1173 void AliShuttleConfig::Print(Option_t* option) const
1175 // print configuration
1176 // options : "": print configuration for all detectors, aliases and DPs in compacted format
1177 // "uncompact": print configuration for all detectors, aliases and DPs in uncompacted format
1178 // "DET": print configuration for DET, aliases and DPs in compacted format
1179 // "DET, uncompact": print configuration for DET, aliases and DPs in uncompacted format
1184 result += "####################################################\n";
1185 result += Form(" Shuttle configuration from %s \n", fConfigHost.Data());
1186 result += "####################################################\n";
1187 result += Form("\nShuttle running on %s \n", fShuttleInstanceHost.Data());
1190 result += Form("All detectors will be processed! \n");
1192 result += "Detectors processed by this host: ";
1193 TIter it(&fProcessedDetectors);
1195 while ((aDet = (TObjString*) it.Next())) {
1196 result += Form("%s ", aDet->String().Data());
1201 result += Form("PP time out = %d - max PP mem size = %d KB - max retries = %d\n\n",
1202 fPPTimeOut, fPPMaxMem, fMaxRetries);
1203 result += "------------------------------------------------------\n";
1205 result += Form("Logbook Configuration \n\n \tHost: %s:%d; \tUser: %s; ",
1206 fDAQlbHost.Data(), fDAQlbPort, fDAQlbUser.Data());
1208 // result += "Password: ";
1209 // result.Append('*', fDAQlbPass.Length());
1210 result += Form("\tDB: %s; \tTables: %s, %s, %s\n",
1211 fDAQlbDB.Data(), fDAQlbTable.Data(), fShuttlelbTable.Data(), fRunTypelbTable.Data());
1215 result += "------------------------------------------------------\n";
1216 result += "FXS configuration\n\n";
1218 for(int iSys=0;iSys<3;iSys++){
1219 result += Form("*** %s ***\n", AliShuttleInterface::GetSystemName(iSys));
1220 result += Form("\tDB host: %s:%d; \tUser: %s; \tName: %s; \tTable: %s\n",
1221 fFXSdbHost[iSys].Data(), fFXSdbPort[iSys], fFXSdbUser[iSys].Data(),
1222 fFXSdbName[iSys].Data(), fFXSdbTable[iSys].Data());
1223 // result += Form("DB Password:",fFXSdbPass[iSys].Data());
1224 result += Form("\tFXS host: %s:%d; \tUser: %s\n\n", fFXSHost[iSys].Data(), fFXSPort[iSys],
1225 fFXSUser[iSys].Data());
1226 // result += Form("FXS Password:",fFXSPass[iSys].Data());
1229 result += "------------------------------------------------------\n";
1230 result += "MonaLisa configuration\n\n";
1232 result += Form("\tHost: %s; \tTable name: %s",
1233 fMonitorHost.Data(), fMonitorTable.Data());
1237 TString optStr(option);
1239 result += "------------------------------------------------------\n";
1240 result += "Detector-specific configuration\n\n";
1242 TIter iter(fDetectorMap.GetTable());
1245 while ((aPair = (TPair*) iter.Next())) {
1246 AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) aPair->Value();
1247 if (optStr != "" && !optStr.Contains(aHolder->GetDetector()) &&
1248 optStr.CompareTo("uncompact",TString::kIgnoreCase) != 0 )
1251 result += Form("*** %s *** \n", aHolder->GetDetector());
1253 const TObjArray* responsibles = aHolder->GetResponsibles();
1254 if (responsibles->GetEntries() != 0)
1256 result += "\tDetector responsible(s): ";
1257 TIter it(responsibles);
1258 TObjString* aResponsible;
1259 while ((aResponsible = (TObjString*) it.Next()))
1261 result += Form("%s ", aResponsible->String().Data());
1266 result += Form("\tStrict run ordering: %s \n\n", aHolder->StrictRunOrder() ? "YES" : "NO");
1268 const TObjArray* dcsConfig = aHolder->GetDCSConfig();
1270 AliShuttleDCSConfigHolder* dcsHolder = 0;
1271 TIter dcsIter(dcsConfig);
1273 while ((dcsHolder = dynamic_cast<AliShuttleDCSConfigHolder*> (dcsIter.Next())))
1275 result += Form("\tAmanda server [%d]: %s:%d - MultiSplit = %d\n", count,
1276 dcsHolder->GetDCSHost(), dcsHolder->GetDCSPort(), dcsHolder->GetMultiSplit());
1278 const TObjArray* aliases = 0;
1279 if (optStr.Contains("uncompact",TString::kIgnoreCase))
1281 aliases = dcsHolder->GetDCSAliases();
1283 aliases = dcsHolder->GetCompactDCSAliases();
1286 if (aliases->GetEntries() != 0)
1288 result += Form("\tDCS Aliases [%d]: ", count);
1290 TObjString* anAlias;
1291 while ((anAlias = (TObjString*) it.Next()))
1293 result += Form("%s ", anAlias->String().Data());
1298 const TObjArray* dataPoints = 0;
1299 if (optStr.Contains("uncompact",TString::kIgnoreCase))
1301 dataPoints = dcsHolder->GetDCSDataPoints();
1303 dataPoints = dcsHolder->GetCompactDCSDataPoints();
1305 if (dataPoints->GetEntries() != 0)
1307 result += Form("\tDCS Data Points [%d]: ", count);
1308 TIter it(dataPoints);
1309 TObjString* aDataPoint;
1310 while ((aDataPoint = (TObjString*) it.Next())) {
1311 result += Form("%s ", aDataPoint->String().Data());
1319 if(!fIsValid) result += "\n\n********** !!!!! Configuration is INVALID !!!!! **********\n";