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.22 2007/09/27 16:53:13 acolla
19 Detectors can have more than one AMANDA server. SHUTTLE queries the servers sequentially,
20 merges the dcs aliases/DPs in one TMap and sends it to the preprocessor.
22 Revision 1.21 2007/04/27 07:06:48 jgrosseo
23 GetFileSources returns empty list in case of no files, but successful query
24 No mails sent in testmode
26 Revision 1.20 2007/04/04 10:33:36 jgrosseo
27 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.
28 In case of an error with the Grid, the Shuttle will retry the storing later, the preprocessor does not need to be run again.
30 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.
32 3) New function StoreReferenceFile to _directly_ store a file (without opening it) to the reference storage.
34 4) The memory usage of the preprocessor is monitored. If it exceeds 2 GB it is terminated.
36 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.
37 If you always need DCS data (like before), you do not need to implement it.
39 6) The run type has been added to the monitoring page
41 Revision 1.19 2007/02/28 10:41:56 acolla
42 Run type field added in SHUTTLE framework. Run type is read from "run type" logbook and retrieved by
43 AliPreprocessor::GetRunType() function.
44 Added some ldap definition files.
46 Revision 1.18 2007/01/23 19:20:03 acolla
47 Removed old ldif files, added TOF, MCH ldif files. Added some options in
48 AliShuttleConfig::Print. Added in Ali Shuttle: SetShuttleTempDir and
51 Revision 1.17 2007/01/18 11:17:47 jgrosseo
52 changing spaces to tabs ;-)
54 Revision 1.16 2007/01/18 11:10:35 jgrosseo
55 adding the possibility of defining DCS alias and data points with patterns
56 first pattern introduced: [N..M] to add all names between the two digits, this works also recursively.
58 Revision 1.15 2007/01/15 18:27:11 acolla
59 implementation of sending mail to subdetector expert in case the preprocessor fails.
60 shuttle.schema updated with expert's email entry
62 Revision 1.13 2006/12/07 08:51:26 jgrosseo
64 table, db names in ldap configuration
65 added GRP preprocessor
66 DCS data can also be retrieved by data point
68 Revision 1.12 2006/11/16 16:16:48 jgrosseo
69 introducing strict run ordering flag
70 removed giving preprocessor name to preprocessor, they have to know their name themselves ;-)
72 Revision 1.11 2006/11/06 14:23:04 jgrosseo
73 major update (Alberto)
74 o) reading of run parameters from the logbook
75 o) online offline naming conversion
76 o) standalone DCSclient package
78 Revision 1.10 2006/10/20 15:22:59 jgrosseo
79 o) Adding time out to the execution of the preprocessors: The Shuttle forks and the parent process monitors the child
80 o) Merging Collect, CollectAll, CollectNew function
81 o) Removing implementation of empty copy constructors (declaration still there!)
83 Revision 1.9 2006/10/02 16:38:39 jgrosseo
86 storing of objects that failed to be stored to the grid before
87 interfacing of shuttle status table in daq system
89 Revision 1.8 2006/08/15 10:50:00 jgrosseo
90 effc++ corrections (alberto)
92 Revision 1.7 2006/07/20 09:54:40 jgrosseo
93 introducing status management: The processing per subdetector is divided into several steps,
94 after each step the status is stored on disk. If the system crashes in any of the steps the Shuttle
95 can keep track of the number of failures and skips further processing after a certain threshold is
96 exceeded. These thresholds can be configured in LDAP.
98 Revision 1.6 2006/07/19 10:09:55 jgrosseo
99 new configuration, accesst to DAQ FES (Alberto)
101 Revision 1.5 2006/07/10 13:01:41 jgrosseo
102 enhanced storing of last sucessfully processed run (alberto)
104 Revision 1.4 2006/06/12 09:11:16 jgrosseo
105 coding conventions (Alberto)
107 Revision 1.3 2006/06/06 14:26:40 jgrosseo
108 o) removed files that were moved to STEER
109 o) shuttle updated to follow the new interface (Alberto)
111 Revision 1.7 2006/05/12 09:07:16 colla
113 New configuration complete
115 Revision 1.2 2006/03/07 07:52:34 hristov
116 New version (B.Yordanov)
118 Revision 1.4 2005/11/19 14:20:31 byordano
119 logbook config added to AliShuttleConfig
121 Revision 1.3 2005/11/17 19:24:25 byordano
122 TList changed to TObjArray in AliShuttleConfig
124 Revision 1.2 2005/11/17 14:43:23 byordano
127 Revision 1.1.1.1 2005/10/28 07:33:58 hristov
128 Initial import as subdirectory in AliRoot
130 Revision 1.1.1.1 2005/09/12 22:11:40 byordano
133 Revision 1.3 2005/08/30 09:13:02 byordano
140 // This class keeps the AliShuttle configuration.
141 // It reads the configuration for LDAP server.
142 // For every child entry in basedn which has schema type 'shuttleConfig'
143 // it creates a detector configuration. This configuration includes:
144 // DCS server host and port and the set of aliases for which data from
145 // will be retrieved (used by AliShuttle).
149 #include "AliShuttleConfig.h"
150 #include "AliShuttleInterface.h"
155 #include <TObjString.h>
156 #include <TLDAPResult.h>
157 #include <TLDAPEntry.h>
158 #include <TLDAPAttribute.h>
161 AliShuttleConfig::AliShuttleDCSConfigHolder::AliShuttleDCSConfigHolder(const TLDAPEntry* entry):
168 fDCSDataPointsComp(0),
171 // constructor of the shuttle DCS configuration holder
173 TLDAPAttribute* anAttribute;
174 fDCSAliases = new TObjArray();
175 fDCSAliases->SetOwner(1);
176 fDCSDataPoints = new TObjArray();
177 fDCSDataPoints->SetOwner(1);
178 fDCSAliasesComp = new TObjArray();
179 fDCSAliasesComp->SetOwner(1);
180 fDCSDataPointsComp = new TObjArray();
181 fDCSDataPointsComp->SetOwner(1);
184 anAttribute = entry->GetAttribute("dcsHost");
187 AliError("Unexpected: no DCS host!");
191 fDCSHost = anAttribute->GetValue();
193 anAttribute = entry->GetAttribute("dcsPort");
196 AliError("Unexpected: no DCS port!");
199 TString portStr = anAttribute->GetValue();
200 fDCSPort = portStr.Atoi();
202 anAttribute = entry->GetAttribute("multiSplit"); // MAY
205 TString multiSplitStr = anAttribute->GetValue();
206 fMultiSplit = multiSplitStr.Atoi();
207 if(fMultiSplit == 0) {
208 AliError("MultiSplit must be a positive integer!");
214 anAttribute = entry->GetAttribute("dcsAlias"); // MAY
218 while ((anAlias = anAttribute->GetValue()))
220 fDCSAliasesComp->AddLast(new TObjString(anAlias));
221 ExpandAndAdd(fDCSAliases, anAlias);
225 anAttribute = entry->GetAttribute("dcsDP"); // MAY
228 const char* aDataPoint;
229 while ((aDataPoint = anAttribute->GetValue()))
231 fDCSDataPointsComp->AddLast(new TObjString(aDataPoint));
232 ExpandAndAdd(fDCSDataPoints, aDataPoint);
239 //______________________________________________________________________________________________
240 void AliShuttleConfig::AliShuttleDCSConfigHolder::ExpandAndAdd(TObjArray* target, const char* entry)
243 // adds <entry> to <target> applying expanding of the name
244 // [N..M] creates M-N+1 names with the corresponding digits
247 TString entryStr(entry);
249 Int_t begin = entryStr.Index("[");
250 Int_t end = entryStr.Index("]");
251 if (begin != -1 && end != -1 && end > begin)
253 TString before(entryStr(0, begin));
254 TString after(entryStr(end+1, entryStr.Length()));
256 AliDebug(2, Form("Found [] pattern. Splitted input string %s %s", before.Data(), after.Data()));
258 Int_t dotdot = entryStr.Index("..");
260 TString nStr(entryStr(begin+1, dotdot-begin-1));
261 TString mStr(entryStr(dotdot+2, end-dotdot-2));
263 AliDebug(2, Form("Found [N..M] pattern. %s %s", nStr.Data(), mStr.Data()));
265 if (nStr.IsDigit() && mStr.IsDigit())
267 Int_t n = nStr.Atoi();
268 Int_t m = mStr.Atoi();
270 Int_t nDigits = nStr.Length();
272 formatStr.Form("%%s%%0%dd%%s", nDigits);
274 AliDebug(2, Form("Format string is %s", formatStr.Data()));
276 for (Int_t current = n; current<=m; ++current)
279 newEntry.Form(formatStr.Data(), before.Data(), current, after.Data());
281 AliDebug(2, Form("Calling recursive with %s", newEntry.Data()));
284 ExpandAndAdd(target, newEntry);
287 // return here because we processed the entries already recursively.
292 AliDebug(2, Form("Adding name %s", entry));
293 target->AddLast(new TObjString(entry));
296 //______________________________________________________________________________________________
297 AliShuttleConfig::AliShuttleDCSConfigHolder::~AliShuttleDCSConfigHolder()
299 // destructor of the shuttle configuration holder
302 delete fDCSDataPoints;
303 delete fDCSAliasesComp;
304 delete fDCSDataPointsComp;
307 //______________________________________________________________________________________________
308 AliShuttleConfig::AliShuttleDetConfigHolder::AliShuttleDetConfigHolder(const TLDAPEntry* entry):
313 fSkipDCSQuery(kFALSE),
314 fStrictRunOrder(kFALSE)
316 // constructor of the shuttle configuration holder
318 TLDAPAttribute* anAttribute;
320 fResponsibles = new TObjArray();
321 fResponsibles->SetOwner(1);
322 fDCSConfig = new TObjArray();
323 fDCSConfig->SetOwner(1);
325 anAttribute = entry->GetAttribute("det"); // MUST
328 AliError(Form("No \"det\" attribute!"));
331 fDetector = anAttribute->GetValue();
333 anAttribute = entry->GetAttribute("strictRunOrder"); // MAY
336 AliWarning(Form("%s did not set strictRunOrder flag - the default is FALSE",
339 TString strictRunStr = anAttribute->GetValue();
340 if (!(strictRunStr == "0" || strictRunStr == "1"))
342 AliError("strictRunOrder flag must be 0 or 1!");
345 fStrictRunOrder = (Bool_t) strictRunStr.Atoi();
348 anAttribute = entry->GetAttribute("responsible"); // MAY
351 AliDebug(2, "Warning! No \"responsible\" attribute!");
355 const char* aResponsible;
356 while ((aResponsible = anAttribute->GetValue()))
358 fResponsibles->AddLast(new TObjString(aResponsible));
365 //______________________________________________________________________________________________
366 AliShuttleConfig::AliShuttleDetConfigHolder::~AliShuttleDetConfigHolder()
368 // destructor of the shuttle configuration holder
370 delete fResponsibles;
374 //______________________________________________________________________________________________
375 const char* AliShuttleConfig::AliShuttleDetConfigHolder::GetDCSHost(Int_t iServ) const
378 // returns DCS server host
381 if (iServ < 0 || iServ >= GetNServers()) return 0;
383 AliShuttleDCSConfigHolder *aHolder = dynamic_cast<AliShuttleDCSConfigHolder *>
384 (fDCSConfig->At(iServ));
386 return aHolder->GetDCSHost();
389 //______________________________________________________________________________________________
390 Int_t AliShuttleConfig::AliShuttleDetConfigHolder::GetDCSPort(Int_t iServ) const
393 // returns DCS server port
396 if (iServ < 0 || iServ >= GetNServers()) return 0;
398 AliShuttleDCSConfigHolder *aHolder = dynamic_cast<AliShuttleDCSConfigHolder *>
399 (fDCSConfig->At(iServ));
401 return aHolder->GetDCSPort();
404 //______________________________________________________________________________________________
405 Int_t AliShuttleConfig::AliShuttleDetConfigHolder::GetMultiSplit(Int_t iServ) const
408 // returns DCS "multi split" value
411 if (iServ < 0 || iServ >= GetNServers()) return 0;
413 AliShuttleDCSConfigHolder *aHolder = dynamic_cast<AliShuttleDCSConfigHolder *>
414 (fDCSConfig->At(iServ));
416 return aHolder->GetMultiSplit();
419 //______________________________________________________________________________________________
420 const TObjArray* AliShuttleConfig::AliShuttleDetConfigHolder::GetDCSAliases(Int_t iServ) const
423 // returns collection of TObjString which represents the set of aliases
424 // which used for data retrieval for particular detector
427 if (iServ < 0 || iServ >= GetNServers()) return 0;
429 AliShuttleDCSConfigHolder *aHolder = dynamic_cast<AliShuttleDCSConfigHolder *>
430 (fDCSConfig->At(iServ));
432 return aHolder->GetDCSAliases();
435 //______________________________________________________________________________________________
436 const TObjArray* AliShuttleConfig::AliShuttleDetConfigHolder::GetDCSDataPoints(Int_t iServ) const
439 // returns collection of TObjString which represents the set of aliases
440 // which used for data retrieval for particular detector
443 if (iServ < 0 || iServ >= GetNServers()) return 0;
445 AliShuttleDCSConfigHolder *aHolder = dynamic_cast<AliShuttleDCSConfigHolder *>
446 (fDCSConfig->At(iServ));
448 return aHolder->GetDCSDataPoints();
451 //______________________________________________________________________________________________
452 const TObjArray* AliShuttleConfig::AliShuttleDetConfigHolder::GetCompactDCSAliases(Int_t iServ) const
455 // returns collection of TObjString which represents the set of aliases
456 // which used for data retrieval for particular detector (Compact style)
459 if (iServ < 0 || iServ >= GetNServers()) return 0;
461 AliShuttleDCSConfigHolder *aHolder = dynamic_cast<AliShuttleDCSConfigHolder *>
462 (fDCSConfig->At(iServ));
464 return aHolder->GetCompactDCSAliases();
467 //______________________________________________________________________________________________
468 const TObjArray* AliShuttleConfig::AliShuttleDetConfigHolder::GetCompactDCSDataPoints(Int_t iServ) const
471 // returns collection of TObjString which represents the set of aliases
472 // which used for data retrieval for particular detector (Compact style)
475 if (iServ < 0 || iServ >= GetNServers()) return 0;
477 AliShuttleDCSConfigHolder *aHolder = dynamic_cast<AliShuttleDCSConfigHolder *>
478 (fDCSConfig->At(iServ));
480 return aHolder->GetCompactDCSDataPoints();
483 //______________________________________________________________________________________________
484 void AliShuttleConfig::AliShuttleDetConfigHolder::AddDCSConfig(AliShuttleDCSConfigHolder* holder)
487 // adds a DCS configuration set in the array of DCS configurations
491 fDCSConfig->AddLast(holder);
494 ClassImp(AliShuttleConfig)
496 //______________________________________________________________________________________________
497 AliShuttleConfig::AliShuttleConfig(const char* host, Int_t port,
498 const char* binddn, const char* password, const char* basedn):
513 fShuttleInstanceHost(""),
514 fProcessedDetectors(),
519 // host: ldap server host
520 // port: ldap server port
521 // binddn: binddn used for ldap binding (simple bind is used!).
522 // password: password for binddn
523 // basedn: this is basedn whose childeren entries which have
526 fDetectorMap.SetOwner(1);
527 fDetectorList.SetOwner(0); //fDetectorList and fDetectorMap share the same object!
528 fProcessedDetectors.SetOwner();
530 TLDAPServer aServer(host, port, binddn, password, 3);
532 if (!aServer.IsConnected()) {
533 AliError(Form("Can't connect to ldap server %s:%d",
538 // reads configuration for the shuttle running on this machine
540 TLDAPResult* aResult = 0;
541 TLDAPEntry* anEntry = 0;
548 globalList.SetOwner(1);
552 hostList.SetOwner(1);
554 aResult = aServer.Search(basedn, LDAP_SCOPE_SUBTREE, 0, 0);
558 AliError(Form("Can't find configuration with base DN: %s !", basedn));
562 while ((anEntry = aResult->GetNext()))
564 TString dn = anEntry->GetDn();
566 if (dn.BeginsWith("dcsHost="))
568 dcsList.Add(anEntry);
570 else if (dn.BeginsWith("det="))
572 detList.Add(anEntry);
574 else if (dn.BeginsWith("name=globalConfig"))
576 globalList.Add(anEntry);
578 else if (dn.BeginsWith("system="))
580 sysList.Add(anEntry);
582 else if (dn.BeginsWith("shuttleHost="))
584 hostList.Add(anEntry);
596 result += SetGlobalConfig(&globalList);
597 result += SetSysConfig(&sysList);
598 result += SetDetConfig(&detList,&dcsList);
599 result += SetHostConfig(&hostList);
603 AliError("Configuration is INVALID!");
611 //______________________________________________________________________________________________
612 AliShuttleConfig::~AliShuttleConfig()
616 fDetectorMap.DeleteAll();
617 fDetectorList.Clear();
618 fProcessedDetectors.Delete();
621 //______________________________________________________________________________________________
622 const TObjArray* AliShuttleConfig::GetDetectors() const
625 // returns collection of TObjString which contains the name
626 // of every detector which is in the configuration.
629 return &fDetectorList;
632 //______________________________________________________________________________________________
633 Bool_t AliShuttleConfig::HasDetector(const char* detector) const
636 // checks for paricular detector in the configuration.
638 return fDetectorMap.GetValue(detector) != NULL;
641 //______________________________________________________________________________________________
642 Int_t AliShuttleConfig::GetNServers(const char* detector) const
645 // returns number of DCS servers for detector
648 AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) fDetectorMap.GetValue(detector);
650 AliError(Form("There isn't configuration for detector: %s",
655 return aHolder->GetNServers();
659 //______________________________________________________________________________________________
660 const char* AliShuttleConfig::GetDCSHost(const char* detector, Int_t iServ) const
663 // returns i-th DCS server host used by particular detector
666 AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) fDetectorMap.GetValue(detector);
668 AliError(Form("There isn't configuration for detector: %s",
673 return aHolder->GetDCSHost(iServ);
676 //______________________________________________________________________________________________
677 Int_t AliShuttleConfig::GetDCSPort(const char* detector, Int_t iServ) const
680 // returns i-th DCS server port used by particular detector
684 AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) fDetectorMap.GetValue(detector);
686 AliError(Form("There isn't configuration for detector: %s",
691 return aHolder->GetDCSPort(iServ);
694 //______________________________________________________________________________________________
695 Int_t AliShuttleConfig::GetMultiSplit(const char* detector, Int_t iServ) const
698 // returns i-th DCS "multi split" value
702 AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) fDetectorMap.GetValue(detector);
704 AliError(Form("There isn't configuration for detector: %s",
709 return aHolder->GetMultiSplit(iServ);
712 //______________________________________________________________________________________________
713 const TObjArray* AliShuttleConfig::GetDCSAliases(const char* detector, Int_t iServ) const
716 // returns collection of TObjString which represents the i-th set of aliases
717 // which used for data retrieval for particular detector
720 AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) fDetectorMap.GetValue(detector);
722 AliError(Form("There isn't configuration for detector: %s",
727 return aHolder->GetDCSAliases(iServ);
730 //______________________________________________________________________________________________
731 const TObjArray* AliShuttleConfig::GetDCSDataPoints(const char* detector, Int_t iServ) const
734 // returns collection of TObjString which represents the set of aliases
735 // which used for data retrieval for particular detector
738 AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) fDetectorMap.GetValue(detector);
740 AliError(Form("There isn't configuration for detector: %s",
745 return aHolder->GetDCSDataPoints(iServ);
748 //______________________________________________________________________________________________
749 const TObjArray* AliShuttleConfig::GetCompactDCSAliases(const char* detector, Int_t iServ) const
752 // returns collection of TObjString which represents the i-th set of aliases
753 // which used for data retrieval for particular detector (Compact style)
756 AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) fDetectorMap.GetValue(detector);
758 AliError(Form("There isn't configuration for detector: %s",
763 return aHolder->GetCompactDCSAliases(iServ);
766 //______________________________________________________________________________________________
767 const TObjArray* AliShuttleConfig::GetCompactDCSDataPoints(const char* detector, Int_t iServ) const
770 // returns collection of TObjString which represents the set of aliases
771 // which used for data retrieval for particular detector (Compact style)
774 AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) fDetectorMap.GetValue(detector);
776 AliError(Form("There isn't configuration for detector: %s",
781 return aHolder->GetCompactDCSDataPoints(iServ);
784 //______________________________________________________________________________________________
785 const TObjArray* AliShuttleConfig::GetResponsibles(const char* detector) const
788 // returns collection of TObjString which represents the list of mail addresses
789 // of the detector's responsible(s)
792 AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) fDetectorMap.GetValue(detector);
794 AliError(Form("There isn't configuration for detector: %s",
799 return aHolder->GetResponsibles();
802 //______________________________________________________________________________________________
803 Bool_t AliShuttleConfig::HostProcessDetector(const char* detector) const
805 // return TRUE if detector is handled by host or if fProcessAll is TRUE
807 if(fProcessAll) return kTRUE;
808 TIter iter(&fProcessedDetectors);
810 while((detName = (TObjString*) iter.Next())){
811 if(detName->String() == detector) return kTRUE;
816 //______________________________________________________________________________________________
817 Bool_t AliShuttleConfig::StrictRunOrder(const char* detector) const
819 // return TRUE if detector wants strict run ordering of stored data
821 AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) fDetectorMap.GetValue(detector);
824 AliError(Form("There isn't configuration for detector: %s",
829 return aHolder->StrictRunOrder();
832 //______________________________________________________________________________________________
833 UInt_t AliShuttleConfig::SetGlobalConfig(TList* list)
835 // Set the global configuration (DAQ Logbook + preprocessor monitoring settings)
837 TLDAPEntry* anEntry = 0;
838 TLDAPAttribute* anAttribute = 0;
840 if (list->GetEntries() == 0)
842 AliError("Global configuration not found!");
845 else if (list->GetEntries() > 1)
847 AliError("More than one global configuration found!");
851 anEntry = dynamic_cast<TLDAPEntry*> (list->At(0));
855 AliError("Unexpected! Global list does not contain a TLDAPEntry");
860 anAttribute = anEntry->GetAttribute("daqLbHost");
862 AliError("Can't find daqLbHost attribute!");
865 fDAQlbHost = anAttribute->GetValue();
867 anAttribute = anEntry->GetAttribute("daqLbPort"); // MAY
870 fDAQlbPort = ((TString) anAttribute->GetValue()).Atoi();
872 fDAQlbPort = 3306; // mysql
875 anAttribute = anEntry->GetAttribute("daqLbUser");
877 AliError("Can't find daqLbUser attribute!");
880 fDAQlbUser = anAttribute->GetValue();
882 anAttribute = anEntry->GetAttribute("daqLbPasswd");
884 AliError("Can't find daqLbPasswd attribute!");
887 fDAQlbPass = anAttribute->GetValue();
889 anAttribute = anEntry->GetAttribute("daqLbDB");
891 AliError("Can't find daqLbDB attribute!");
894 fDAQlbDB = anAttribute->GetValue();
896 anAttribute = anEntry->GetAttribute("daqLbTable");
898 AliError("Can't find daqLbTable attribute!");
901 fDAQlbTable = anAttribute->GetValue();
903 anAttribute = anEntry->GetAttribute("shuttleLbTable");
905 AliError("Can't find shuttleLbTable attribute!");
908 fShuttlelbTable = anAttribute->GetValue();
910 anAttribute = anEntry->GetAttribute("runTypeLbTable");
912 AliError("Can't find runTypeLbTable attribute!");
915 fRunTypelbTable = anAttribute->GetValue();
917 anAttribute = anEntry->GetAttribute("ppmaxRetries");
919 AliError("Can't find ppmaxRetries attribute!");
922 TString tmpStr = anAttribute->GetValue();
923 fMaxRetries = tmpStr.Atoi();
925 anAttribute = anEntry->GetAttribute("ppTimeOut");
927 AliError("Can't find ppTimeOut attribute!");
930 tmpStr = anAttribute->GetValue();
931 fPPTimeOut = tmpStr.Atoi();
933 anAttribute = anEntry->GetAttribute("ppMaxMem");
935 AliError("Can't find ppMaxMem attribute!");
938 tmpStr = anAttribute->GetValue();
939 fPPMaxMem = tmpStr.Atoi();
946 //______________________________________________________________________________________________
947 UInt_t AliShuttleConfig::SetSysConfig(TList* list)
949 // Set the online FXS configuration (DAQ + DCS + HLT)
951 TLDAPEntry* anEntry = 0;
952 TLDAPAttribute* anAttribute = 0;
954 if (list->GetEntries() != 3)
956 AliError(Form("Wrong number of online systems found: %d !", list->GetEntries()));
961 Int_t iSys=0, count = 0;
962 while ((anEntry = dynamic_cast<TLDAPEntry*> (iter.Next())))
964 anAttribute = anEntry->GetAttribute("system");
965 TString sysName = anAttribute->GetValue();
967 if (sysName == "DAQ")
972 else if (sysName == "DCS")
977 else if (sysName == "HLT")
983 anAttribute = anEntry->GetAttribute("dbHost");
985 AliError(Form ("Can't find dbHost attribute for %s!!",
986 AliShuttleInterface::GetSystemName(iSys)));
989 fFXSdbHost[iSys] = anAttribute->GetValue();
991 anAttribute = anEntry->GetAttribute("dbPort"); // MAY
994 fFXSdbPort[iSys] = ((TString) anAttribute->GetValue()).Atoi();
996 fFXSdbPort[iSys] = 3306; // mysql
999 anAttribute = anEntry->GetAttribute("dbUser");
1001 AliError(Form ("Can't find dbUser attribute for %s!!",
1002 AliShuttleInterface::GetSystemName(iSys)));
1005 fFXSdbUser[iSys] = anAttribute->GetValue();
1007 anAttribute = anEntry->GetAttribute("dbPasswd");
1009 AliError(Form ("Can't find dbPasswd attribute for %s!!",
1010 AliShuttleInterface::GetSystemName(iSys)));
1013 fFXSdbPass[iSys] = anAttribute->GetValue();
1015 anAttribute = anEntry->GetAttribute("dbName");
1017 AliError(Form ("Can't find dbName attribute for %s!!",
1018 AliShuttleInterface::GetSystemName(iSys)));
1022 fFXSdbName[iSys] = anAttribute->GetValue();
1023 anAttribute = anEntry->GetAttribute("dbTable");
1025 AliError(Form ("Can't find dbTable attribute for %s!!",
1026 AliShuttleInterface::GetSystemName(iSys)));
1029 fFXSdbTable[iSys] = anAttribute->GetValue();
1031 anAttribute = anEntry->GetAttribute("fxsHost");
1033 AliError(Form ("Can't find fxsHost attribute for %s!!",
1034 AliShuttleInterface::GetSystemName(iSys)));
1037 fFXSHost[iSys] = anAttribute->GetValue();
1039 anAttribute = anEntry->GetAttribute("fxsPort"); // MAY
1042 fFXSPort[iSys] = ((TString) anAttribute->GetValue()).Atoi();
1044 fFXSPort[iSys] = 22; // scp port number
1047 anAttribute = anEntry->GetAttribute("fxsUser");
1049 AliError(Form ("Can't find fxsUser attribute for %s!!",
1050 AliShuttleInterface::GetSystemName(iSys)));
1053 fFXSUser[iSys] = anAttribute->GetValue();
1055 anAttribute = anEntry->GetAttribute("fxsPasswd");
1056 if (anAttribute) fFXSPass[iSys] = anAttribute->GetValue();
1060 AliError(Form("Wrong system configuration! (code = %d)", count));
1067 //______________________________________________________________________________________________
1068 UInt_t AliShuttleConfig::SetDetConfig(TList* detList, TList* dcsList)
1070 // Set the detector configuration (general settings + DCS amanda server and alias/DP lists)
1072 TLDAPEntry* anEntry = 0;
1074 TIter iter(detList);
1075 while ((anEntry = dynamic_cast<TLDAPEntry*> (iter.Next())))
1078 AliShuttleDetConfigHolder* detHolder = new AliShuttleDetConfigHolder(anEntry);
1080 if (!detHolder->IsValid()) {
1081 AliError("Detector configuration error!");
1086 TObjString* detStr = new TObjString(detHolder->GetDetector());
1088 // Look for DCS Configuration
1089 TIter dcsIter(dcsList);
1090 TLDAPEntry *dcsEntry = 0;
1091 while ((dcsEntry = dynamic_cast<TLDAPEntry*> (dcsIter.Next())))
1093 TString dn = dcsEntry->GetDn();
1094 if(dn.Contains(detStr->GetName())) {
1095 AliDebug(2, Form("Found DCS configuration: dn = %s",dn.Data()));
1096 AliShuttleDCSConfigHolder* dcsHolder = new AliShuttleDCSConfigHolder(dcsEntry);
1097 if (!dcsHolder->IsValid()) {
1098 AliError("DCS configuration error!");
1103 detHolder->AddDCSConfig(dcsHolder);
1108 fDetectorMap.Add(detStr, detHolder);
1109 fDetectorList.AddLast(detStr);
1115 //______________________________________________________________________________________________
1116 UInt_t AliShuttleConfig::SetHostConfig(TList* list)
1118 // Set the Shuttle machines configuration (which detectors processes each machine)
1120 TLDAPEntry* anEntry = 0;
1121 TLDAPAttribute* anAttribute = 0;
1123 fShuttleInstanceHost = gSystem->HostName();
1126 while ((anEntry = dynamic_cast<TLDAPEntry*> (iter.Next())))
1129 TString dn(anEntry->GetDn());
1130 if (!dn.Contains(Form("shuttleHost=%s", fShuttleInstanceHost.Data()))) continue;
1134 anAttribute = anEntry->GetAttribute("detectors");
1135 const char *detName;
1136 while((detName = anAttribute->GetValue())){
1137 TObjString *objDet= new TObjString(detName);
1138 fProcessedDetectors.Add(objDet);
1147 //______________________________________________________________________________________________
1148 void AliShuttleConfig::Print(Option_t* option) const
1150 // print configuration
1151 // options : "": print configuration for all detectors, aliases and DPs in compacted format
1152 // "uncompact": print configuration for all detectors, aliases and DPs in uncompacted format
1153 // "DET": print configuration for DET, aliases and DPs in compacted format
1154 // "DET, uncompact": print configuration for DET, aliases and DPs in uncompacted format
1159 result += "####################################################\n";
1160 result += Form(" Shuttle configuration from %s \n", fConfigHost.Data());
1161 result += "####################################################\n";
1162 result += Form("\nShuttle running on %s \n", fShuttleInstanceHost.Data());
1165 result += Form("All detectors will be processed! \n");
1167 result += "Detectors processed by this host: ";
1168 TIter it(&fProcessedDetectors);
1170 while ((aDet = (TObjString*) it.Next())) {
1171 result += Form("%s ", aDet->String().Data());
1176 result += Form("PP time out = %d - max PP mem size = %d KB - max retries = %d\n\n",
1177 fPPTimeOut, fPPMaxMem, fMaxRetries);
1178 result += "------------------------------------------------------\n";
1180 result += Form("Logbook Configuration \n\n \tHost: %s:%d; \tUser: %s; ",
1181 fDAQlbHost.Data(), fDAQlbPort, fDAQlbUser.Data());
1183 // result += "Password: ";
1184 // result.Append('*', fDAQlbPass.Length());
1185 result += Form("\tDB: %s; \tTables: %s, %s, %s",
1186 fDAQlbDB.Data(), fDAQlbTable.Data(), fShuttlelbTable.Data(), fRunTypelbTable.Data());
1190 result += "------------------------------------------------------\n";
1191 result += "FXS configuration\n\n";
1193 for(int iSys=0;iSys<3;iSys++){
1194 result += Form("*** %s ***\n", AliShuttleInterface::GetSystemName(iSys));
1195 result += Form("\tDB host: %s:%d; \tUser: %s; \tName: %s; \tTable: %s\n",
1196 fFXSdbHost[iSys].Data(), fFXSdbPort[iSys], fFXSdbUser[iSys].Data(),
1197 fFXSdbName[iSys].Data(), fFXSdbTable[iSys].Data());
1198 // result += Form("DB Password:",fFXSdbPass[iSys].Data());
1199 result += Form("\tFXS host: %s:%d; \tUser: %s\n\n", fFXSHost[iSys].Data(), fFXSPort[iSys],
1200 fFXSUser[iSys].Data());
1201 // result += Form("FXS Password:",fFXSPass[iSys].Data());
1204 TString optStr(option);
1206 result += "------------------------------------------------------\n";
1207 result += "Detector-specific configuration\n\n";
1209 TIter iter(fDetectorMap.GetTable());
1212 AliInfo(Form("Option = %s", option));
1214 while ((aPair = (TPair*) iter.Next())) {
1215 AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) aPair->Value();
1216 if (optStr != "" && !optStr.Contains(aHolder->GetDetector()) &&
1217 optStr.CompareTo("uncompact",TString::kIgnoreCase) != 0 )
1220 result += Form("*** %s *** \n", aHolder->GetDetector());
1222 const TObjArray* responsibles = aHolder->GetResponsibles();
1223 if (responsibles->GetEntries() != 0)
1225 result += "\tDetector responsible(s): ";
1226 TIter it(responsibles);
1227 TObjString* aResponsible;
1228 while ((aResponsible = (TObjString*) it.Next()))
1230 result += Form("%s ", aResponsible->String().Data());
1235 result += Form("\tStrict run ordering: %s \n\n", aHolder->StrictRunOrder() ? "YES" : "NO");
1237 const TObjArray* dcsConfig = aHolder->GetDCSConfig();
1239 AliShuttleDCSConfigHolder* dcsHolder = 0;
1240 TIter dcsIter(dcsConfig);
1242 while ((dcsHolder = dynamic_cast<AliShuttleDCSConfigHolder*> (dcsIter.Next())))
1244 result += Form("\tAmanda server [%d]: %s:%d - MultiSplit = %d\n", count,
1245 dcsHolder->GetDCSHost(), dcsHolder->GetDCSPort(), dcsHolder->GetMultiSplit());
1247 const TObjArray* aliases = 0;
1248 if (optStr.Contains("uncompact",TString::kIgnoreCase))
1250 aliases = dcsHolder->GetDCSAliases();
1252 aliases = dcsHolder->GetCompactDCSAliases();
1255 if (aliases->GetEntries() != 0)
1257 result += Form("\tDCS Aliases [%d]: ", count);
1259 TObjString* anAlias;
1260 while ((anAlias = (TObjString*) it.Next()))
1262 result += Form("%s ", anAlias->String().Data());
1267 const TObjArray* dataPoints = 0;
1268 if (optStr.Contains("uncompact",TString::kIgnoreCase))
1270 dataPoints = dcsHolder->GetDCSDataPoints();
1272 dataPoints = dcsHolder->GetCompactDCSDataPoints();
1274 if (dataPoints->GetEntries() != 0)
1276 result += Form("\tDCS Data Points [%d]: ", count);
1277 TIter it(dataPoints);
1278 TObjString* aDataPoint;
1279 while ((aDataPoint = (TObjString*) it.Next())) {
1280 result += Form("%s ", aDataPoint->String().Data());
1288 if(!fIsValid) result += "\n\n********** !!!!! Configuration is INVALID !!!!! **********\n";