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.26 2007/12/07 19:14:36 acolla
21 Added automatic collection of new runs on a regular time basis (settable from the configuration)
23 in AliShuttleConfig: new members
25 - triggerWait: time to wait for DIM trigger (s) before starting automatic collection of new runs
26 - mode: run mode (test, prod) -> used to build log folder (logs or logs_PROD)
30 - logs now stored in logs/#RUN/DET_#RUN.log
32 Revision 1.25 2007/11/26 16:58:37 acolla
33 Monalisa configuration added: host and table name
35 Revision 1.24 2007/10/24 10:44:08 acolla
39 Revision 1.23 2007/09/28 15:27:40 acolla
41 AliDCSClient "multiSplit" option added in the DCS configuration
42 in AliDCSMessage: variable MAX_BODY_SIZE set to 500000
44 Revision 1.22 2007/09/27 16:53:13 acolla
45 Detectors can have more than one AMANDA server. SHUTTLE queries the servers sequentially,
46 merges the dcs aliases/DPs in one TMap and sends it to the preprocessor.
48 Revision 1.21 2007/04/27 07:06:48 jgrosseo
49 GetFileSources returns empty list in case of no files, but successful query
50 No mails sent in testmode
52 Revision 1.20 2007/04/04 10:33:36 jgrosseo
53 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.
54 In case of an error with the Grid, the Shuttle will retry the storing later, the preprocessor does not need to be run again.
56 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.
58 3) New function StoreReferenceFile to _directly_ store a file (without opening it) to the reference storage.
60 4) The memory usage of the preprocessor is monitored. If it exceeds 2 GB it is terminated.
62 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.
63 If you always need DCS data (like before), you do not need to implement it.
65 6) The run type has been added to the monitoring page
67 Revision 1.19 2007/02/28 10:41:56 acolla
68 Run type field added in SHUTTLE framework. Run type is read from "run type" logbook and retrieved by
69 AliPreprocessor::GetRunType() function.
70 Added some ldap definition files.
72 Revision 1.18 2007/01/23 19:20:03 acolla
73 Removed old ldif files, added TOF, MCH ldif files. Added some options in
74 AliShuttleConfig::Print. Added in Ali Shuttle: SetShuttleTempDir and
77 Revision 1.17 2007/01/18 11:17:47 jgrosseo
78 changing spaces to tabs ;-)
80 Revision 1.16 2007/01/18 11:10:35 jgrosseo
81 adding the possibility of defining DCS alias and data points with patterns
82 first pattern introduced: [N..M] to add all names between the two digits, this works also recursively.
84 Revision 1.15 2007/01/15 18:27:11 acolla
85 implementation of sending mail to subdetector expert in case the preprocessor fails.
86 shuttle.schema updated with expert's email entry
88 Revision 1.13 2006/12/07 08:51:26 jgrosseo
90 table, db names in ldap configuration
91 added GRP preprocessor
92 DCS data can also be retrieved by data point
94 Revision 1.12 2006/11/16 16:16:48 jgrosseo
95 introducing strict run ordering flag
96 removed giving preprocessor name to preprocessor, they have to know their name themselves ;-)
98 Revision 1.11 2006/11/06 14:23:04 jgrosseo
99 major update (Alberto)
100 o) reading of run parameters from the logbook
101 o) online offline naming conversion
102 o) standalone DCSclient package
104 Revision 1.10 2006/10/20 15:22:59 jgrosseo
105 o) Adding time out to the execution of the preprocessors: The Shuttle forks and the parent process monitors the child
106 o) Merging Collect, CollectAll, CollectNew function
107 o) Removing implementation of empty copy constructors (declaration still there!)
109 Revision 1.9 2006/10/02 16:38:39 jgrosseo
112 storing of objects that failed to be stored to the grid before
113 interfacing of shuttle status table in daq system
115 Revision 1.8 2006/08/15 10:50:00 jgrosseo
116 effc++ corrections (alberto)
118 Revision 1.7 2006/07/20 09:54:40 jgrosseo
119 introducing status management: The processing per subdetector is divided into several steps,
120 after each step the status is stored on disk. If the system crashes in any of the steps the Shuttle
121 can keep track of the number of failures and skips further processing after a certain threshold is
122 exceeded. These thresholds can be configured in LDAP.
124 Revision 1.6 2006/07/19 10:09:55 jgrosseo
125 new configuration, accesst to DAQ FES (Alberto)
127 Revision 1.5 2006/07/10 13:01:41 jgrosseo
128 enhanced storing of last sucessfully processed run (alberto)
130 Revision 1.4 2006/06/12 09:11:16 jgrosseo
131 coding conventions (Alberto)
133 Revision 1.3 2006/06/06 14:26:40 jgrosseo
134 o) removed files that were moved to STEER
135 o) shuttle updated to follow the new interface (Alberto)
137 Revision 1.7 2006/05/12 09:07:16 colla
139 New configuration complete
141 Revision 1.2 2006/03/07 07:52:34 hristov
142 New version (B.Yordanov)
144 Revision 1.4 2005/11/19 14:20:31 byordano
145 logbook config added to AliShuttleConfig
147 Revision 1.3 2005/11/17 19:24:25 byordano
148 TList changed to TObjArray in AliShuttleConfig
150 Revision 1.2 2005/11/17 14:43:23 byordano
153 Revision 1.1.1.1 2005/10/28 07:33:58 hristov
154 Initial import as subdirectory in AliRoot
156 Revision 1.1.1.1 2005/09/12 22:11:40 byordano
159 Revision 1.3 2005/08/30 09:13:02 byordano
166 // This class keeps the AliShuttle configuration.
167 // It reads the configuration for LDAP server.
168 // For every child entry in basedn which has schema type 'shuttleConfig'
169 // it creates a detector configuration. This configuration includes:
170 // DCS server host and port and the set of aliases for which data from
171 // will be retrieved (used by AliShuttle).
175 #include "AliShuttleConfig.h"
176 #include "AliShuttleInterface.h"
181 #include <TObjString.h>
182 #include <TLDAPResult.h>
183 #include <TLDAPEntry.h>
184 #include <TLDAPAttribute.h>
187 AliShuttleConfig::AliShuttleDCSConfigHolder::AliShuttleDCSConfigHolder(const TLDAPEntry* entry):
194 fDCSDataPointsComp(0),
197 // constructor of the shuttle DCS configuration holder
199 TLDAPAttribute* anAttribute;
200 fDCSAliases = new TObjArray();
201 fDCSAliases->SetOwner(1);
202 fDCSDataPoints = new TObjArray();
203 fDCSDataPoints->SetOwner(1);
204 fDCSAliasesComp = new TObjArray();
205 fDCSAliasesComp->SetOwner(1);
206 fDCSDataPointsComp = new TObjArray();
207 fDCSDataPointsComp->SetOwner(1);
210 anAttribute = entry->GetAttribute("dcsHost");
213 AliError("Unexpected: no DCS host!");
217 fDCSHost = anAttribute->GetValue();
219 anAttribute = entry->GetAttribute("dcsPort");
222 AliError("Unexpected: no DCS port!");
225 TString portStr = anAttribute->GetValue();
226 fDCSPort = portStr.Atoi();
228 anAttribute = entry->GetAttribute("multiSplit"); // MAY
231 TString multiSplitStr = anAttribute->GetValue();
232 fMultiSplit = multiSplitStr.Atoi();
233 if(fMultiSplit == 0) {
234 AliError("MultiSplit must be a positive integer!");
240 anAttribute = entry->GetAttribute("dcsAlias"); // MAY
244 while ((anAlias = anAttribute->GetValue()))
246 fDCSAliasesComp->AddLast(new TObjString(anAlias));
247 ExpandAndAdd(fDCSAliases, anAlias);
251 anAttribute = entry->GetAttribute("dcsDP"); // MAY
254 const char* aDataPoint;
255 while ((aDataPoint = anAttribute->GetValue()))
257 fDCSDataPointsComp->AddLast(new TObjString(aDataPoint));
258 ExpandAndAdd(fDCSDataPoints, aDataPoint);
265 //______________________________________________________________________________________________
266 void AliShuttleConfig::AliShuttleDCSConfigHolder::ExpandAndAdd(TObjArray* target, const char* entry)
269 // adds <entry> to <target> applying expanding of the name
270 // [N..M] creates M-N+1 names with the corresponding digits
273 TString entryStr(entry);
275 Int_t begin = entryStr.Index("[");
276 Int_t end = entryStr.Index("]");
277 if (begin != -1 && end != -1 && end > begin)
279 TString before(entryStr(0, begin));
280 TString after(entryStr(end+1, entryStr.Length()));
282 AliDebug(2, Form("Found [] pattern. Splitted input string %s %s", before.Data(), after.Data()));
284 Int_t dotdot = entryStr.Index("..");
286 TString nStr(entryStr(begin+1, dotdot-begin-1));
287 TString mStr(entryStr(dotdot+2, end-dotdot-2));
289 AliDebug(2, Form("Found [N..M] pattern. %s %s", nStr.Data(), mStr.Data()));
291 if (nStr.IsDigit() && mStr.IsDigit())
293 Int_t n = nStr.Atoi();
294 Int_t m = mStr.Atoi();
296 Int_t nDigits = nStr.Length();
298 formatStr.Form("%%s%%0%dd%%s", nDigits);
300 AliDebug(2, Form("Format string is %s", formatStr.Data()));
302 for (Int_t current = n; current<=m; ++current)
305 newEntry.Form(formatStr.Data(), before.Data(), current, after.Data());
307 AliDebug(2, Form("Calling recursive with %s", newEntry.Data()));
310 ExpandAndAdd(target, newEntry);
313 // return here because we processed the entries already recursively.
318 AliDebug(2, Form("Adding name %s", entry));
319 target->AddLast(new TObjString(entry));
322 //______________________________________________________________________________________________
323 AliShuttleConfig::AliShuttleDCSConfigHolder::~AliShuttleDCSConfigHolder()
325 // destructor of the shuttle configuration holder
328 delete fDCSDataPoints;
329 delete fDCSAliasesComp;
330 delete fDCSDataPointsComp;
333 //______________________________________________________________________________________________
334 AliShuttleConfig::AliShuttleDetConfigHolder::AliShuttleDetConfigHolder(const TLDAPEntry* entry):
339 fSkipDCSQuery(kFALSE),
340 fStrictRunOrder(kFALSE)
342 // constructor of the shuttle configuration holder
344 TLDAPAttribute* anAttribute;
346 fResponsibles = new TObjArray();
347 fResponsibles->SetOwner(1);
348 fDCSConfig = new TObjArray();
349 fDCSConfig->SetOwner(1);
351 anAttribute = entry->GetAttribute("det"); // MUST
354 AliError(Form("No \"det\" attribute!"));
357 fDetector = anAttribute->GetValue();
359 anAttribute = entry->GetAttribute("strictRunOrder"); // MAY
362 AliWarning(Form("%s did not set strictRunOrder flag - the default is FALSE",
365 TString strictRunStr = anAttribute->GetValue();
366 if (!(strictRunStr == "0" || strictRunStr == "1"))
368 AliError("strictRunOrder flag must be 0 or 1!");
371 fStrictRunOrder = (Bool_t) strictRunStr.Atoi();
374 anAttribute = entry->GetAttribute("responsible"); // MAY
377 AliDebug(2, "Warning! No \"responsible\" attribute!");
381 const char* aResponsible;
382 while ((aResponsible = anAttribute->GetValue()))
384 fResponsibles->AddLast(new TObjString(aResponsible));
391 //______________________________________________________________________________________________
392 AliShuttleConfig::AliShuttleDetConfigHolder::~AliShuttleDetConfigHolder()
394 // destructor of the shuttle configuration holder
396 delete fResponsibles;
400 //______________________________________________________________________________________________
401 const char* AliShuttleConfig::AliShuttleDetConfigHolder::GetDCSHost(Int_t iServ) const
404 // returns DCS server host
407 if (iServ < 0 || iServ >= GetNServers()) return 0;
409 AliShuttleDCSConfigHolder *aHolder = dynamic_cast<AliShuttleDCSConfigHolder *>
410 (fDCSConfig->At(iServ));
412 return aHolder->GetDCSHost();
415 //______________________________________________________________________________________________
416 Int_t AliShuttleConfig::AliShuttleDetConfigHolder::GetDCSPort(Int_t iServ) const
419 // returns DCS server port
422 if (iServ < 0 || iServ >= GetNServers()) return 0;
424 AliShuttleDCSConfigHolder *aHolder = dynamic_cast<AliShuttleDCSConfigHolder *>
425 (fDCSConfig->At(iServ));
427 return aHolder->GetDCSPort();
430 //______________________________________________________________________________________________
431 Int_t AliShuttleConfig::AliShuttleDetConfigHolder::GetMultiSplit(Int_t iServ) const
434 // returns DCS "multi split" value
437 if (iServ < 0 || iServ >= GetNServers()) return 0;
439 AliShuttleDCSConfigHolder *aHolder = dynamic_cast<AliShuttleDCSConfigHolder *>
440 (fDCSConfig->At(iServ));
442 return aHolder->GetMultiSplit();
445 //______________________________________________________________________________________________
446 const TObjArray* AliShuttleConfig::AliShuttleDetConfigHolder::GetDCSAliases(Int_t iServ) const
449 // returns collection of TObjString which represents the set of aliases
450 // which used for data retrieval for particular detector
453 if (iServ < 0 || iServ >= GetNServers()) return 0;
455 AliShuttleDCSConfigHolder *aHolder = dynamic_cast<AliShuttleDCSConfigHolder *>
456 (fDCSConfig->At(iServ));
458 return aHolder->GetDCSAliases();
461 //______________________________________________________________________________________________
462 const TObjArray* AliShuttleConfig::AliShuttleDetConfigHolder::GetDCSDataPoints(Int_t iServ) const
465 // returns collection of TObjString which represents the set of aliases
466 // which used for data retrieval for particular detector
469 if (iServ < 0 || iServ >= GetNServers()) return 0;
471 AliShuttleDCSConfigHolder *aHolder = dynamic_cast<AliShuttleDCSConfigHolder *>
472 (fDCSConfig->At(iServ));
474 return aHolder->GetDCSDataPoints();
477 //______________________________________________________________________________________________
478 const TObjArray* AliShuttleConfig::AliShuttleDetConfigHolder::GetCompactDCSAliases(Int_t iServ) const
481 // returns collection of TObjString which represents the set of aliases
482 // which used for data retrieval for particular detector (Compact style)
485 if (iServ < 0 || iServ >= GetNServers()) return 0;
487 AliShuttleDCSConfigHolder *aHolder = dynamic_cast<AliShuttleDCSConfigHolder *>
488 (fDCSConfig->At(iServ));
490 return aHolder->GetCompactDCSAliases();
493 //______________________________________________________________________________________________
494 const TObjArray* AliShuttleConfig::AliShuttleDetConfigHolder::GetCompactDCSDataPoints(Int_t iServ) const
497 // returns collection of TObjString which represents the set of aliases
498 // which used for data retrieval for particular detector (Compact style)
501 if (iServ < 0 || iServ >= GetNServers()) return 0;
503 AliShuttleDCSConfigHolder *aHolder = dynamic_cast<AliShuttleDCSConfigHolder *>
504 (fDCSConfig->At(iServ));
506 return aHolder->GetCompactDCSDataPoints();
509 //______________________________________________________________________________________________
510 void AliShuttleConfig::AliShuttleDetConfigHolder::AddDCSConfig(AliShuttleDCSConfigHolder* holder)
513 // adds a DCS configuration set in the array of DCS configurations
517 fDCSConfig->AddLast(holder);
520 ClassImp(AliShuttleConfig)
522 //______________________________________________________________________________________________
523 AliShuttleConfig::AliShuttleConfig(const char* host, Int_t port,
524 const char* binddn, const char* password, const char* basedn):
543 fShuttleInstanceHost(""),
544 fProcessedDetectors(),
549 // host: ldap server host
550 // port: ldap server port
551 // binddn: binddn used for ldap binding (simple bind is used!).
552 // password: password for binddn
553 // basedn: this is basedn whose childeren entries which have
556 fDetectorMap.SetOwner(1);
557 fDetectorList.SetOwner(0); //fDetectorList and fDetectorMap share the same object!
558 fProcessedDetectors.SetOwner();
560 TLDAPServer aServer(host, port, binddn, password, 3);
562 if (!aServer.IsConnected()) {
563 AliError(Form("Can't connect to ldap server %s:%d",
568 // reads configuration for the shuttle running on this machine
570 TLDAPResult* aResult = 0;
571 TLDAPEntry* anEntry = 0;
578 globalList.SetOwner(1);
582 hostList.SetOwner(1);
584 aResult = aServer.Search(basedn, LDAP_SCOPE_SUBTREE, 0, 0);
588 AliError(Form("Can't find configuration with base DN: %s !", basedn));
592 while ((anEntry = aResult->GetNext()))
594 TString dn = anEntry->GetDn();
596 if (dn.BeginsWith("dcsHost="))
598 dcsList.Add(anEntry);
600 else if (dn.BeginsWith("det="))
602 detList.Add(anEntry);
604 else if (dn.BeginsWith("name=globalConfig"))
606 globalList.Add(anEntry);
608 else if (dn.BeginsWith("system="))
610 sysList.Add(anEntry);
612 else if (dn.BeginsWith("shuttleHost="))
614 hostList.Add(anEntry);
626 result += SetGlobalConfig(&globalList);
627 result += SetSysConfig(&sysList);
628 result += SetDetConfig(&detList,&dcsList);
629 result += SetHostConfig(&hostList);
633 AliError("Configuration is INVALID!");
641 //______________________________________________________________________________________________
642 AliShuttleConfig::~AliShuttleConfig()
646 fDetectorMap.DeleteAll();
647 fDetectorList.Clear();
648 fProcessedDetectors.Delete();
651 //______________________________________________________________________________________________
652 const TObjArray* AliShuttleConfig::GetDetectors() const
655 // returns collection of TObjString which contains the name
656 // of every detector which is in the configuration.
659 return &fDetectorList;
662 //______________________________________________________________________________________________
663 Bool_t AliShuttleConfig::HasDetector(const char* detector) const
666 // checks for paricular detector in the configuration.
668 return fDetectorMap.GetValue(detector) != NULL;
671 //______________________________________________________________________________________________
672 Int_t AliShuttleConfig::GetNServers(const char* detector) const
675 // returns number of DCS servers for detector
678 AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) fDetectorMap.GetValue(detector);
680 AliError(Form("There isn't configuration for detector: %s",
685 return aHolder->GetNServers();
689 //______________________________________________________________________________________________
690 const char* AliShuttleConfig::GetDCSHost(const char* detector, Int_t iServ) const
693 // returns i-th DCS server host used by particular detector
696 AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) fDetectorMap.GetValue(detector);
698 AliError(Form("There isn't configuration for detector: %s",
703 return aHolder->GetDCSHost(iServ);
706 //______________________________________________________________________________________________
707 Int_t AliShuttleConfig::GetDCSPort(const char* detector, Int_t iServ) const
710 // returns i-th DCS server port used by particular detector
714 AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) fDetectorMap.GetValue(detector);
716 AliError(Form("There isn't configuration for detector: %s",
721 return aHolder->GetDCSPort(iServ);
724 //______________________________________________________________________________________________
725 Int_t AliShuttleConfig::GetMultiSplit(const char* detector, Int_t iServ) const
728 // returns i-th DCS "multi split" value
732 AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) fDetectorMap.GetValue(detector);
734 AliError(Form("There isn't configuration for detector: %s",
739 return aHolder->GetMultiSplit(iServ);
742 //______________________________________________________________________________________________
743 const TObjArray* AliShuttleConfig::GetDCSAliases(const char* detector, Int_t iServ) const
746 // returns collection of TObjString which represents the i-th set of aliases
747 // which used for data retrieval for particular detector
750 AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) fDetectorMap.GetValue(detector);
752 AliError(Form("There isn't configuration for detector: %s",
757 return aHolder->GetDCSAliases(iServ);
760 //______________________________________________________________________________________________
761 const TObjArray* AliShuttleConfig::GetDCSDataPoints(const char* detector, Int_t iServ) const
764 // returns collection of TObjString which represents the set of aliases
765 // which used for data retrieval for particular detector
768 AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) fDetectorMap.GetValue(detector);
770 AliError(Form("There isn't configuration for detector: %s",
775 return aHolder->GetDCSDataPoints(iServ);
778 //______________________________________________________________________________________________
779 const TObjArray* AliShuttleConfig::GetCompactDCSAliases(const char* detector, Int_t iServ) const
782 // returns collection of TObjString which represents the i-th set of aliases
783 // which used for data retrieval for particular detector (Compact style)
786 AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) fDetectorMap.GetValue(detector);
788 AliError(Form("There isn't configuration for detector: %s",
793 return aHolder->GetCompactDCSAliases(iServ);
796 //______________________________________________________________________________________________
797 const TObjArray* AliShuttleConfig::GetCompactDCSDataPoints(const char* detector, Int_t iServ) const
800 // returns collection of TObjString which represents the set of aliases
801 // which used for data retrieval for particular detector (Compact style)
804 AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) fDetectorMap.GetValue(detector);
806 AliError(Form("There isn't configuration for detector: %s",
811 return aHolder->GetCompactDCSDataPoints(iServ);
814 //______________________________________________________________________________________________
815 const TObjArray* AliShuttleConfig::GetResponsibles(const char* detector) const
818 // returns collection of TObjString which represents the list of mail addresses
819 // of the detector's responsible(s)
822 AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) fDetectorMap.GetValue(detector);
824 AliError(Form("There isn't configuration for detector: %s",
829 return aHolder->GetResponsibles();
832 //______________________________________________________________________________________________
833 Bool_t AliShuttleConfig::HostProcessDetector(const char* detector) const
835 // return TRUE if detector is handled by host or if fProcessAll is TRUE
837 if(fProcessAll) return kTRUE;
838 TIter iter(&fProcessedDetectors);
840 while((detName = (TObjString*) iter.Next())){
841 if(detName->String() == detector) return kTRUE;
846 //______________________________________________________________________________________________
847 Bool_t AliShuttleConfig::StrictRunOrder(const char* detector) const
849 // return TRUE if detector wants strict run ordering of stored data
851 AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) fDetectorMap.GetValue(detector);
854 AliError(Form("There isn't configuration for detector: %s",
859 return aHolder->StrictRunOrder();
862 //______________________________________________________________________________________________
863 UInt_t AliShuttleConfig::SetGlobalConfig(TList* list)
865 // Set the global configuration (DAQ Logbook + preprocessor monitoring settings)
867 TLDAPEntry* anEntry = 0;
868 TLDAPAttribute* anAttribute = 0;
870 if (list->GetEntries() == 0)
872 AliError("Global configuration not found!");
875 else if (list->GetEntries() > 1)
877 AliError("More than one global configuration found!");
881 anEntry = dynamic_cast<TLDAPEntry*> (list->At(0));
885 AliError("Unexpected! Global list does not contain a TLDAPEntry");
890 anAttribute = anEntry->GetAttribute("daqLbHost");
892 AliError("Can't find daqLbHost attribute!");
895 fDAQlbHost = anAttribute->GetValue();
897 anAttribute = anEntry->GetAttribute("daqLbPort"); // MAY
900 fDAQlbPort = ((TString) anAttribute->GetValue()).Atoi();
902 fDAQlbPort = 3306; // mysql
905 anAttribute = anEntry->GetAttribute("daqLbUser");
907 AliError("Can't find daqLbUser attribute!");
910 fDAQlbUser = anAttribute->GetValue();
912 anAttribute = anEntry->GetAttribute("daqLbPasswd");
914 AliError("Can't find daqLbPasswd attribute!");
917 fDAQlbPass = anAttribute->GetValue();
919 anAttribute = anEntry->GetAttribute("daqLbDB");
921 AliError("Can't find daqLbDB attribute!");
924 fDAQlbDB = anAttribute->GetValue();
926 anAttribute = anEntry->GetAttribute("daqLbTable");
928 AliError("Can't find daqLbTable attribute!");
931 fDAQlbTable = anAttribute->GetValue();
933 anAttribute = anEntry->GetAttribute("shuttleLbTable");
935 AliError("Can't find shuttleLbTable attribute!");
938 fShuttlelbTable = anAttribute->GetValue();
940 anAttribute = anEntry->GetAttribute("runTypeLbTable");
942 AliError("Can't find runTypeLbTable attribute!");
945 fRunTypelbTable = anAttribute->GetValue();
947 anAttribute = anEntry->GetAttribute("ppmaxRetries");
949 AliError("Can't find ppmaxRetries attribute!");
952 TString tmpStr = anAttribute->GetValue();
953 fMaxRetries = tmpStr.Atoi();
955 anAttribute = anEntry->GetAttribute("ppTimeOut");
957 AliError("Can't find ppTimeOut attribute!");
960 tmpStr = anAttribute->GetValue();
961 fPPTimeOut = tmpStr.Atoi();
963 anAttribute = anEntry->GetAttribute("ppMaxMem");
965 AliError("Can't find ppMaxMem attribute!");
968 tmpStr = anAttribute->GetValue();
969 fPPMaxMem = tmpStr.Atoi();
971 anAttribute = anEntry->GetAttribute("monitorHost");
973 AliError("Can't find monitorHost attribute!");
976 fMonitorHost = anAttribute->GetValue();
978 anAttribute = anEntry->GetAttribute("monitorTable");
980 AliError("Can't find monitorTable attribute!");
983 fMonitorTable = anAttribute->GetValue();
985 anAttribute = anEntry->GetAttribute("triggerWait"); // MAY
987 AliWarning(Form("triggerWait not set! default = ", fTriggerWait));
989 tmpStr = anAttribute->GetValue();
990 fTriggerWait = tmpStr.Atoi();
992 anAttribute = anEntry->GetAttribute("mode");
994 AliWarning("Run mode not set! Running in test mode.");
996 tmpStr = anAttribute->GetValue();
997 if (tmpStr == "test")
1000 } else if (tmpStr == "prod") {
1003 AliWarning(Form("Not a valid run mode: %s", tmpStr.Data()));
1004 AliWarning("Valid run modes are \"test\" and \"prod\". Running in test mode.");
1011 //______________________________________________________________________________________________
1012 UInt_t AliShuttleConfig::SetSysConfig(TList* list)
1014 // Set the online FXS configuration (DAQ + DCS + HLT)
1016 TLDAPEntry* anEntry = 0;
1017 TLDAPAttribute* anAttribute = 0;
1019 if (list->GetEntries() != 3)
1021 AliError(Form("Wrong number of online systems found: %d !", list->GetEntries()));
1026 Int_t iSys=0, count = 0;
1027 while ((anEntry = dynamic_cast<TLDAPEntry*> (iter.Next())))
1029 anAttribute = anEntry->GetAttribute("system");
1030 TString sysName = anAttribute->GetValue();
1032 if (sysName == "DAQ")
1037 else if (sysName == "DCS")
1042 else if (sysName == "HLT")
1048 anAttribute = anEntry->GetAttribute("dbHost");
1050 AliError(Form ("Can't find dbHost attribute for %s!!",
1051 AliShuttleInterface::GetSystemName(iSys)));
1054 fFXSdbHost[iSys] = anAttribute->GetValue();
1056 anAttribute = anEntry->GetAttribute("dbPort"); // MAY
1059 fFXSdbPort[iSys] = ((TString) anAttribute->GetValue()).Atoi();
1061 fFXSdbPort[iSys] = 3306; // mysql
1064 anAttribute = anEntry->GetAttribute("dbUser");
1066 AliError(Form ("Can't find dbUser attribute for %s!!",
1067 AliShuttleInterface::GetSystemName(iSys)));
1070 fFXSdbUser[iSys] = anAttribute->GetValue();
1072 anAttribute = anEntry->GetAttribute("dbPasswd");
1074 AliError(Form ("Can't find dbPasswd attribute for %s!!",
1075 AliShuttleInterface::GetSystemName(iSys)));
1078 fFXSdbPass[iSys] = anAttribute->GetValue();
1080 anAttribute = anEntry->GetAttribute("dbName");
1082 AliError(Form ("Can't find dbName attribute for %s!!",
1083 AliShuttleInterface::GetSystemName(iSys)));
1087 fFXSdbName[iSys] = anAttribute->GetValue();
1088 anAttribute = anEntry->GetAttribute("dbTable");
1090 AliError(Form ("Can't find dbTable attribute for %s!!",
1091 AliShuttleInterface::GetSystemName(iSys)));
1094 fFXSdbTable[iSys] = anAttribute->GetValue();
1096 anAttribute = anEntry->GetAttribute("fxsHost");
1098 AliError(Form ("Can't find fxsHost attribute for %s!!",
1099 AliShuttleInterface::GetSystemName(iSys)));
1102 fFXSHost[iSys] = anAttribute->GetValue();
1104 anAttribute = anEntry->GetAttribute("fxsPort"); // MAY
1107 fFXSPort[iSys] = ((TString) anAttribute->GetValue()).Atoi();
1109 fFXSPort[iSys] = 22; // scp port number
1112 anAttribute = anEntry->GetAttribute("fxsUser");
1114 AliError(Form ("Can't find fxsUser attribute for %s!!",
1115 AliShuttleInterface::GetSystemName(iSys)));
1118 fFXSUser[iSys] = anAttribute->GetValue();
1120 anAttribute = anEntry->GetAttribute("fxsPasswd");
1121 if (anAttribute) fFXSPass[iSys] = anAttribute->GetValue();
1125 AliError(Form("Wrong system configuration! (code = %d)", count));
1132 //______________________________________________________________________________________________
1133 UInt_t AliShuttleConfig::SetDetConfig(TList* detList, TList* dcsList)
1135 // Set the detector configuration (general settings + DCS amanda server and alias/DP lists)
1137 TLDAPEntry* anEntry = 0;
1139 TIter iter(detList);
1140 while ((anEntry = dynamic_cast<TLDAPEntry*> (iter.Next())))
1143 AliShuttleDetConfigHolder* detHolder = new AliShuttleDetConfigHolder(anEntry);
1145 if (!detHolder->IsValid()) {
1146 AliError("Detector configuration error!");
1151 TObjString* detStr = new TObjString(detHolder->GetDetector());
1153 // Look for DCS Configuration
1154 TIter dcsIter(dcsList);
1155 TLDAPEntry *dcsEntry = 0;
1156 while ((dcsEntry = dynamic_cast<TLDAPEntry*> (dcsIter.Next())))
1158 TString dn = dcsEntry->GetDn();
1159 if(dn.Contains(detStr->GetName())) {
1160 AliDebug(2, Form("Found DCS configuration: dn = %s",dn.Data()));
1161 AliShuttleDCSConfigHolder* dcsHolder = new AliShuttleDCSConfigHolder(dcsEntry);
1162 if (!dcsHolder->IsValid()) {
1163 AliError("DCS configuration error!");
1168 detHolder->AddDCSConfig(dcsHolder);
1173 fDetectorMap.Add(detStr, detHolder);
1174 fDetectorList.AddLast(detStr);
1180 //______________________________________________________________________________________________
1181 UInt_t AliShuttleConfig::SetHostConfig(TList* list)
1183 // Set the Shuttle machines configuration (which detectors processes each machine)
1185 TLDAPEntry* anEntry = 0;
1186 TLDAPAttribute* anAttribute = 0;
1188 fShuttleInstanceHost = gSystem->HostName();
1191 while ((anEntry = dynamic_cast<TLDAPEntry*> (iter.Next())))
1194 TString dn(anEntry->GetDn());
1195 if (!dn.Contains(Form("shuttleHost=%s", fShuttleInstanceHost.Data()))) continue;
1199 anAttribute = anEntry->GetAttribute("detectors");
1200 const char *detName;
1201 while((detName = anAttribute->GetValue())){
1202 TObjString *objDet= new TObjString(detName);
1203 fProcessedDetectors.Add(objDet);
1212 //______________________________________________________________________________________________
1213 void AliShuttleConfig::Print(Option_t* option) const
1215 // print configuration
1216 // options : "": print configuration for all detectors, aliases and DPs in compacted format
1217 // "uncompact": print configuration for all detectors, aliases and DPs in uncompacted format
1218 // "DET": print configuration for DET, aliases and DPs in compacted format
1219 // "DET, uncompact": print configuration for DET, aliases and DPs in uncompacted format
1224 TString mode = "test";
1225 if (fRunMode == kProd) mode = "production";
1227 result += "########################################################################\n";
1228 result += Form(" Shuttle configuration from %s - Run Mode: <%s> \n",
1229 fConfigHost.Data(), mode.Data());
1230 result += "########################################################################\n";
1231 result += Form("\nShuttle running on %s \n", fShuttleInstanceHost.Data());
1234 result += Form("All detectors will be processed! \n");
1236 result += "Detectors processed by this host: ";
1237 TIter it(&fProcessedDetectors);
1239 while ((aDet = (TObjString*) it.Next())) {
1240 result += Form("%s ", aDet->String().Data());
1245 result += Form("PP time out = %d - max PP mem size = %d KB - max retries = %d "
1246 "- DIM trigger waiting timeout = %d\n\n",
1247 fPPTimeOut, fPPMaxMem, fMaxRetries, fTriggerWait);
1248 result += "------------------------------------------------------\n";
1250 result += Form("Logbook Configuration \n\n \tHost: %s:%d; \tUser: %s; ",
1251 fDAQlbHost.Data(), fDAQlbPort, fDAQlbUser.Data());
1253 // result += "Password: ";
1254 // result.Append('*', fDAQlbPass.Length());
1255 result += Form("\tDB: %s; \tTables: %s, %s, %s\n",
1256 fDAQlbDB.Data(), fDAQlbTable.Data(), fShuttlelbTable.Data(), fRunTypelbTable.Data());
1260 result += "------------------------------------------------------\n";
1261 result += "FXS configuration\n\n";
1263 for(int iSys=0;iSys<3;iSys++){
1264 result += Form("*** %s ***\n", AliShuttleInterface::GetSystemName(iSys));
1265 result += Form("\tDB host: %s:%d; \tUser: %s; \tName: %s; \tTable: %s\n",
1266 fFXSdbHost[iSys].Data(), fFXSdbPort[iSys], fFXSdbUser[iSys].Data(),
1267 fFXSdbName[iSys].Data(), fFXSdbTable[iSys].Data());
1268 // result += Form("DB Password:",fFXSdbPass[iSys].Data());
1269 result += Form("\tFXS host: %s:%d; \tUser: %s\n\n", fFXSHost[iSys].Data(), fFXSPort[iSys],
1270 fFXSUser[iSys].Data());
1271 // result += Form("FXS Password:",fFXSPass[iSys].Data());
1274 result += "------------------------------------------------------\n";
1275 result += "MonaLisa configuration\n\n";
1277 result += Form("\tHost: %s; \tTable name: %s",
1278 fMonitorHost.Data(), fMonitorTable.Data());
1282 TString optStr(option);
1284 result += "------------------------------------------------------\n";
1285 result += "Detector-specific configuration\n\n";
1287 TIter iter(fDetectorMap.GetTable());
1290 while ((aPair = (TPair*) iter.Next())) {
1291 AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) aPair->Value();
1292 if (optStr != "" && !optStr.Contains(aHolder->GetDetector()) &&
1293 optStr.CompareTo("uncompact",TString::kIgnoreCase) != 0 )
1296 result += Form("*** %s *** \n", aHolder->GetDetector());
1298 const TObjArray* responsibles = aHolder->GetResponsibles();
1299 if (responsibles->GetEntries() != 0)
1301 result += "\tDetector responsible(s): ";
1302 TIter it(responsibles);
1303 TObjString* aResponsible;
1304 while ((aResponsible = (TObjString*) it.Next()))
1306 result += Form("%s ", aResponsible->String().Data());
1311 result += Form("\tStrict run ordering: %s \n\n", aHolder->StrictRunOrder() ? "YES" : "NO");
1313 const TObjArray* dcsConfig = aHolder->GetDCSConfig();
1315 AliShuttleDCSConfigHolder* dcsHolder = 0;
1316 TIter dcsIter(dcsConfig);
1318 while ((dcsHolder = dynamic_cast<AliShuttleDCSConfigHolder*> (dcsIter.Next())))
1320 result += Form("\tAmanda server [%d]: %s:%d - MultiSplit = %d\n", count,
1321 dcsHolder->GetDCSHost(), dcsHolder->GetDCSPort(), dcsHolder->GetMultiSplit());
1323 const TObjArray* aliases = 0;
1324 if (optStr.Contains("uncompact",TString::kIgnoreCase))
1326 aliases = dcsHolder->GetDCSAliases();
1328 aliases = dcsHolder->GetCompactDCSAliases();
1331 if (aliases->GetEntries() != 0)
1333 result += Form("\tDCS Aliases [%d]: ", count);
1335 TObjString* anAlias;
1336 while ((anAlias = (TObjString*) it.Next()))
1338 result += Form("%s ", anAlias->String().Data());
1343 const TObjArray* dataPoints = 0;
1344 if (optStr.Contains("uncompact",TString::kIgnoreCase))
1346 dataPoints = dcsHolder->GetDCSDataPoints();
1348 dataPoints = dcsHolder->GetCompactDCSDataPoints();
1350 if (dataPoints->GetEntries() != 0)
1352 result += Form("\tDCS Data Points [%d]: ", count);
1353 TIter it(dataPoints);
1354 TObjString* aDataPoint;
1355 while ((aDataPoint = (TObjString*) it.Next())) {
1356 result += Form("%s ", aDataPoint->String().Data());
1364 if(!fIsValid) result += "\n\n********** !!!!! Configuration is INVALID !!!!! **********\n";