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.25 2007/11/26 16:58:37 acolla
19 Monalisa configuration added: host and table name
21 Revision 1.24 2007/10/24 10:44:08 acolla
25 Revision 1.23 2007/09/28 15:27:40 acolla
27 AliDCSClient "multiSplit" option added in the DCS configuration
28 in AliDCSMessage: variable MAX_BODY_SIZE set to 500000
30 Revision 1.22 2007/09/27 16:53:13 acolla
31 Detectors can have more than one AMANDA server. SHUTTLE queries the servers sequentially,
32 merges the dcs aliases/DPs in one TMap and sends it to the preprocessor.
34 Revision 1.21 2007/04/27 07:06:48 jgrosseo
35 GetFileSources returns empty list in case of no files, but successful query
36 No mails sent in testmode
38 Revision 1.20 2007/04/04 10:33:36 jgrosseo
39 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.
40 In case of an error with the Grid, the Shuttle will retry the storing later, the preprocessor does not need to be run again.
42 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.
44 3) New function StoreReferenceFile to _directly_ store a file (without opening it) to the reference storage.
46 4) The memory usage of the preprocessor is monitored. If it exceeds 2 GB it is terminated.
48 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.
49 If you always need DCS data (like before), you do not need to implement it.
51 6) The run type has been added to the monitoring page
53 Revision 1.19 2007/02/28 10:41:56 acolla
54 Run type field added in SHUTTLE framework. Run type is read from "run type" logbook and retrieved by
55 AliPreprocessor::GetRunType() function.
56 Added some ldap definition files.
58 Revision 1.18 2007/01/23 19:20:03 acolla
59 Removed old ldif files, added TOF, MCH ldif files. Added some options in
60 AliShuttleConfig::Print. Added in Ali Shuttle: SetShuttleTempDir and
63 Revision 1.17 2007/01/18 11:17:47 jgrosseo
64 changing spaces to tabs ;-)
66 Revision 1.16 2007/01/18 11:10:35 jgrosseo
67 adding the possibility of defining DCS alias and data points with patterns
68 first pattern introduced: [N..M] to add all names between the two digits, this works also recursively.
70 Revision 1.15 2007/01/15 18:27:11 acolla
71 implementation of sending mail to subdetector expert in case the preprocessor fails.
72 shuttle.schema updated with expert's email entry
74 Revision 1.13 2006/12/07 08:51:26 jgrosseo
76 table, db names in ldap configuration
77 added GRP preprocessor
78 DCS data can also be retrieved by data point
80 Revision 1.12 2006/11/16 16:16:48 jgrosseo
81 introducing strict run ordering flag
82 removed giving preprocessor name to preprocessor, they have to know their name themselves ;-)
84 Revision 1.11 2006/11/06 14:23:04 jgrosseo
85 major update (Alberto)
86 o) reading of run parameters from the logbook
87 o) online offline naming conversion
88 o) standalone DCSclient package
90 Revision 1.10 2006/10/20 15:22:59 jgrosseo
91 o) Adding time out to the execution of the preprocessors: The Shuttle forks and the parent process monitors the child
92 o) Merging Collect, CollectAll, CollectNew function
93 o) Removing implementation of empty copy constructors (declaration still there!)
95 Revision 1.9 2006/10/02 16:38:39 jgrosseo
98 storing of objects that failed to be stored to the grid before
99 interfacing of shuttle status table in daq system
101 Revision 1.8 2006/08/15 10:50:00 jgrosseo
102 effc++ corrections (alberto)
104 Revision 1.7 2006/07/20 09:54:40 jgrosseo
105 introducing status management: The processing per subdetector is divided into several steps,
106 after each step the status is stored on disk. If the system crashes in any of the steps the Shuttle
107 can keep track of the number of failures and skips further processing after a certain threshold is
108 exceeded. These thresholds can be configured in LDAP.
110 Revision 1.6 2006/07/19 10:09:55 jgrosseo
111 new configuration, accesst to DAQ FES (Alberto)
113 Revision 1.5 2006/07/10 13:01:41 jgrosseo
114 enhanced storing of last sucessfully processed run (alberto)
116 Revision 1.4 2006/06/12 09:11:16 jgrosseo
117 coding conventions (Alberto)
119 Revision 1.3 2006/06/06 14:26:40 jgrosseo
120 o) removed files that were moved to STEER
121 o) shuttle updated to follow the new interface (Alberto)
123 Revision 1.7 2006/05/12 09:07:16 colla
125 New configuration complete
127 Revision 1.2 2006/03/07 07:52:34 hristov
128 New version (B.Yordanov)
130 Revision 1.4 2005/11/19 14:20:31 byordano
131 logbook config added to AliShuttleConfig
133 Revision 1.3 2005/11/17 19:24:25 byordano
134 TList changed to TObjArray in AliShuttleConfig
136 Revision 1.2 2005/11/17 14:43:23 byordano
139 Revision 1.1.1.1 2005/10/28 07:33:58 hristov
140 Initial import as subdirectory in AliRoot
142 Revision 1.1.1.1 2005/09/12 22:11:40 byordano
145 Revision 1.3 2005/08/30 09:13:02 byordano
152 // This class keeps the AliShuttle configuration.
153 // It reads the configuration for LDAP server.
154 // For every child entry in basedn which has schema type 'shuttleConfig'
155 // it creates a detector configuration. This configuration includes:
156 // DCS server host and port and the set of aliases for which data from
157 // will be retrieved (used by AliShuttle).
161 #include "AliShuttleConfig.h"
162 #include "AliShuttleInterface.h"
167 #include <TObjString.h>
168 #include <TLDAPResult.h>
169 #include <TLDAPEntry.h>
170 #include <TLDAPAttribute.h>
173 AliShuttleConfig::AliShuttleDCSConfigHolder::AliShuttleDCSConfigHolder(const TLDAPEntry* entry):
180 fDCSDataPointsComp(0),
183 // constructor of the shuttle DCS configuration holder
185 TLDAPAttribute* anAttribute;
186 fDCSAliases = new TObjArray();
187 fDCSAliases->SetOwner(1);
188 fDCSDataPoints = new TObjArray();
189 fDCSDataPoints->SetOwner(1);
190 fDCSAliasesComp = new TObjArray();
191 fDCSAliasesComp->SetOwner(1);
192 fDCSDataPointsComp = new TObjArray();
193 fDCSDataPointsComp->SetOwner(1);
196 anAttribute = entry->GetAttribute("dcsHost");
199 AliError("Unexpected: no DCS host!");
203 fDCSHost = anAttribute->GetValue();
205 anAttribute = entry->GetAttribute("dcsPort");
208 AliError("Unexpected: no DCS port!");
211 TString portStr = anAttribute->GetValue();
212 fDCSPort = portStr.Atoi();
214 anAttribute = entry->GetAttribute("multiSplit"); // MAY
217 TString multiSplitStr = anAttribute->GetValue();
218 fMultiSplit = multiSplitStr.Atoi();
219 if(fMultiSplit == 0) {
220 AliError("MultiSplit must be a positive integer!");
226 anAttribute = entry->GetAttribute("dcsAlias"); // MAY
230 while ((anAlias = anAttribute->GetValue()))
232 fDCSAliasesComp->AddLast(new TObjString(anAlias));
233 ExpandAndAdd(fDCSAliases, anAlias);
237 anAttribute = entry->GetAttribute("dcsDP"); // MAY
240 const char* aDataPoint;
241 while ((aDataPoint = anAttribute->GetValue()))
243 fDCSDataPointsComp->AddLast(new TObjString(aDataPoint));
244 ExpandAndAdd(fDCSDataPoints, aDataPoint);
251 //______________________________________________________________________________________________
252 void AliShuttleConfig::AliShuttleDCSConfigHolder::ExpandAndAdd(TObjArray* target, const char* entry)
255 // adds <entry> to <target> applying expanding of the name
256 // [N..M] creates M-N+1 names with the corresponding digits
259 TString entryStr(entry);
261 Int_t begin = entryStr.Index("[");
262 Int_t end = entryStr.Index("]");
263 if (begin != -1 && end != -1 && end > begin)
265 TString before(entryStr(0, begin));
266 TString after(entryStr(end+1, entryStr.Length()));
268 AliDebug(2, Form("Found [] pattern. Splitted input string %s %s", before.Data(), after.Data()));
270 Int_t dotdot = entryStr.Index("..");
272 TString nStr(entryStr(begin+1, dotdot-begin-1));
273 TString mStr(entryStr(dotdot+2, end-dotdot-2));
275 AliDebug(2, Form("Found [N..M] pattern. %s %s", nStr.Data(), mStr.Data()));
277 if (nStr.IsDigit() && mStr.IsDigit())
279 Int_t n = nStr.Atoi();
280 Int_t m = mStr.Atoi();
282 Int_t nDigits = nStr.Length();
284 formatStr.Form("%%s%%0%dd%%s", nDigits);
286 AliDebug(2, Form("Format string is %s", formatStr.Data()));
288 for (Int_t current = n; current<=m; ++current)
291 newEntry.Form(formatStr.Data(), before.Data(), current, after.Data());
293 AliDebug(2, Form("Calling recursive with %s", newEntry.Data()));
296 ExpandAndAdd(target, newEntry);
299 // return here because we processed the entries already recursively.
304 AliDebug(2, Form("Adding name %s", entry));
305 target->AddLast(new TObjString(entry));
308 //______________________________________________________________________________________________
309 AliShuttleConfig::AliShuttleDCSConfigHolder::~AliShuttleDCSConfigHolder()
311 // destructor of the shuttle configuration holder
314 delete fDCSDataPoints;
315 delete fDCSAliasesComp;
316 delete fDCSDataPointsComp;
319 //______________________________________________________________________________________________
320 AliShuttleConfig::AliShuttleDetConfigHolder::AliShuttleDetConfigHolder(const TLDAPEntry* entry):
325 fSkipDCSQuery(kFALSE),
326 fStrictRunOrder(kFALSE)
328 // constructor of the shuttle configuration holder
330 TLDAPAttribute* anAttribute;
332 fResponsibles = new TObjArray();
333 fResponsibles->SetOwner(1);
334 fDCSConfig = new TObjArray();
335 fDCSConfig->SetOwner(1);
337 anAttribute = entry->GetAttribute("det"); // MUST
340 AliError(Form("No \"det\" attribute!"));
343 fDetector = anAttribute->GetValue();
345 anAttribute = entry->GetAttribute("strictRunOrder"); // MAY
348 AliWarning(Form("%s did not set strictRunOrder flag - the default is FALSE",
351 TString strictRunStr = anAttribute->GetValue();
352 if (!(strictRunStr == "0" || strictRunStr == "1"))
354 AliError("strictRunOrder flag must be 0 or 1!");
357 fStrictRunOrder = (Bool_t) strictRunStr.Atoi();
360 anAttribute = entry->GetAttribute("responsible"); // MAY
363 AliDebug(2, "Warning! No \"responsible\" attribute!");
367 const char* aResponsible;
368 while ((aResponsible = anAttribute->GetValue()))
370 fResponsibles->AddLast(new TObjString(aResponsible));
377 //______________________________________________________________________________________________
378 AliShuttleConfig::AliShuttleDetConfigHolder::~AliShuttleDetConfigHolder()
380 // destructor of the shuttle configuration holder
382 delete fResponsibles;
386 //______________________________________________________________________________________________
387 const char* AliShuttleConfig::AliShuttleDetConfigHolder::GetDCSHost(Int_t iServ) const
390 // returns DCS server host
393 if (iServ < 0 || iServ >= GetNServers()) return 0;
395 AliShuttleDCSConfigHolder *aHolder = dynamic_cast<AliShuttleDCSConfigHolder *>
396 (fDCSConfig->At(iServ));
398 return aHolder->GetDCSHost();
401 //______________________________________________________________________________________________
402 Int_t AliShuttleConfig::AliShuttleDetConfigHolder::GetDCSPort(Int_t iServ) const
405 // returns DCS server port
408 if (iServ < 0 || iServ >= GetNServers()) return 0;
410 AliShuttleDCSConfigHolder *aHolder = dynamic_cast<AliShuttleDCSConfigHolder *>
411 (fDCSConfig->At(iServ));
413 return aHolder->GetDCSPort();
416 //______________________________________________________________________________________________
417 Int_t AliShuttleConfig::AliShuttleDetConfigHolder::GetMultiSplit(Int_t iServ) const
420 // returns DCS "multi split" value
423 if (iServ < 0 || iServ >= GetNServers()) return 0;
425 AliShuttleDCSConfigHolder *aHolder = dynamic_cast<AliShuttleDCSConfigHolder *>
426 (fDCSConfig->At(iServ));
428 return aHolder->GetMultiSplit();
431 //______________________________________________________________________________________________
432 const TObjArray* AliShuttleConfig::AliShuttleDetConfigHolder::GetDCSAliases(Int_t iServ) const
435 // returns collection of TObjString which represents the set of aliases
436 // which used for data retrieval for particular detector
439 if (iServ < 0 || iServ >= GetNServers()) return 0;
441 AliShuttleDCSConfigHolder *aHolder = dynamic_cast<AliShuttleDCSConfigHolder *>
442 (fDCSConfig->At(iServ));
444 return aHolder->GetDCSAliases();
447 //______________________________________________________________________________________________
448 const TObjArray* AliShuttleConfig::AliShuttleDetConfigHolder::GetDCSDataPoints(Int_t iServ) const
451 // returns collection of TObjString which represents the set of aliases
452 // which used for data retrieval for particular detector
455 if (iServ < 0 || iServ >= GetNServers()) return 0;
457 AliShuttleDCSConfigHolder *aHolder = dynamic_cast<AliShuttleDCSConfigHolder *>
458 (fDCSConfig->At(iServ));
460 return aHolder->GetDCSDataPoints();
463 //______________________________________________________________________________________________
464 const TObjArray* AliShuttleConfig::AliShuttleDetConfigHolder::GetCompactDCSAliases(Int_t iServ) const
467 // returns collection of TObjString which represents the set of aliases
468 // which used for data retrieval for particular detector (Compact style)
471 if (iServ < 0 || iServ >= GetNServers()) return 0;
473 AliShuttleDCSConfigHolder *aHolder = dynamic_cast<AliShuttleDCSConfigHolder *>
474 (fDCSConfig->At(iServ));
476 return aHolder->GetCompactDCSAliases();
479 //______________________________________________________________________________________________
480 const TObjArray* AliShuttleConfig::AliShuttleDetConfigHolder::GetCompactDCSDataPoints(Int_t iServ) const
483 // returns collection of TObjString which represents the set of aliases
484 // which used for data retrieval for particular detector (Compact style)
487 if (iServ < 0 || iServ >= GetNServers()) return 0;
489 AliShuttleDCSConfigHolder *aHolder = dynamic_cast<AliShuttleDCSConfigHolder *>
490 (fDCSConfig->At(iServ));
492 return aHolder->GetCompactDCSDataPoints();
495 //______________________________________________________________________________________________
496 void AliShuttleConfig::AliShuttleDetConfigHolder::AddDCSConfig(AliShuttleDCSConfigHolder* holder)
499 // adds a DCS configuration set in the array of DCS configurations
503 fDCSConfig->AddLast(holder);
506 ClassImp(AliShuttleConfig)
508 //______________________________________________________________________________________________
509 AliShuttleConfig::AliShuttleConfig(const char* host, Int_t port,
510 const char* binddn, const char* password, const char* basedn):
529 fShuttleInstanceHost(""),
530 fProcessedDetectors(),
535 // host: ldap server host
536 // port: ldap server port
537 // binddn: binddn used for ldap binding (simple bind is used!).
538 // password: password for binddn
539 // basedn: this is basedn whose childeren entries which have
542 fDetectorMap.SetOwner(1);
543 fDetectorList.SetOwner(0); //fDetectorList and fDetectorMap share the same object!
544 fProcessedDetectors.SetOwner();
546 TLDAPServer aServer(host, port, binddn, password, 3);
548 if (!aServer.IsConnected()) {
549 AliError(Form("Can't connect to ldap server %s:%d",
554 // reads configuration for the shuttle running on this machine
556 TLDAPResult* aResult = 0;
557 TLDAPEntry* anEntry = 0;
564 globalList.SetOwner(1);
568 hostList.SetOwner(1);
570 aResult = aServer.Search(basedn, LDAP_SCOPE_SUBTREE, 0, 0);
574 AliError(Form("Can't find configuration with base DN: %s !", basedn));
578 while ((anEntry = aResult->GetNext()))
580 TString dn = anEntry->GetDn();
582 if (dn.BeginsWith("dcsHost="))
584 dcsList.Add(anEntry);
586 else if (dn.BeginsWith("det="))
588 detList.Add(anEntry);
590 else if (dn.BeginsWith("name=globalConfig"))
592 globalList.Add(anEntry);
594 else if (dn.BeginsWith("system="))
596 sysList.Add(anEntry);
598 else if (dn.BeginsWith("shuttleHost="))
600 hostList.Add(anEntry);
612 result += SetGlobalConfig(&globalList);
613 result += SetSysConfig(&sysList);
614 result += SetDetConfig(&detList,&dcsList);
615 result += SetHostConfig(&hostList);
619 AliError("Configuration is INVALID!");
627 //______________________________________________________________________________________________
628 AliShuttleConfig::~AliShuttleConfig()
632 fDetectorMap.DeleteAll();
633 fDetectorList.Clear();
634 fProcessedDetectors.Delete();
637 //______________________________________________________________________________________________
638 const TObjArray* AliShuttleConfig::GetDetectors() const
641 // returns collection of TObjString which contains the name
642 // of every detector which is in the configuration.
645 return &fDetectorList;
648 //______________________________________________________________________________________________
649 Bool_t AliShuttleConfig::HasDetector(const char* detector) const
652 // checks for paricular detector in the configuration.
654 return fDetectorMap.GetValue(detector) != NULL;
657 //______________________________________________________________________________________________
658 Int_t AliShuttleConfig::GetNServers(const char* detector) const
661 // returns number of DCS servers for detector
664 AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) fDetectorMap.GetValue(detector);
666 AliError(Form("There isn't configuration for detector: %s",
671 return aHolder->GetNServers();
675 //______________________________________________________________________________________________
676 const char* AliShuttleConfig::GetDCSHost(const char* detector, Int_t iServ) const
679 // returns i-th DCS server host used by particular detector
682 AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) fDetectorMap.GetValue(detector);
684 AliError(Form("There isn't configuration for detector: %s",
689 return aHolder->GetDCSHost(iServ);
692 //______________________________________________________________________________________________
693 Int_t AliShuttleConfig::GetDCSPort(const char* detector, Int_t iServ) const
696 // returns i-th DCS server port used by particular detector
700 AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) fDetectorMap.GetValue(detector);
702 AliError(Form("There isn't configuration for detector: %s",
707 return aHolder->GetDCSPort(iServ);
710 //______________________________________________________________________________________________
711 Int_t AliShuttleConfig::GetMultiSplit(const char* detector, Int_t iServ) const
714 // returns i-th DCS "multi split" value
718 AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) fDetectorMap.GetValue(detector);
720 AliError(Form("There isn't configuration for detector: %s",
725 return aHolder->GetMultiSplit(iServ);
728 //______________________________________________________________________________________________
729 const TObjArray* AliShuttleConfig::GetDCSAliases(const char* detector, Int_t iServ) const
732 // returns collection of TObjString which represents the i-th set of aliases
733 // which used for data retrieval for particular detector
736 AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) fDetectorMap.GetValue(detector);
738 AliError(Form("There isn't configuration for detector: %s",
743 return aHolder->GetDCSAliases(iServ);
746 //______________________________________________________________________________________________
747 const TObjArray* AliShuttleConfig::GetDCSDataPoints(const char* detector, Int_t iServ) const
750 // returns collection of TObjString which represents the set of aliases
751 // which used for data retrieval for particular detector
754 AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) fDetectorMap.GetValue(detector);
756 AliError(Form("There isn't configuration for detector: %s",
761 return aHolder->GetDCSDataPoints(iServ);
764 //______________________________________________________________________________________________
765 const TObjArray* AliShuttleConfig::GetCompactDCSAliases(const char* detector, Int_t iServ) const
768 // returns collection of TObjString which represents the i-th set of aliases
769 // which used for data retrieval for particular detector (Compact style)
772 AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) fDetectorMap.GetValue(detector);
774 AliError(Form("There isn't configuration for detector: %s",
779 return aHolder->GetCompactDCSAliases(iServ);
782 //______________________________________________________________________________________________
783 const TObjArray* AliShuttleConfig::GetCompactDCSDataPoints(const char* detector, Int_t iServ) const
786 // returns collection of TObjString which represents the set of aliases
787 // which used for data retrieval for particular detector (Compact style)
790 AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) fDetectorMap.GetValue(detector);
792 AliError(Form("There isn't configuration for detector: %s",
797 return aHolder->GetCompactDCSDataPoints(iServ);
800 //______________________________________________________________________________________________
801 const TObjArray* AliShuttleConfig::GetResponsibles(const char* detector) const
804 // returns collection of TObjString which represents the list of mail addresses
805 // of the detector's responsible(s)
808 AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) fDetectorMap.GetValue(detector);
810 AliError(Form("There isn't configuration for detector: %s",
815 return aHolder->GetResponsibles();
818 //______________________________________________________________________________________________
819 Bool_t AliShuttleConfig::HostProcessDetector(const char* detector) const
821 // return TRUE if detector is handled by host or if fProcessAll is TRUE
823 if(fProcessAll) return kTRUE;
824 TIter iter(&fProcessedDetectors);
826 while((detName = (TObjString*) iter.Next())){
827 if(detName->String() == detector) return kTRUE;
832 //______________________________________________________________________________________________
833 Bool_t AliShuttleConfig::StrictRunOrder(const char* detector) const
835 // return TRUE if detector wants strict run ordering of stored data
837 AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) fDetectorMap.GetValue(detector);
840 AliError(Form("There isn't configuration for detector: %s",
845 return aHolder->StrictRunOrder();
848 //______________________________________________________________________________________________
849 UInt_t AliShuttleConfig::SetGlobalConfig(TList* list)
851 // Set the global configuration (DAQ Logbook + preprocessor monitoring settings)
853 TLDAPEntry* anEntry = 0;
854 TLDAPAttribute* anAttribute = 0;
856 if (list->GetEntries() == 0)
858 AliError("Global configuration not found!");
861 else if (list->GetEntries() > 1)
863 AliError("More than one global configuration found!");
867 anEntry = dynamic_cast<TLDAPEntry*> (list->At(0));
871 AliError("Unexpected! Global list does not contain a TLDAPEntry");
876 anAttribute = anEntry->GetAttribute("daqLbHost");
878 AliError("Can't find daqLbHost attribute!");
881 fDAQlbHost = anAttribute->GetValue();
883 anAttribute = anEntry->GetAttribute("daqLbPort"); // MAY
886 fDAQlbPort = ((TString) anAttribute->GetValue()).Atoi();
888 fDAQlbPort = 3306; // mysql
891 anAttribute = anEntry->GetAttribute("daqLbUser");
893 AliError("Can't find daqLbUser attribute!");
896 fDAQlbUser = anAttribute->GetValue();
898 anAttribute = anEntry->GetAttribute("daqLbPasswd");
900 AliError("Can't find daqLbPasswd attribute!");
903 fDAQlbPass = anAttribute->GetValue();
905 anAttribute = anEntry->GetAttribute("daqLbDB");
907 AliError("Can't find daqLbDB attribute!");
910 fDAQlbDB = anAttribute->GetValue();
912 anAttribute = anEntry->GetAttribute("daqLbTable");
914 AliError("Can't find daqLbTable attribute!");
917 fDAQlbTable = anAttribute->GetValue();
919 anAttribute = anEntry->GetAttribute("shuttleLbTable");
921 AliError("Can't find shuttleLbTable attribute!");
924 fShuttlelbTable = anAttribute->GetValue();
926 anAttribute = anEntry->GetAttribute("runTypeLbTable");
928 AliError("Can't find runTypeLbTable attribute!");
931 fRunTypelbTable = anAttribute->GetValue();
933 anAttribute = anEntry->GetAttribute("ppmaxRetries");
935 AliError("Can't find ppmaxRetries attribute!");
938 TString tmpStr = anAttribute->GetValue();
939 fMaxRetries = tmpStr.Atoi();
941 anAttribute = anEntry->GetAttribute("ppTimeOut");
943 AliError("Can't find ppTimeOut attribute!");
946 tmpStr = anAttribute->GetValue();
947 fPPTimeOut = tmpStr.Atoi();
949 anAttribute = anEntry->GetAttribute("ppMaxMem");
951 AliError("Can't find ppMaxMem attribute!");
954 tmpStr = anAttribute->GetValue();
955 fPPMaxMem = tmpStr.Atoi();
957 anAttribute = anEntry->GetAttribute("monitorHost");
959 AliError("Can't find monitorHost attribute!");
962 fMonitorHost = anAttribute->GetValue();
964 anAttribute = anEntry->GetAttribute("monitorTable");
966 AliError("Can't find monitorTable attribute!");
969 fMonitorTable = anAttribute->GetValue();
971 anAttribute = anEntry->GetAttribute("triggerWait"); // MAY
973 AliWarning(Form("triggerWait not set! default = ", fTriggerWait));
975 tmpStr = anAttribute->GetValue();
976 fTriggerWait = tmpStr.Atoi();
978 anAttribute = anEntry->GetAttribute("mode");
980 AliWarning("Run mode not set! Running in test mode.");
982 tmpStr = anAttribute->GetValue();
983 if (tmpStr == "test")
986 } else if (tmpStr == "prod") {
989 AliWarning(Form("Not a valid run mode: %s", tmpStr.Data()));
990 AliWarning("Valid run modes are \"test\" and \"prod\". Running in test mode.");
998 //______________________________________________________________________________________________
999 UInt_t AliShuttleConfig::SetSysConfig(TList* list)
1001 // Set the online FXS configuration (DAQ + DCS + HLT)
1003 TLDAPEntry* anEntry = 0;
1004 TLDAPAttribute* anAttribute = 0;
1006 if (list->GetEntries() != 3)
1008 AliError(Form("Wrong number of online systems found: %d !", list->GetEntries()));
1013 Int_t iSys=0, count = 0;
1014 while ((anEntry = dynamic_cast<TLDAPEntry*> (iter.Next())))
1016 anAttribute = anEntry->GetAttribute("system");
1017 TString sysName = anAttribute->GetValue();
1019 if (sysName == "DAQ")
1024 else if (sysName == "DCS")
1029 else if (sysName == "HLT")
1035 anAttribute = anEntry->GetAttribute("dbHost");
1037 AliError(Form ("Can't find dbHost attribute for %s!!",
1038 AliShuttleInterface::GetSystemName(iSys)));
1041 fFXSdbHost[iSys] = anAttribute->GetValue();
1043 anAttribute = anEntry->GetAttribute("dbPort"); // MAY
1046 fFXSdbPort[iSys] = ((TString) anAttribute->GetValue()).Atoi();
1048 fFXSdbPort[iSys] = 3306; // mysql
1051 anAttribute = anEntry->GetAttribute("dbUser");
1053 AliError(Form ("Can't find dbUser attribute for %s!!",
1054 AliShuttleInterface::GetSystemName(iSys)));
1057 fFXSdbUser[iSys] = anAttribute->GetValue();
1059 anAttribute = anEntry->GetAttribute("dbPasswd");
1061 AliError(Form ("Can't find dbPasswd attribute for %s!!",
1062 AliShuttleInterface::GetSystemName(iSys)));
1065 fFXSdbPass[iSys] = anAttribute->GetValue();
1067 anAttribute = anEntry->GetAttribute("dbName");
1069 AliError(Form ("Can't find dbName attribute for %s!!",
1070 AliShuttleInterface::GetSystemName(iSys)));
1074 fFXSdbName[iSys] = anAttribute->GetValue();
1075 anAttribute = anEntry->GetAttribute("dbTable");
1077 AliError(Form ("Can't find dbTable attribute for %s!!",
1078 AliShuttleInterface::GetSystemName(iSys)));
1081 fFXSdbTable[iSys] = anAttribute->GetValue();
1083 anAttribute = anEntry->GetAttribute("fxsHost");
1085 AliError(Form ("Can't find fxsHost attribute for %s!!",
1086 AliShuttleInterface::GetSystemName(iSys)));
1089 fFXSHost[iSys] = anAttribute->GetValue();
1091 anAttribute = anEntry->GetAttribute("fxsPort"); // MAY
1094 fFXSPort[iSys] = ((TString) anAttribute->GetValue()).Atoi();
1096 fFXSPort[iSys] = 22; // scp port number
1099 anAttribute = anEntry->GetAttribute("fxsUser");
1101 AliError(Form ("Can't find fxsUser attribute for %s!!",
1102 AliShuttleInterface::GetSystemName(iSys)));
1105 fFXSUser[iSys] = anAttribute->GetValue();
1107 anAttribute = anEntry->GetAttribute("fxsPasswd");
1108 if (anAttribute) fFXSPass[iSys] = anAttribute->GetValue();
1112 AliError(Form("Wrong system configuration! (code = %d)", count));
1119 //______________________________________________________________________________________________
1120 UInt_t AliShuttleConfig::SetDetConfig(TList* detList, TList* dcsList)
1122 // Set the detector configuration (general settings + DCS amanda server and alias/DP lists)
1124 TLDAPEntry* anEntry = 0;
1126 TIter iter(detList);
1127 while ((anEntry = dynamic_cast<TLDAPEntry*> (iter.Next())))
1130 AliShuttleDetConfigHolder* detHolder = new AliShuttleDetConfigHolder(anEntry);
1132 if (!detHolder->IsValid()) {
1133 AliError("Detector configuration error!");
1138 TObjString* detStr = new TObjString(detHolder->GetDetector());
1140 // Look for DCS Configuration
1141 TIter dcsIter(dcsList);
1142 TLDAPEntry *dcsEntry = 0;
1143 while ((dcsEntry = dynamic_cast<TLDAPEntry*> (dcsIter.Next())))
1145 TString dn = dcsEntry->GetDn();
1146 if(dn.Contains(detStr->GetName())) {
1147 AliDebug(2, Form("Found DCS configuration: dn = %s",dn.Data()));
1148 AliShuttleDCSConfigHolder* dcsHolder = new AliShuttleDCSConfigHolder(dcsEntry);
1149 if (!dcsHolder->IsValid()) {
1150 AliError("DCS configuration error!");
1155 detHolder->AddDCSConfig(dcsHolder);
1160 fDetectorMap.Add(detStr, detHolder);
1161 fDetectorList.AddLast(detStr);
1167 //______________________________________________________________________________________________
1168 UInt_t AliShuttleConfig::SetHostConfig(TList* list)
1170 // Set the Shuttle machines configuration (which detectors processes each machine)
1172 TLDAPEntry* anEntry = 0;
1173 TLDAPAttribute* anAttribute = 0;
1175 fShuttleInstanceHost = gSystem->HostName();
1178 while ((anEntry = dynamic_cast<TLDAPEntry*> (iter.Next())))
1181 TString dn(anEntry->GetDn());
1182 if (!dn.Contains(Form("shuttleHost=%s", fShuttleInstanceHost.Data()))) continue;
1186 anAttribute = anEntry->GetAttribute("detectors");
1187 const char *detName;
1188 while((detName = anAttribute->GetValue())){
1189 TObjString *objDet= new TObjString(detName);
1190 fProcessedDetectors.Add(objDet);
1199 //______________________________________________________________________________________________
1200 void AliShuttleConfig::Print(Option_t* option) const
1202 // print configuration
1203 // options : "": print configuration for all detectors, aliases and DPs in compacted format
1204 // "uncompact": print configuration for all detectors, aliases and DPs in uncompacted format
1205 // "DET": print configuration for DET, aliases and DPs in compacted format
1206 // "DET, uncompact": print configuration for DET, aliases and DPs in uncompacted format
1211 TString mode = "test";
1212 if (fRunMode == kProd) mode = "production";
1214 result += "########################################################################\n";
1215 result += Form(" Shuttle configuration from %s - Run Mode: <%s> \n",
1216 fConfigHost.Data(), mode.Data());
1217 result += "########################################################################\n";
1218 result += Form("\nShuttle running on %s \n", fShuttleInstanceHost.Data());
1221 result += Form("All detectors will be processed! \n");
1223 result += "Detectors processed by this host: ";
1224 TIter it(&fProcessedDetectors);
1226 while ((aDet = (TObjString*) it.Next())) {
1227 result += Form("%s ", aDet->String().Data());
1232 result += Form("PP time out = %d - max PP mem size = %d KB - max retries = %d "
1233 "- DIM trigger waiting timeout = %d\n\n",
1234 fPPTimeOut, fPPMaxMem, fMaxRetries, fTriggerWait);
1235 result += "------------------------------------------------------\n";
1237 result += Form("Logbook Configuration \n\n \tHost: %s:%d; \tUser: %s; ",
1238 fDAQlbHost.Data(), fDAQlbPort, fDAQlbUser.Data());
1240 // result += "Password: ";
1241 // result.Append('*', fDAQlbPass.Length());
1242 result += Form("\tDB: %s; \tTables: %s, %s, %s\n",
1243 fDAQlbDB.Data(), fDAQlbTable.Data(), fShuttlelbTable.Data(), fRunTypelbTable.Data());
1247 result += "------------------------------------------------------\n";
1248 result += "FXS configuration\n\n";
1250 for(int iSys=0;iSys<3;iSys++){
1251 result += Form("*** %s ***\n", AliShuttleInterface::GetSystemName(iSys));
1252 result += Form("\tDB host: %s:%d; \tUser: %s; \tName: %s; \tTable: %s\n",
1253 fFXSdbHost[iSys].Data(), fFXSdbPort[iSys], fFXSdbUser[iSys].Data(),
1254 fFXSdbName[iSys].Data(), fFXSdbTable[iSys].Data());
1255 // result += Form("DB Password:",fFXSdbPass[iSys].Data());
1256 result += Form("\tFXS host: %s:%d; \tUser: %s\n\n", fFXSHost[iSys].Data(), fFXSPort[iSys],
1257 fFXSUser[iSys].Data());
1258 // result += Form("FXS Password:",fFXSPass[iSys].Data());
1261 result += "------------------------------------------------------\n";
1262 result += "MonaLisa configuration\n\n";
1264 result += Form("\tHost: %s; \tTable name: %s",
1265 fMonitorHost.Data(), fMonitorTable.Data());
1269 TString optStr(option);
1271 result += "------------------------------------------------------\n";
1272 result += "Detector-specific configuration\n\n";
1274 TIter iter(fDetectorMap.GetTable());
1277 while ((aPair = (TPair*) iter.Next())) {
1278 AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) aPair->Value();
1279 if (optStr != "" && !optStr.Contains(aHolder->GetDetector()) &&
1280 optStr.CompareTo("uncompact",TString::kIgnoreCase) != 0 )
1283 result += Form("*** %s *** \n", aHolder->GetDetector());
1285 const TObjArray* responsibles = aHolder->GetResponsibles();
1286 if (responsibles->GetEntries() != 0)
1288 result += "\tDetector responsible(s): ";
1289 TIter it(responsibles);
1290 TObjString* aResponsible;
1291 while ((aResponsible = (TObjString*) it.Next()))
1293 result += Form("%s ", aResponsible->String().Data());
1298 result += Form("\tStrict run ordering: %s \n\n", aHolder->StrictRunOrder() ? "YES" : "NO");
1300 const TObjArray* dcsConfig = aHolder->GetDCSConfig();
1302 AliShuttleDCSConfigHolder* dcsHolder = 0;
1303 TIter dcsIter(dcsConfig);
1305 while ((dcsHolder = dynamic_cast<AliShuttleDCSConfigHolder*> (dcsIter.Next())))
1307 result += Form("\tAmanda server [%d]: %s:%d - MultiSplit = %d\n", count,
1308 dcsHolder->GetDCSHost(), dcsHolder->GetDCSPort(), dcsHolder->GetMultiSplit());
1310 const TObjArray* aliases = 0;
1311 if (optStr.Contains("uncompact",TString::kIgnoreCase))
1313 aliases = dcsHolder->GetDCSAliases();
1315 aliases = dcsHolder->GetCompactDCSAliases();
1318 if (aliases->GetEntries() != 0)
1320 result += Form("\tDCS Aliases [%d]: ", count);
1322 TObjString* anAlias;
1323 while ((anAlias = (TObjString*) it.Next()))
1325 result += Form("%s ", anAlias->String().Data());
1330 const TObjArray* dataPoints = 0;
1331 if (optStr.Contains("uncompact",TString::kIgnoreCase))
1333 dataPoints = dcsHolder->GetDCSDataPoints();
1335 dataPoints = dcsHolder->GetCompactDCSDataPoints();
1337 if (dataPoints->GetEntries() != 0)
1339 result += Form("\tDCS Data Points [%d]: ", count);
1340 TIter it(dataPoints);
1341 TObjString* aDataPoint;
1342 while ((aDataPoint = (TObjString*) it.Next())) {
1343 result += Form("%s ", aDataPoint->String().Data());
1351 if(!fIsValid) result += "\n\n********** !!!!! Configuration is INVALID !!!!! **********\n";