]> git.uio.no Git - u/mrichter/AliRoot.git/blame - SHUTTLE/AliShuttleConfig.cxx
Restart the fit from TPC backup parameters in case
[u/mrichter/AliRoot.git] / SHUTTLE / AliShuttleConfig.cxx
CommitLineData
73abe331 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
15
16/*
17$Log$
fb40ead4 18Revision 1.27 2007/12/17 03:23:32 jgrosseo
19several bugfixes
20added "empty preprocessor" as placeholder for Acorde in FDR
21
4508ab8b 22Revision 1.26 2007/12/07 19:14:36 acolla
23in AliShuttleTrigger:
24
25Added automatic collection of new runs on a regular time basis (settable from the configuration)
26
27in AliShuttleConfig: new members
28
29- triggerWait: time to wait for DIM trigger (s) before starting automatic collection of new runs
30- mode: run mode (test, prod) -> used to build log folder (logs or logs_PROD)
31
32in AliShuttle:
33
34- logs now stored in logs/#RUN/DET_#RUN.log
35
7d4cf768 36Revision 1.25 2007/11/26 16:58:37 acolla
37Monalisa configuration added: host and table name
38
b832ec02 39Revision 1.24 2007/10/24 10:44:08 acolla
40
41debug AliInfo removed
42
cb03e6c1 43Revision 1.23 2007/09/28 15:27:40 acolla
44
45AliDCSClient "multiSplit" option added in the DCS configuration
46in AliDCSMessage: variable MAX_BODY_SIZE set to 500000
47
542b6cc8 48Revision 1.22 2007/09/27 16:53:13 acolla
49Detectors can have more than one AMANDA server. SHUTTLE queries the servers sequentially,
50merges the dcs aliases/DPs in one TMap and sends it to the preprocessor.
51
1d172743 52Revision 1.21 2007/04/27 07:06:48 jgrosseo
53GetFileSources returns empty list in case of no files, but successful query
54No mails sent in testmode
55
86aa42c3 56Revision 1.20 2007/04/04 10:33:36 jgrosseo
571) 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.
58In case of an error with the Grid, the Shuttle will retry the storing later, the preprocessor does not need to be run again.
59
602) 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.
61
623) New function StoreReferenceFile to _directly_ store a file (without opening it) to the reference storage.
63
644) The memory usage of the preprocessor is monitored. If it exceeds 2 GB it is terminated.
65
665) 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.
67If you always need DCS data (like before), you do not need to implement it.
68
696) The run type has been added to the monitoring page
70
9827400b 71Revision 1.19 2007/02/28 10:41:56 acolla
72Run type field added in SHUTTLE framework. Run type is read from "run type" logbook and retrieved by
73AliPreprocessor::GetRunType() function.
74Added some ldap definition files.
75
441b0e9c 76Revision 1.18 2007/01/23 19:20:03 acolla
77Removed old ldif files, added TOF, MCH ldif files. Added some options in
78AliShuttleConfig::Print. Added in Ali Shuttle: SetShuttleTempDir and
79SetShuttleLogDir
80
36c99a6a 81Revision 1.17 2007/01/18 11:17:47 jgrosseo
82changing spaces to tabs ;-)
83
f59d2f8f 84Revision 1.16 2007/01/18 11:10:35 jgrosseo
85adding the possibility of defining DCS alias and data points with patterns
86first pattern introduced: [N..M] to add all names between the two digits, this works also recursively.
87
40150741 88Revision 1.15 2007/01/15 18:27:11 acolla
89implementation of sending mail to subdetector expert in case the preprocessor fails.
90shuttle.schema updated with expert's email entry
91
fc5a4708 92Revision 1.13 2006/12/07 08:51:26 jgrosseo
93update (alberto):
94table, db names in ldap configuration
95added GRP preprocessor
96DCS data can also be retrieved by data point
97
2c15234c 98Revision 1.12 2006/11/16 16:16:48 jgrosseo
99introducing strict run ordering flag
100removed giving preprocessor name to preprocessor, they have to know their name themselves ;-)
101
be48e3ea 102Revision 1.11 2006/11/06 14:23:04 jgrosseo
103major update (Alberto)
104o) reading of run parameters from the logbook
105o) online offline naming conversion
106o) standalone DCSclient package
107
eba76848 108Revision 1.10 2006/10/20 15:22:59 jgrosseo
109o) Adding time out to the execution of the preprocessors: The Shuttle forks and the parent process monitors the child
110o) Merging Collect, CollectAll, CollectNew function
111o) Removing implementation of empty copy constructors (declaration still there!)
112
cb343cfd 113Revision 1.9 2006/10/02 16:38:39 jgrosseo
114update (alberto):
115fixed memory leaks
116storing of objects that failed to be stored to the grid before
117interfacing of shuttle status table in daq system
118
2bb7b766 119Revision 1.8 2006/08/15 10:50:00 jgrosseo
120effc++ corrections (alberto)
121
4f0ab988 122Revision 1.7 2006/07/20 09:54:40 jgrosseo
123introducing status management: The processing per subdetector is divided into several steps,
124after each step the status is stored on disk. If the system crashes in any of the steps the Shuttle
125can keep track of the number of failures and skips further processing after a certain threshold is
126exceeded. These thresholds can be configured in LDAP.
127
5164a766 128Revision 1.6 2006/07/19 10:09:55 jgrosseo
129new configuration, accesst to DAQ FES (Alberto)
130
57f50b3c 131Revision 1.5 2006/07/10 13:01:41 jgrosseo
132enhanced storing of last sucessfully processed run (alberto)
133
a7160fe9 134Revision 1.4 2006/06/12 09:11:16 jgrosseo
135coding conventions (Alberto)
136
58bc3020 137Revision 1.3 2006/06/06 14:26:40 jgrosseo
138o) removed files that were moved to STEER
139o) shuttle updated to follow the new interface (Alberto)
140
b948db8d 141Revision 1.7 2006/05/12 09:07:16 colla
14212/05/06
143New configuration complete
144
145Revision 1.2 2006/03/07 07:52:34 hristov
146New version (B.Yordanov)
147
d477ad88 148Revision 1.4 2005/11/19 14:20:31 byordano
149logbook config added to AliShuttleConfig
150
151Revision 1.3 2005/11/17 19:24:25 byordano
152TList changed to TObjArray in AliShuttleConfig
153
154Revision 1.2 2005/11/17 14:43:23 byordano
155import to local CVS
156
157Revision 1.1.1.1 2005/10/28 07:33:58 hristov
158Initial import as subdirectory in AliRoot
159
73abe331 160Revision 1.1.1.1 2005/09/12 22:11:40 byordano
161SHUTTLE package
162
163Revision 1.3 2005/08/30 09:13:02 byordano
164some docs added
165
166*/
167
168
169//
170// This class keeps the AliShuttle configuration.
171// It reads the configuration for LDAP server.
172// For every child entry in basedn which has schema type 'shuttleConfig'
173// it creates a detector configuration. This configuration includes:
174// DCS server host and port and the set of aliases for which data from
175// will be retrieved (used by AliShuttle).
176//
177
6ea86315 178#include <Riostream.h>
73abe331 179#include "AliShuttleConfig.h"
57f50b3c 180#include "AliShuttleInterface.h"
73abe331 181
182#include "AliLog.h"
183
b948db8d 184#include <TSystem.h>
73abe331 185#include <TObjString.h>
186#include <TLDAPResult.h>
187#include <TLDAPEntry.h>
188#include <TLDAPAttribute.h>
a18e8fa6 189#include <TKey.h>
73abe331 190
57f50b3c 191
1d172743 192AliShuttleConfig::AliShuttleDCSConfigHolder::AliShuttleDCSConfigHolder(const TLDAPEntry* entry):
57f50b3c 193fDCSHost(""),
194fDCSPort(0),
542b6cc8 195fMultiSplit(100),
fc5a4708 196fDCSAliases(0),
197fDCSDataPoints(0),
36c99a6a 198fDCSAliasesComp(0),
199fDCSDataPointsComp(0),
1d172743 200fIsValid(kFALSE)
73abe331 201{
1d172743 202// constructor of the shuttle DCS configuration holder
58bc3020 203
73abe331 204 TLDAPAttribute* anAttribute;
2bb7b766 205 fDCSAliases = new TObjArray();
206 fDCSAliases->SetOwner(1);
2c15234c 207 fDCSDataPoints = new TObjArray();
208 fDCSDataPoints->SetOwner(1);
36c99a6a 209 fDCSAliasesComp = new TObjArray();
210 fDCSAliasesComp->SetOwner(1);
211 fDCSDataPointsComp = new TObjArray();
212 fDCSDataPointsComp->SetOwner(1);
73abe331 213
86aa42c3 214
1d172743 215 anAttribute = entry->GetAttribute("dcsHost");
2c15234c 216 if (!anAttribute)
217 {
1d172743 218 AliError("Unexpected: no DCS host!");
73abe331 219 return;
220 }
57f50b3c 221
b948db8d 222 fDCSHost = anAttribute->GetValue();
73abe331 223
1d172743 224 anAttribute = entry->GetAttribute("dcsPort");
2c15234c 225 if (!anAttribute)
226 {
1d172743 227 AliError("Unexpected: no DCS port!");
73abe331 228 return;
229 }
230 TString portStr = anAttribute->GetValue();
b948db8d 231 fDCSPort = portStr.Atoi();
73abe331 232
542b6cc8 233 anAttribute = entry->GetAttribute("multiSplit"); // MAY
234 if (anAttribute)
235 {
236 TString multiSplitStr = anAttribute->GetValue();
237 fMultiSplit = multiSplitStr.Atoi();
238 if(fMultiSplit == 0) {
239 AliError("MultiSplit must be a positive integer!");
240 return;
241 }
242
243 }
244
1d172743 245 anAttribute = entry->GetAttribute("dcsAlias"); // MAY
2c15234c 246 if (anAttribute)
247 {
248 const char* anAlias;
249 while ((anAlias = anAttribute->GetValue()))
250 {
36c99a6a 251 fDCSAliasesComp->AddLast(new TObjString(anAlias));
40150741 252 ExpandAndAdd(fDCSAliases, anAlias);
2c15234c 253 }
73abe331 254 }
57f50b3c 255
1d172743 256 anAttribute = entry->GetAttribute("dcsDP"); // MAY
2c15234c 257 if (anAttribute)
258 {
259 const char* aDataPoint;
260 while ((aDataPoint = anAttribute->GetValue()))
261 {
36c99a6a 262 fDCSDataPointsComp->AddLast(new TObjString(aDataPoint));
263 ExpandAndAdd(fDCSDataPoints, aDataPoint);
2c15234c 264 }
b948db8d 265 }
fb40ead4 266
73abe331 267 fIsValid = kTRUE;
268}
40150741 269//______________________________________________________________________________________________
1d172743 270void AliShuttleConfig::AliShuttleDCSConfigHolder::ExpandAndAdd(TObjArray* target, const char* entry)
40150741 271{
f59d2f8f 272 //
273 // adds <entry> to <target> applying expanding of the name
274 // [N..M] creates M-N+1 names with the corresponding digits
275 //
40150741 276
f59d2f8f 277 TString entryStr(entry);
40150741 278
f59d2f8f 279 Int_t begin = entryStr.Index("[");
280 Int_t end = entryStr.Index("]");
281 if (begin != -1 && end != -1 && end > begin)
282 {
283 TString before(entryStr(0, begin));
284 TString after(entryStr(end+1, entryStr.Length()));
40150741 285
f59d2f8f 286 AliDebug(2, Form("Found [] pattern. Splitted input string %s %s", before.Data(), after.Data()));
40150741 287
f59d2f8f 288 Int_t dotdot = entryStr.Index("..");
40150741 289
f59d2f8f 290 TString nStr(entryStr(begin+1, dotdot-begin-1));
291 TString mStr(entryStr(dotdot+2, end-dotdot-2));
40150741 292
f59d2f8f 293 AliDebug(2, Form("Found [N..M] pattern. %s %s", nStr.Data(), mStr.Data()));
40150741 294
f59d2f8f 295 if (nStr.IsDigit() && mStr.IsDigit())
296 {
297 Int_t n = nStr.Atoi();
298 Int_t m = mStr.Atoi();
40150741 299
f59d2f8f 300 Int_t nDigits = nStr.Length();
301 TString formatStr;
302 formatStr.Form("%%s%%0%dd%%s", nDigits);
40150741 303
f59d2f8f 304 AliDebug(2, Form("Format string is %s", formatStr.Data()));
40150741 305
f59d2f8f 306 for (Int_t current = n; current<=m; ++current)
307 {
308 TString newEntry;
309 newEntry.Form(formatStr.Data(), before.Data(), current, after.Data());
40150741 310
f59d2f8f 311 AliDebug(2, Form("Calling recursive with %s", newEntry.Data()));
40150741 312
f59d2f8f 313 // and go recursive
314 ExpandAndAdd(target, newEntry);
315 }
40150741 316
f59d2f8f 317 // return here because we processed the entries already recursively.
318 return;
319 }
320 }
40150741 321
f59d2f8f 322 AliDebug(2, Form("Adding name %s", entry));
323 target->AddLast(new TObjString(entry));
40150741 324}
325
a7160fe9 326//______________________________________________________________________________________________
1d172743 327AliShuttleConfig::AliShuttleDCSConfigHolder::~AliShuttleDCSConfigHolder()
58bc3020 328{
329// destructor of the shuttle configuration holder
330
2bb7b766 331 delete fDCSAliases;
2c15234c 332 delete fDCSDataPoints;
1d172743 333 delete fDCSAliasesComp;
334 delete fDCSDataPointsComp;
335}
336
337//______________________________________________________________________________________________
338AliShuttleConfig::AliShuttleDetConfigHolder::AliShuttleDetConfigHolder(const TLDAPEntry* entry):
339fDetector(""),
340fDCSConfig(),
341fResponsibles(0),
342fIsValid(kFALSE),
343fSkipDCSQuery(kFALSE),
344fStrictRunOrder(kFALSE)
345{
346// constructor of the shuttle configuration holder
347
348 TLDAPAttribute* anAttribute;
349
350 fResponsibles = new TObjArray();
351 fResponsibles->SetOwner(1);
352 fDCSConfig = new TObjArray();
353 fDCSConfig->SetOwner(1);
354
355 anAttribute = entry->GetAttribute("det"); // MUST
356 if (!anAttribute)
357 {
358 AliError(Form("No \"det\" attribute!"));
359 return;
360 }
361 fDetector = anAttribute->GetValue();
362
363 anAttribute = entry->GetAttribute("strictRunOrder"); // MAY
364 if (!anAttribute)
365 {
366 AliWarning(Form("%s did not set strictRunOrder flag - the default is FALSE",
367 fDetector.Data()));
368 } else {
369 TString strictRunStr = anAttribute->GetValue();
370 if (!(strictRunStr == "0" || strictRunStr == "1"))
371 {
372 AliError("strictRunOrder flag must be 0 or 1!");
373 return;
374 }
375 fStrictRunOrder = (Bool_t) strictRunStr.Atoi();
376 }
377
378 anAttribute = entry->GetAttribute("responsible"); // MAY
379 if (!anAttribute)
380 {
381 AliDebug(2, "Warning! No \"responsible\" attribute!");
382 }
383 else
384 {
385 const char* aResponsible;
386 while ((aResponsible = anAttribute->GetValue()))
387 {
388 fResponsibles->AddLast(new TObjString(aResponsible));
389 }
390 }
391
392 fIsValid = kTRUE;
393}
394
395//______________________________________________________________________________________________
396AliShuttleConfig::AliShuttleDetConfigHolder::~AliShuttleDetConfigHolder()
397{
398// destructor of the shuttle configuration holder
399
57c1a579 400 delete fResponsibles;
1d172743 401 delete fDCSConfig;
402}
403
404//______________________________________________________________________________________________
405const char* AliShuttleConfig::AliShuttleDetConfigHolder::GetDCSHost(Int_t iServ) const
406{
407 //
408 // returns DCS server host
409 //
410
411 if (iServ < 0 || iServ >= GetNServers()) return 0;
412
413 AliShuttleDCSConfigHolder *aHolder = dynamic_cast<AliShuttleDCSConfigHolder *>
414 (fDCSConfig->At(iServ));
415
416 return aHolder->GetDCSHost();
417}
418
419//______________________________________________________________________________________________
420Int_t AliShuttleConfig::AliShuttleDetConfigHolder::GetDCSPort(Int_t iServ) const
421{
422 //
423 // returns DCS server port
424 //
425
426 if (iServ < 0 || iServ >= GetNServers()) return 0;
427
428 AliShuttleDCSConfigHolder *aHolder = dynamic_cast<AliShuttleDCSConfigHolder *>
429 (fDCSConfig->At(iServ));
430
431 return aHolder->GetDCSPort();
432}
433
542b6cc8 434//______________________________________________________________________________________________
435Int_t AliShuttleConfig::AliShuttleDetConfigHolder::GetMultiSplit(Int_t iServ) const
436{
437 //
438 // returns DCS "multi split" value
439 //
440
441 if (iServ < 0 || iServ >= GetNServers()) return 0;
442
443 AliShuttleDCSConfigHolder *aHolder = dynamic_cast<AliShuttleDCSConfigHolder *>
444 (fDCSConfig->At(iServ));
445
446 return aHolder->GetMultiSplit();
447}
448
1d172743 449//______________________________________________________________________________________________
450const TObjArray* AliShuttleConfig::AliShuttleDetConfigHolder::GetDCSAliases(Int_t iServ) const
451{
452 //
453 // returns collection of TObjString which represents the set of aliases
454 // which used for data retrieval for particular detector
455 //
456
457 if (iServ < 0 || iServ >= GetNServers()) return 0;
458
459 AliShuttleDCSConfigHolder *aHolder = dynamic_cast<AliShuttleDCSConfigHolder *>
460 (fDCSConfig->At(iServ));
461
462 return aHolder->GetDCSAliases();
463}
464
465//______________________________________________________________________________________________
466const TObjArray* AliShuttleConfig::AliShuttleDetConfigHolder::GetDCSDataPoints(Int_t iServ) const
467{
468 //
469 // returns collection of TObjString which represents the set of aliases
470 // which used for data retrieval for particular detector
471 //
472
473 if (iServ < 0 || iServ >= GetNServers()) return 0;
474
475 AliShuttleDCSConfigHolder *aHolder = dynamic_cast<AliShuttleDCSConfigHolder *>
476 (fDCSConfig->At(iServ));
477
478 return aHolder->GetDCSDataPoints();
479}
480
481//______________________________________________________________________________________________
482const TObjArray* AliShuttleConfig::AliShuttleDetConfigHolder::GetCompactDCSAliases(Int_t iServ) const
483{
484 //
485 // returns collection of TObjString which represents the set of aliases
486 // which used for data retrieval for particular detector (Compact style)
487 //
488
489 if (iServ < 0 || iServ >= GetNServers()) return 0;
490
491 AliShuttleDCSConfigHolder *aHolder = dynamic_cast<AliShuttleDCSConfigHolder *>
492 (fDCSConfig->At(iServ));
493
494 return aHolder->GetCompactDCSAliases();
495}
496
497//______________________________________________________________________________________________
498const TObjArray* AliShuttleConfig::AliShuttleDetConfigHolder::GetCompactDCSDataPoints(Int_t iServ) const
499{
500 //
501 // returns collection of TObjString which represents the set of aliases
502 // which used for data retrieval for particular detector (Compact style)
503 //
504
505 if (iServ < 0 || iServ >= GetNServers()) return 0;
506
507 AliShuttleDCSConfigHolder *aHolder = dynamic_cast<AliShuttleDCSConfigHolder *>
508 (fDCSConfig->At(iServ));
509
510 return aHolder->GetCompactDCSDataPoints();
511}
512
513//______________________________________________________________________________________________
514void AliShuttleConfig::AliShuttleDetConfigHolder::AddDCSConfig(AliShuttleDCSConfigHolder* holder)
515{
516 //
517 // adds a DCS configuration set in the array of DCS configurations
518 //
519
520 if(!holder) return;
521 fDCSConfig->AddLast(holder);
73abe331 522}
523
524ClassImp(AliShuttleConfig)
525
a7160fe9 526//______________________________________________________________________________________________
527AliShuttleConfig::AliShuttleConfig(const char* host, Int_t port,
73abe331 528 const char* binddn, const char* password, const char* basedn):
1d172743 529 fConfigHost(host),
28a94b8e 530 fAlienPath(""),
1d172743 531 fDAQlbHost(""),
532 fDAQlbPort(),
533 fDAQlbUser(""),
534 fDAQlbPass(""),
535 fDAQlbDB(""),
536 fDAQlbTable(""),
537 fShuttlelbTable(""),
538 fRunTypelbTable(""),
6ea86315 539 fPasswdFilePath(""),
a5ecdb19 540 fTerminateFilePath(""),
541 fMaxRetries(0),
1d172743 542 fPPTimeOut(0),
ff3781ad 543 fDCSTimeOut(0),
a18e8fa6 544 fDCSRetries(0),
2eb98462 545 fDCSQueryOffset(0),
546 fDCSDelay(0),
1d172743 547 fPPMaxMem(0),
b832ec02 548 fMonitorHost(""),
549 fMonitorTable(""),
7d4cf768 550 fTriggerWait(3600),
fb2975a2 551 fShuttleFileSystem("/"),
552 fFreeDiskWarningThreshold(20),
553 fFreeDiskFatalThreshold(10),
7d4cf768 554 fRunMode(kTest),
1d172743 555 fDetectorMap(),
556 fDetectorList(),
fb40ead4 557 fAdmin(),
1d172743 558 fShuttleInstanceHost(""),
559 fProcessedDetectors(),
fb40ead4 560 fKeepDCSMap(kFALSE),
561 fKeepTempFolder(kFALSE),
562 fSendMail(kFALSE),
1d172743 563 fProcessAll(kFALSE),
564 fIsValid(kFALSE)
fb40ead4 565
73abe331 566{
567 //
568 // host: ldap server host
569 // port: ldap server port
570 // binddn: binddn used for ldap binding (simple bind is used!).
571 // password: password for binddn
b948db8d 572 // basedn: this is basedn whose childeren entries which have
73abe331 573 //
574
1d172743 575 fDetectorMap.SetOwner(1);
2bb7b766 576 fDetectorList.SetOwner(0); //fDetectorList and fDetectorMap share the same object!
577 fProcessedDetectors.SetOwner();
fb40ead4 578
579 for (int i=0; i<5; i++)
580 {
581 fAdmin[i] = new TObjArray();
582 fAdmin[i]->SetOwner();
583 }
2bb7b766 584
b948db8d 585 TLDAPServer aServer(host, port, binddn, password, 3);
57f50b3c 586
73abe331 587 if (!aServer.IsConnected()) {
2bb7b766 588 AliError(Form("Can't connect to ldap server %s:%d",
73abe331 589 host, port));
590 return;
591 }
592
b948db8d 593 // reads configuration for the shuttle running on this machine
1d172743 594
595 TLDAPResult* aResult = 0;
596 TLDAPEntry* anEntry = 0;
597
598 TList dcsList;
599 dcsList.SetOwner(1);
600 TList detList;
601 detList.SetOwner(1);
602 TList globalList;
603 globalList.SetOwner(1);
604 TList sysList;
605 sysList.SetOwner(1);
606 TList hostList;
607 hostList.SetOwner(1);
608
609 aResult = aServer.Search(basedn, LDAP_SCOPE_SUBTREE, 0, 0);
610
611 if (!aResult)
612 {
613 AliError(Form("Can't find configuration with base DN: %s !", basedn));
73abe331 614 return;
615 }
1d172743 616
617 while ((anEntry = aResult->GetNext()))
618 {
619 TString dn = anEntry->GetDn();
620
621 if (dn.BeginsWith("dcsHost="))
622 {
623 dcsList.Add(anEntry);
624 }
625 else if (dn.BeginsWith("det="))
626 {
627 detList.Add(anEntry);
628 }
629 else if (dn.BeginsWith("name=globalConfig"))
630 {
631 globalList.Add(anEntry);
632 }
633 else if (dn.BeginsWith("system="))
634 {
635 sysList.Add(anEntry);
636 }
637 else if (dn.BeginsWith("shuttleHost="))
638 {
639 hostList.Add(anEntry);
640 }
641 else
642 {
643 delete anEntry;
644 }
645
b948db8d 646 }
1d172743 647 delete aResult;
648
649 Int_t result=0;
650
651 result += SetGlobalConfig(&globalList);
652 result += SetSysConfig(&sysList);
6ea86315 653 result += SetPasswords();
1d172743 654 result += SetDetConfig(&detList,&dcsList);
655 result += SetHostConfig(&hostList);
656
657 if(result)
658 {
659 AliError("Configuration is INVALID!");
b948db8d 660 }
1d172743 661 else
662 {
663 fIsValid = kTRUE;
b948db8d 664 }
1d172743 665}
b948db8d 666
1d172743 667//______________________________________________________________________________________________
668AliShuttleConfig::~AliShuttleConfig()
669{
670// destructor
57f50b3c 671
1d172743 672 fDetectorMap.DeleteAll();
673 fDetectorList.Clear();
674 fProcessedDetectors.Delete();
675}
b948db8d 676
1d172743 677//______________________________________________________________________________________________
678const TObjArray* AliShuttleConfig::GetDetectors() const
679{
680 //
681 // returns collection of TObjString which contains the name
682 // of every detector which is in the configuration.
683 //
57f50b3c 684
1d172743 685 return &fDetectorList;
686}
73abe331 687
1d172743 688//______________________________________________________________________________________________
689Bool_t AliShuttleConfig::HasDetector(const char* detector) const
690{
691 //
692 // checks for paricular detector in the configuration.
693 //
694 return fDetectorMap.GetValue(detector) != NULL;
695}
73abe331 696
1d172743 697//______________________________________________________________________________________________
698Int_t AliShuttleConfig::GetNServers(const char* detector) const
699{
700 //
701 // returns number of DCS servers for detector
702 //
703
704 AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) fDetectorMap.GetValue(detector);
705 if (!aHolder) {
706 AliError(Form("There isn't configuration for detector: %s",
707 detector));
708 return 0;
57f50b3c 709 }
710
1d172743 711 return aHolder->GetNServers();
712}
d477ad88 713
d477ad88 714
1d172743 715//______________________________________________________________________________________________
716const char* AliShuttleConfig::GetDCSHost(const char* detector, Int_t iServ) const
717{
718 //
719 // returns i-th DCS server host used by particular detector
720 //
721
722 AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) fDetectorMap.GetValue(detector);
723 if (!aHolder) {
724 AliError(Form("There isn't configuration for detector: %s",
725 detector));
726 return NULL;
d477ad88 727 }
728
1d172743 729 return aHolder->GetDCSHost(iServ);
730}
731
732//______________________________________________________________________________________________
733Int_t AliShuttleConfig::GetDCSPort(const char* detector, Int_t iServ) const
734{
735 //
736 // returns i-th DCS server port used by particular detector
737 //
738
739
740 AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) fDetectorMap.GetValue(detector);
741 if (!aHolder) {
742 AliError(Form("There isn't configuration for detector: %s",
743 detector));
744 return 0;
745 }
746
747 return aHolder->GetDCSPort(iServ);
748}
749
542b6cc8 750//______________________________________________________________________________________________
751Int_t AliShuttleConfig::GetMultiSplit(const char* detector, Int_t iServ) const
752{
753 //
754 // returns i-th DCS "multi split" value
755 //
756
757
758 AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) fDetectorMap.GetValue(detector);
759 if (!aHolder) {
760 AliError(Form("There isn't configuration for detector: %s",
761 detector));
762 return 0;
763 }
764
765 return aHolder->GetMultiSplit(iServ);
766}
767
1d172743 768//______________________________________________________________________________________________
769const TObjArray* AliShuttleConfig::GetDCSAliases(const char* detector, Int_t iServ) const
770{
771 //
772 // returns collection of TObjString which represents the i-th set of aliases
773 // which used for data retrieval for particular detector
774 //
775
776 AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) fDetectorMap.GetValue(detector);
777 if (!aHolder) {
778 AliError(Form("There isn't configuration for detector: %s",
779 detector));
780 return NULL;
781 }
782
783 return aHolder->GetDCSAliases(iServ);
784}
785
786//______________________________________________________________________________________________
787const TObjArray* AliShuttleConfig::GetDCSDataPoints(const char* detector, Int_t iServ) const
788{
789 //
790 // returns collection of TObjString which represents the set of aliases
791 // which used for data retrieval for particular detector
792 //
793
794 AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) fDetectorMap.GetValue(detector);
795 if (!aHolder) {
796 AliError(Form("There isn't configuration for detector: %s",
797 detector));
798 return NULL;
799 }
800
801 return aHolder->GetDCSDataPoints(iServ);
802}
803
804//______________________________________________________________________________________________
805const TObjArray* AliShuttleConfig::GetCompactDCSAliases(const char* detector, Int_t iServ) const
806{
807 //
808 // returns collection of TObjString which represents the i-th set of aliases
809 // which used for data retrieval for particular detector (Compact style)
810 //
811
812 AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) fDetectorMap.GetValue(detector);
813 if (!aHolder) {
814 AliError(Form("There isn't configuration for detector: %s",
815 detector));
816 return NULL;
817 }
818
819 return aHolder->GetCompactDCSAliases(iServ);
820}
821
822//______________________________________________________________________________________________
823const TObjArray* AliShuttleConfig::GetCompactDCSDataPoints(const char* detector, Int_t iServ) const
824{
825 //
826 // returns collection of TObjString which represents the set of aliases
827 // which used for data retrieval for particular detector (Compact style)
828 //
829
830 AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) fDetectorMap.GetValue(detector);
831 if (!aHolder) {
832 AliError(Form("There isn't configuration for detector: %s",
833 detector));
834 return NULL;
835 }
836
837 return aHolder->GetCompactDCSDataPoints(iServ);
838}
839
840//______________________________________________________________________________________________
841const TObjArray* AliShuttleConfig::GetResponsibles(const char* detector) const
842{
843 //
844 // returns collection of TObjString which represents the list of mail addresses
845 // of the detector's responsible(s)
846 //
847
848 AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) fDetectorMap.GetValue(detector);
849 if (!aHolder) {
850 AliError(Form("There isn't configuration for detector: %s",
851 detector));
852 return NULL;
853 }
854
855 return aHolder->GetResponsibles();
856}
857
fb40ead4 858//______________________________________________________________________________________________
859const TObjArray* AliShuttleConfig::GetAdmins(Int_t sys) const
860{
861 //
862 // returns collection of TObjString which represents the list of mail addresses
863 // of the system's administrator(s) (DAQ, DCS, HLT, Global, Amanda)
864 //
865
866 if (sys < 0 || sys > 4) return 0;
867 return fAdmin[sys];
868}
869
1d172743 870//______________________________________________________________________________________________
871Bool_t AliShuttleConfig::HostProcessDetector(const char* detector) const
872{
873 // return TRUE if detector is handled by host or if fProcessAll is TRUE
874
875 if(fProcessAll) return kTRUE;
876 TIter iter(&fProcessedDetectors);
877 TObjString* detName;
878 while((detName = (TObjString*) iter.Next())){
879 if(detName->String() == detector) return kTRUE;
d477ad88 880 }
1d172743 881 return kFALSE;
882}
883
884//______________________________________________________________________________________________
885Bool_t AliShuttleConfig::StrictRunOrder(const char* detector) const
886{
887 // return TRUE if detector wants strict run ordering of stored data
888
889 AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) fDetectorMap.GetValue(detector);
890 if (!aHolder)
891 {
892 AliError(Form("There isn't configuration for detector: %s",
893 detector));
894 return kTRUE;
895 }
d477ad88 896
1d172743 897 return aHolder->StrictRunOrder();
898}
57f50b3c 899
1d172743 900//______________________________________________________________________________________________
901UInt_t AliShuttleConfig::SetGlobalConfig(TList* list)
902{
903 // Set the global configuration (DAQ Logbook + preprocessor monitoring settings)
904
6ea86315 905
1d172743 906 TLDAPEntry* anEntry = 0;
907 TLDAPAttribute* anAttribute = 0;
908
909 if (list->GetEntries() == 0)
910 {
911 AliError("Global configuration not found!");
912 return 1;
913 }
914 else if (list->GetEntries() > 1)
915 {
916 AliError("More than one global configuration found!");
917 return 2;
918 }
919
920 anEntry = dynamic_cast<TLDAPEntry*> (list->At(0));
921
922 if (!anEntry)
923 {
924 AliError("Unexpected! Global list does not contain a TLDAPEntry");
925 return 3;
926 }
927
928
b8cf5e0f 929 anAttribute = anEntry->GetAttribute("AlienPath");
930 if (!anAttribute) {
931 AliError("Can't find AlienPath attribute!");
932 return 4;
933 }
934 fAlienPath = anAttribute->GetValue();
935
1d172743 936 anAttribute = anEntry->GetAttribute("daqLbHost");
d477ad88 937 if (!anAttribute) {
1d172743 938 AliError("Can't find daqLbHost attribute!");
939 return 4;
d477ad88 940 }
57f50b3c 941 fDAQlbHost = anAttribute->GetValue();
d477ad88 942
1d172743 943 anAttribute = anEntry->GetAttribute("daqLbPort"); // MAY
fc5a4708 944 if (anAttribute)
945 {
946 fDAQlbPort = ((TString) anAttribute->GetValue()).Atoi();
947 } else {
948 fDAQlbPort = 3306; // mysql
949 }
950
1d172743 951 anAttribute = anEntry->GetAttribute("daqLbUser");
d477ad88 952 if (!anAttribute) {
1d172743 953 AliError("Can't find daqLbUser attribute!");
954 return 4;
d477ad88 955 }
57f50b3c 956 fDAQlbUser = anAttribute->GetValue();
957
1d172743 958 anAttribute = anEntry->GetAttribute("daqLbDB");
2c15234c 959 if (!anAttribute) {
1d172743 960 AliError("Can't find daqLbDB attribute!");
961 return 4;
2c15234c 962 }
963 fDAQlbDB = anAttribute->GetValue();
964
1d172743 965 anAttribute = anEntry->GetAttribute("daqLbTable");
2c15234c 966 if (!anAttribute) {
1d172743 967 AliError("Can't find daqLbTable attribute!");
968 return 4;
2c15234c 969 }
970 fDAQlbTable = anAttribute->GetValue();
971
1d172743 972 anAttribute = anEntry->GetAttribute("shuttleLbTable");
441b0e9c 973 if (!anAttribute) {
1d172743 974 AliError("Can't find shuttleLbTable attribute!");
975 return 4;
441b0e9c 976 }
977 fShuttlelbTable = anAttribute->GetValue();
978
1d172743 979 anAttribute = anEntry->GetAttribute("runTypeLbTable");
441b0e9c 980 if (!anAttribute) {
1d172743 981 AliError("Can't find runTypeLbTable attribute!");
982 return 4;
441b0e9c 983 }
984 fRunTypelbTable = anAttribute->GetValue();
2c15234c 985
1d172743 986 anAttribute = anEntry->GetAttribute("ppmaxRetries");
5164a766 987 if (!anAttribute) {
1d172743 988 AliError("Can't find ppmaxRetries attribute!");
989 return 4;
5164a766 990 }
991 TString tmpStr = anAttribute->GetValue();
cb343cfd 992 fMaxRetries = tmpStr.Atoi();
5164a766 993
a5ecdb19 994 anAttribute = anEntry->GetAttribute("terminateFilePath");
995 if (anAttribute) {
996 fTerminateFilePath = anAttribute->GetValue();
997 }
998
1d172743 999 anAttribute = anEntry->GetAttribute("ppTimeOut");
5164a766 1000 if (!anAttribute) {
1d172743 1001 AliError("Can't find ppTimeOut attribute!");
1002 return 4;
5164a766 1003 }
1004 tmpStr = anAttribute->GetValue();
cb343cfd 1005 fPPTimeOut = tmpStr.Atoi();
5164a766 1006
ff3781ad 1007 anAttribute = anEntry->GetAttribute("dcsTimeOut");
1008 if (!anAttribute) {
1009 AliError("Can't find dcsTimeOut attribute!");
1010 return 4;
1011 }
1012 tmpStr = anAttribute->GetValue();
1013 fDCSTimeOut = tmpStr.Atoi();
1014
1015 anAttribute = anEntry->GetAttribute("nDCSretries");
1016 if (!anAttribute) {
1017 AliError("Can't find dcsTimeOut attribute!");
1018 return 4;
1019 }
1020 tmpStr = anAttribute->GetValue();
1021 fDCSRetries = tmpStr.Atoi();
1022
2eb98462 1023 anAttribute = anEntry->GetAttribute("DCSQueryOffset");
1024 if (!anAttribute) {
1025 AliError("Can't find DCSQueryOffset attribute!");
1026 return 4;
1027 }
1028 tmpStr = anAttribute->GetValue();
1029 fDCSQueryOffset = tmpStr.Atoi();
1030
1031 anAttribute = anEntry->GetAttribute("DCSDelay");
1032 if (!anAttribute) {
1033 AliError("Can't find DCSDelay attribute!");
1034 return 4;
1035 }
1036 tmpStr = anAttribute->GetValue();
1037 fDCSDelay = tmpStr.Atoi();
1038
1d172743 1039 anAttribute = anEntry->GetAttribute("ppMaxMem");
9827400b 1040 if (!anAttribute) {
1d172743 1041 AliError("Can't find ppMaxMem attribute!");
1042 return 4;
9827400b 1043 }
1044 tmpStr = anAttribute->GetValue();
1045 fPPMaxMem = tmpStr.Atoi();
1046
b832ec02 1047 anAttribute = anEntry->GetAttribute("monitorHost");
1048 if (!anAttribute) {
1049 AliError("Can't find monitorHost attribute!");
1050 return 4;
1051 }
1052 fMonitorHost = anAttribute->GetValue();
1053
1054 anAttribute = anEntry->GetAttribute("monitorTable");
1055 if (!anAttribute) {
1056 AliError("Can't find monitorTable attribute!");
1057 return 4;
1058 }
1059 fMonitorTable = anAttribute->GetValue();
7d4cf768 1060
1061 anAttribute = anEntry->GetAttribute("triggerWait"); // MAY
1062 if (!anAttribute) {
fb2975a2 1063 AliWarning(Form("triggerWait not set! default = %d", fTriggerWait));
7d4cf768 1064 }
1065 tmpStr = anAttribute->GetValue();
1066 fTriggerWait = tmpStr.Atoi();
fb2975a2 1067
1068 anAttribute = anEntry->GetAttribute("ShuttleFileSystem");
1069 if (!anAttribute) {
1070 AliWarning(Form("ShuttleFileSystem not set! default = %s", fShuttleFileSystem.Data()));
1071 }
1072 fShuttleFileSystem = anAttribute->GetValue();
1073
1074 anAttribute = anEntry->GetAttribute("FreeDiskWarningThreshold"); // MAY
1075 if (!anAttribute) {
1076 AliWarning(Form("FreeDiskWarningThreshold not set! default = %d", fFreeDiskWarningThreshold));
1077 }
1078 tmpStr = anAttribute->GetValue();
1079 fFreeDiskWarningThreshold = tmpStr.Atoi();
1080
1081 anAttribute = anEntry->GetAttribute("FreeDiskFatalThreshold"); // MAY
1082 if (!anAttribute) {
1083 AliWarning(Form("FreeDiskFatalThreshold not set! default = %d", fFreeDiskFatalThreshold));
1084 }
1085 tmpStr = anAttribute->GetValue();
1086 fFreeDiskFatalThreshold = tmpStr.Atoi();
1087
7d4cf768 1088 anAttribute = anEntry->GetAttribute("mode");
1089 if (!anAttribute) {
1090 AliWarning("Run mode not set! Running in test mode.");
7d4cf768 1091 } else {
4508ab8b 1092 tmpStr = anAttribute->GetValue();
1093 if (tmpStr == "test")
1094 {
1095 fRunMode = kTest;
1096 } else if (tmpStr == "prod") {
1097 fRunMode = kProd;
1098 } else {
1099 AliWarning(Form("Not a valid run mode: %s", tmpStr.Data()));
1100 AliWarning("Valid run modes are \"test\" and \"prod\". Running in test mode.");
1101 }
7d4cf768 1102 }
fb40ead4 1103
1104 anAttribute = anEntry->GetAttribute("keepDCSMap"); // MAY
1105 if (!anAttribute)
1106 {
1107 AliWarning("keepDCSMap flag not set - default is FALSE");
1108 } else {
1109 TString keepDCSMapStr = anAttribute->GetValue();
1110 if (!(keepDCSMapStr == "0" || keepDCSMapStr == "1"))
1111 {
1112 AliError("keepDCSMap flag must be 0 or 1!");
1113 return 4;
1114 }
1115 fKeepDCSMap = (Bool_t) keepDCSMapStr.Atoi();
1116 }
1117
1118 anAttribute = anEntry->GetAttribute("keepTempFolder"); // MAY
1119 if (!anAttribute)
1120 {
1121 AliWarning("keepTempFolder flag not set - default is FALSE");
1122 } else {
1123 TString keepTempFolderStr = anAttribute->GetValue();
1124 if (!(keepTempFolderStr == "0" || keepTempFolderStr == "1"))
1125 {
1126 AliError("keepTempFolder flag must be 0 or 1!");
1127 return 4;
1128 }
1129 fKeepTempFolder = (Bool_t) keepTempFolderStr.Atoi();
1130 }
1131
1132
1133 anAttribute = anEntry->GetAttribute("shuttleAdmin"); // MAY
1134 if (!anAttribute)
1135 {
1136 AliDebug(2, "Warning! No \"shuttleAdmin\" attribute!");
1137 }
1138 else
1139 {
1140 const char* anAdmin;
1141 while ((anAdmin = anAttribute->GetValue()))
1142 {
1143 fAdmin[kGlobal]->AddLast(new TObjString(anAdmin));
1144 }
1145 }
1146
1147 anAttribute = anEntry->GetAttribute("amandaAdmin"); // MAY
1148 if (!anAttribute)
1149 {
1150 AliDebug(2, "Warning! No \"amandaAdmin\" attribute!");
1151 }
1152 else
1153 {
1154 const char* anAdmin;
1155 while ((anAdmin = anAttribute->GetValue()))
1156 {
1157 fAdmin[kAmanda]->AddLast(new TObjString(anAdmin));
1158 }
1159 }
1160
1161 anAttribute = anEntry->GetAttribute("sendMail"); // MAY
1162 if (!anAttribute)
1163 {
1164 AliWarning("sendMail flag not set - default is FALSE");
1165 } else {
1166 TString sendMailStr = anAttribute->GetValue();
1167 if (!(sendMailStr == "0" || sendMailStr == "1"))
1168 {
1169 AliError("sendMail flag must be 0 or 1!");
1170 return 4;
1171 }
1172 fSendMail = (Bool_t) sendMailStr.Atoi();
1173 }
1174
6ea86315 1175 anAttribute = anEntry->GetAttribute("passwdFilePath");
1176 if (!anAttribute) {
1177 AliError("Can't find Passwords File Path attribute!");
1178 return 4;
1179 }
1180 fPasswdFilePath = anAttribute->GetValue();
1181
1d172743 1182 return 0;
1d172743 1183}
57f50b3c 1184
1d172743 1185//______________________________________________________________________________________________
1186UInt_t AliShuttleConfig::SetSysConfig(TList* list)
1187{
1188 // Set the online FXS configuration (DAQ + DCS + HLT)
6ea86315 1189
1190
1d172743 1191 TLDAPEntry* anEntry = 0;
1192 TLDAPAttribute* anAttribute = 0;
1193
1194 if (list->GetEntries() != 3)
1195 {
1196 AliError(Form("Wrong number of online systems found: %d !", list->GetEntries()));
1197 return 1;
1198 }
57f50b3c 1199
1d172743 1200 TIter iter(list);
fb40ead4 1201 Int_t count = 0;
1202 SystemCode iSys=kDAQ;
1203
1d172743 1204 while ((anEntry = dynamic_cast<TLDAPEntry*> (iter.Next())))
1205 {
1206 anAttribute = anEntry->GetAttribute("system");
1207 TString sysName = anAttribute->GetValue();
1208
1209 if (sysName == "DAQ")
1210 {
fb40ead4 1211 iSys = kDAQ;
1d172743 1212 count += 1;
57f50b3c 1213 }
1d172743 1214 else if (sysName == "DCS")
1215 {
fb40ead4 1216 iSys = kDCS;
1d172743 1217 count += 10;
57f50b3c 1218 }
1d172743 1219 else if (sysName == "HLT")
1220 {
fb40ead4 1221 iSys = kHLT;
1d172743 1222 count += 100;
1223 }
1224
1225 anAttribute = anEntry->GetAttribute("dbHost");
57f50b3c 1226 if (!anAttribute) {
1d172743 1227 AliError(Form ("Can't find dbHost attribute for %s!!",
eba76848 1228 AliShuttleInterface::GetSystemName(iSys)));
1d172743 1229 return 5;
57f50b3c 1230 }
2c15234c 1231 fFXSdbHost[iSys] = anAttribute->GetValue();
57f50b3c 1232
1d172743 1233 anAttribute = anEntry->GetAttribute("dbPort"); // MAY
fc5a4708 1234 if (anAttribute)
1235 {
1236 fFXSdbPort[iSys] = ((TString) anAttribute->GetValue()).Atoi();
1237 } else {
1238 fFXSdbPort[iSys] = 3306; // mysql
1239 }
1240
1d172743 1241 anAttribute = anEntry->GetAttribute("dbUser");
57f50b3c 1242 if (!anAttribute) {
1d172743 1243 AliError(Form ("Can't find dbUser attribute for %s!!",
eba76848 1244 AliShuttleInterface::GetSystemName(iSys)));
1d172743 1245 return 5;
57f50b3c 1246 }
2c15234c 1247 fFXSdbUser[iSys] = anAttribute->GetValue();
57f50b3c 1248
1d172743 1249 anAttribute = anEntry->GetAttribute("dbName");
2c15234c 1250 if (!anAttribute) {
1d172743 1251 AliError(Form ("Can't find dbName attribute for %s!!",
2c15234c 1252 AliShuttleInterface::GetSystemName(iSys)));
1d172743 1253 return 5;
2c15234c 1254 }
1255
1256 fFXSdbName[iSys] = anAttribute->GetValue();
1d172743 1257 anAttribute = anEntry->GetAttribute("dbTable");
2c15234c 1258 if (!anAttribute) {
1d172743 1259 AliError(Form ("Can't find dbTable attribute for %s!!",
2c15234c 1260 AliShuttleInterface::GetSystemName(iSys)));
1d172743 1261 return 5;
2c15234c 1262 }
1263 fFXSdbTable[iSys] = anAttribute->GetValue();
57f50b3c 1264
1d172743 1265 anAttribute = anEntry->GetAttribute("fxsHost");
57f50b3c 1266 if (!anAttribute) {
1d172743 1267 AliError(Form ("Can't find fxsHost attribute for %s!!",
eba76848 1268 AliShuttleInterface::GetSystemName(iSys)));
1d172743 1269 return 5;
57f50b3c 1270 }
2c15234c 1271 fFXSHost[iSys] = anAttribute->GetValue();
57f50b3c 1272
1d172743 1273 anAttribute = anEntry->GetAttribute("fxsPort"); // MAY
fc5a4708 1274 if (anAttribute)
1275 {
1276 fFXSPort[iSys] = ((TString) anAttribute->GetValue()).Atoi();
1277 } else {
1278 fFXSPort[iSys] = 22; // scp port number
1279 }
1280
1d172743 1281 anAttribute = anEntry->GetAttribute("fxsUser");
57f50b3c 1282 if (!anAttribute) {
1d172743 1283 AliError(Form ("Can't find fxsUser attribute for %s!!",
eba76848 1284 AliShuttleInterface::GetSystemName(iSys)));
1d172743 1285 return 5;
57f50b3c 1286 }
2c15234c 1287 fFXSUser[iSys] = anAttribute->GetValue();
57f50b3c 1288
1d172743 1289 anAttribute = anEntry->GetAttribute("fxsPasswd");
2c15234c 1290 if (anAttribute) fFXSPass[iSys] = anAttribute->GetValue();
339adafa 1291
1292 anAttribute = anEntry->GetAttribute("fxsBaseFolder");
1293 if (anAttribute) fFXSBaseFolder[iSys] = anAttribute->GetValue();
fb40ead4 1294
1295 anAttribute = anEntry->GetAttribute("fxsAdmin"); // MAY
1296 if (!anAttribute)
1297 {
1298 AliDebug(2, "Warning! No \"fxsAdmin\" attribute!");
1299 }
1300 else
1301 {
1302 const char* anAdmin;
1303 while ((anAdmin = anAttribute->GetValue()))
1304 {
1305 fAdmin[iSys]->AddLast(new TObjString(anAdmin));
1306 }
1307 }
1308
57f50b3c 1309 }
73abe331 1310
1d172743 1311 if(count != 111) {
1312 AliError(Form("Wrong system configuration! (code = %d)", count));
1313 return 6;
73abe331 1314 }
1d172743 1315
1316 return 0;
2c15234c 1317}
1318
6ea86315 1319//______________________________________________________________________________________________
1320UInt_t AliShuttleConfig::SetPasswords(){
1321
1322 AliInfo("Setting Passwords");
1323
1324 // Retrieving Passwords for DAQ lb, DAQ/DCS/HLT FXS
1325
1326 ifstream *inputfile = new ifstream(fPasswdFilePath.Data());
1327 if (!*inputfile) {
1328 AliError(Form("Error opening file %s !", fPasswdFilePath.Data()));
1329 inputfile->close();
1330 delete inputfile;
1331 return 1;
1332 }
1333
1334 TString line;
1335 Int_t nPwd=0;
1336 Int_t nPwdFake=0;
1337 while (line.ReadLine(*inputfile)) {
1338 TObjArray *tokens = line.Tokenize(" \t");
1339 TString system = ((TObjString *)tokens->At(0))->String();
1340 TString password = ((TObjString *)tokens->At(1))->String();
1341 if (system.Contains("DAQ_LB")){
1342 fDAQlbPass=password;
1343 nPwd++;
1344 AliDebug(3,Form("DAQ_LB: Password %s for %s found", password.Data(), system.Data()));
1345 }
1346 else if (system.Contains("DAQ_DB")){
1347 fFXSdbPass[0]=password;
1348 nPwd++;
1349 AliDebug(3,Form("DAQ_DB: Password %s for %s found", password.Data(), system.Data()));
1350 }
1351 else if (system.Contains("DCS_DB")){
1352 fFXSdbPass[1]=password;
1353 nPwd++;
1354 AliDebug(3,Form("DCS_DB: Password %s for %s found", password.Data(), system.Data()));
1355 }
1356 else if (system.Contains("HLT_DB")){
1357 fFXSdbPass[2]=password;
1358 nPwd++;
1359 AliDebug(3,Form("HLT_DB: Password %s for %s found", password.Data(), system.Data()));
1360 }
1361 else {
1362 nPwdFake++;
1363 AliDebug(3,Form("%i fake line(s) found in file %s", nPwdFake, fPasswdFilePath.Data()));
1364 continue;
1365 }
1366 delete tokens;
1367 }
1368
1369 inputfile->close();
1370 delete inputfile;
1371
1372 if (nPwd!=4){
1373 AliError(Form("Wrong file for DAQ Logbook password found %s (some passwors missing), please Check!", fPasswdFilePath.Data()));
1374 return 2;
1375 }
1376
1377 return 0;
1378
1379}
57c1a579 1380//______________________________________________________________________________________________
1d172743 1381UInt_t AliShuttleConfig::SetDetConfig(TList* detList, TList* dcsList)
57c1a579 1382{
1d172743 1383 // Set the detector configuration (general settings + DCS amanda server and alias/DP lists)
57c1a579 1384
1d172743 1385 TLDAPEntry* anEntry = 0;
1386
1387 TIter iter(detList);
1388 while ((anEntry = dynamic_cast<TLDAPEntry*> (iter.Next())))
1389 {
1390
1391 AliShuttleDetConfigHolder* detHolder = new AliShuttleDetConfigHolder(anEntry);
57c1a579 1392
1d172743 1393 if (!detHolder->IsValid()) {
1394 AliError("Detector configuration error!");
1395 delete detHolder;
1396 return 7;
1397 }
b948db8d 1398
1d172743 1399 TObjString* detStr = new TObjString(detHolder->GetDetector());
1400
1401 // Look for DCS Configuration
1402 TIter dcsIter(dcsList);
1403 TLDAPEntry *dcsEntry = 0;
1404 while ((dcsEntry = dynamic_cast<TLDAPEntry*> (dcsIter.Next())))
1405 {
1406 TString dn = dcsEntry->GetDn();
1407 if(dn.Contains(detStr->GetName())) {
1408 AliDebug(2, Form("Found DCS configuration: dn = %s",dn.Data()));
1409 AliShuttleDCSConfigHolder* dcsHolder = new AliShuttleDCSConfigHolder(dcsEntry);
1410 if (!dcsHolder->IsValid()) {
1411 AliError("DCS configuration error!");
1412 delete detHolder;
1413 delete dcsHolder;
1414 return 7;
1415 }
1416 detHolder->AddDCSConfig(dcsHolder);
1417 }
1418 }
1419
1420
1421 fDetectorMap.Add(detStr, detHolder);
1422 fDetectorList.AddLast(detStr);
b948db8d 1423 }
1d172743 1424
1425 return 0;
73abe331 1426}
1427
be48e3ea 1428//______________________________________________________________________________________________
1d172743 1429UInt_t AliShuttleConfig::SetHostConfig(TList* list)
be48e3ea 1430{
1d172743 1431 // Set the Shuttle machines configuration (which detectors processes each machine)
1432
1433 TLDAPEntry* anEntry = 0;
1434 TLDAPAttribute* anAttribute = 0;
1435
1436 fShuttleInstanceHost = gSystem->HostName();
1437
1438 TIter iter(list);
1439 while ((anEntry = dynamic_cast<TLDAPEntry*> (iter.Next())))
be48e3ea 1440 {
1d172743 1441
1442 TString dn(anEntry->GetDn());
1443 if (!dn.Contains(Form("shuttleHost=%s", fShuttleInstanceHost.Data()))) continue;
1444
1445 if (!fProcessAll)
1446 {
1447 anAttribute = anEntry->GetAttribute("detectors");
1448 const char *detName;
1449 while((detName = anAttribute->GetValue())){
1450 TObjString *objDet= new TObjString(detName);
1451 fProcessedDetectors.Add(objDet);
1452 }
1453 }
1454 }
1455
1456 return 0;
be48e3ea 1457}
1458
1d172743 1459
a7160fe9 1460//______________________________________________________________________________________________
36c99a6a 1461void AliShuttleConfig::Print(Option_t* option) const
58bc3020 1462{
1463// print configuration
36c99a6a 1464// options : "": print configuration for all detectors, aliases and DPs in compacted format
1465// "uncompact": print configuration for all detectors, aliases and DPs in uncompacted format
1466// "DET": print configuration for DET, aliases and DPs in compacted format
1467// "DET, uncompact": print configuration for DET, aliases and DPs in uncompacted format
1468
73abe331 1469 TString result;
1470 result += '\n';
7d4cf768 1471
1472 TString mode = "test";
1473 if (fRunMode == kProd) mode = "production";
d477ad88 1474
7d4cf768 1475 result += "########################################################################\n";
1476 result += Form(" Shuttle configuration from %s - Run Mode: <%s> \n",
1477 fConfigHost.Data(), mode.Data());
1478 result += "########################################################################\n";
57c1a579 1479 result += Form("\nShuttle running on %s \n", fShuttleInstanceHost.Data());
57f50b3c 1480
1481 if(fProcessAll) {
57c1a579 1482 result += Form("All detectors will be processed! \n");
57f50b3c 1483 } else {
1484 result += "Detectors processed by this host: ";
1485 TIter it(&fProcessedDetectors);
1486 TObjString* aDet;
1487 while ((aDet = (TObjString*) it.Next())) {
1488 result += Form("%s ", aDet->String().Data());
1489 }
57c1a579 1490 result += "\n";
b948db8d 1491 }
b948db8d 1492
ff3781ad 1493 result += Form("PP time out = %d - DCS time out = %d - max PP mem size = %d KB - max retries = %d "
fb40ead4 1494 "- DIM trigger waiting timeout = %d\n",
ff3781ad 1495 fPPTimeOut, fDCSTimeOut, fPPMaxMem, fMaxRetries, fTriggerWait);
fb40ead4 1496 result += Form("FLAGS: keepDCSMap = %d - keepTempFolder = %d - SendMail = %d \n",
1497 fKeepDCSMap, fKeepTempFolder, fSendMail);
1498 const TObjArray* shuttleAdmins = GetAdmins(kGlobal);
1499 if (shuttleAdmins->GetEntries() != 0)
1500 {
1501 result += "SHUTTLE administrator(s): ";
1502 TIter it(shuttleAdmins);
1503 TObjString* anAdmin;
1504 while ((anAdmin = (TObjString*) it.Next()))
1505 {
1506 result += Form("%s ", anAdmin->String().Data());
1507 }
1508 result += "\n";
1509 }
1510 const TObjArray* amandaAdmins = GetAdmins(kAmanda);
1511 if (amandaAdmins->GetEntries() != 0)
1512 {
1513 result += "Amanda server administrator(s): ";
1514 TIter it(amandaAdmins);
1515 TObjString* anAdmin;
1516 while ((anAdmin = (TObjString*) it.Next()))
1517 {
1518 result += Form("%s ", anAdmin->String().Data());
1519 }
1520 result += "\n\n";
1521 }
57c1a579 1522 result += "------------------------------------------------------\n";
2bb7b766 1523
57c1a579 1524 result += Form("Logbook Configuration \n\n \tHost: %s:%d; \tUser: %s; ",
fc5a4708 1525 fDAQlbHost.Data(), fDAQlbPort, fDAQlbUser.Data());
b948db8d 1526
b832ec02 1527 result += Form("\tDB: %s; \tTables: %s, %s, %s\n",
441b0e9c 1528 fDAQlbDB.Data(), fDAQlbTable.Data(), fShuttlelbTable.Data(), fRunTypelbTable.Data());
2c15234c 1529
a5ecdb19 1530 result += Form("Terminate file path: %s\n", fTerminateFilePath.Data());
1531
57f50b3c 1532 result += "\n\n";
fb40ead4 1533
57c1a579 1534 result += "------------------------------------------------------\n";
1535 result += "FXS configuration\n\n";
1536
57f50b3c 1537 for(int iSys=0;iSys<3;iSys++){
57c1a579 1538 result += Form("*** %s ***\n", AliShuttleInterface::GetSystemName(iSys));
fc5a4708 1539 result += Form("\tDB host: %s:%d; \tUser: %s; \tName: %s; \tTable: %s\n",
1540 fFXSdbHost[iSys].Data(), fFXSdbPort[iSys], fFXSdbUser[iSys].Data(),
2c15234c 1541 fFXSdbName[iSys].Data(), fFXSdbTable[iSys].Data());
fb40ead4 1542 result += Form("\tFXS host: %s:%d; \tUser: %s\n", fFXSHost[iSys].Data(), fFXSPort[iSys],
fc5a4708 1543 fFXSUser[iSys].Data());
fb40ead4 1544 const TObjArray* fxsAdmins = GetAdmins(iSys);
1545 if (fxsAdmins->GetEntries() != 0)
1546 {
1547 result += "\tAdministrator(s): ";
1548 TIter it(fxsAdmins);
1549 TObjString* anAdmin;
1550 while ((anAdmin = (TObjString*) it.Next()))
1551 {
1552 result += Form("%s ", anAdmin->String().Data());
1553 }
1554 result += "\n\n";
1555 }
57f50b3c 1556 }
b948db8d 1557
b832ec02 1558 result += "------------------------------------------------------\n";
1559 result += "MonaLisa configuration\n\n";
1560
1561 result += Form("\tHost: %s; \tTable name: %s",
1562 fMonitorHost.Data(), fMonitorTable.Data());
1563
1564 result += "\n\n";
fb40ead4 1565
36c99a6a 1566 TString optStr(option);
1567
57c1a579 1568 result += "------------------------------------------------------\n";
1569 result += "Detector-specific configuration\n\n";
1d172743 1570
73abe331 1571 TIter iter(fDetectorMap.GetTable());
1d172743 1572 TPair* aPair = 0;
1573
73abe331 1574 while ((aPair = (TPair*) iter.Next())) {
1d172743 1575 AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) aPair->Value();
1576 if (optStr != "" && !optStr.Contains(aHolder->GetDetector()) &&
1577 optStr.CompareTo("uncompact",TString::kIgnoreCase) != 0 )
36c99a6a 1578 continue;
1d172743 1579
57c1a579 1580 result += Form("*** %s *** \n", aHolder->GetDetector());
1581
1582 const TObjArray* responsibles = aHolder->GetResponsibles();
1583 if (responsibles->GetEntries() != 0)
1584 {
1585 result += "\tDetector responsible(s): ";
1586 TIter it(responsibles);
1587 TObjString* aResponsible;
1588 while ((aResponsible = (TObjString*) it.Next()))
1589 {
1590 result += Form("%s ", aResponsible->String().Data());
1591 }
1592 result += "\n";
1593 }
1594
1d172743 1595 result += Form("\tStrict run ordering: %s \n\n", aHolder->StrictRunOrder() ? "YES" : "NO");
1596
1597 const TObjArray* dcsConfig = aHolder->GetDCSConfig();
1598
1599 AliShuttleDCSConfigHolder* dcsHolder = 0;
1600 TIter dcsIter(dcsConfig);
1601 Int_t count=0;
1602 while ((dcsHolder = dynamic_cast<AliShuttleDCSConfigHolder*> (dcsIter.Next())))
be48e3ea 1603 {
542b6cc8 1604 result += Form("\tAmanda server [%d]: %s:%d - MultiSplit = %d\n", count,
1605 dcsHolder->GetDCSHost(), dcsHolder->GetDCSPort(), dcsHolder->GetMultiSplit());
57f50b3c 1606
1d172743 1607 const TObjArray* aliases = 0;
1608 if (optStr.Contains("uncompact",TString::kIgnoreCase))
1609 {
1610 aliases = dcsHolder->GetDCSAliases();
1611 } else {
1612 aliases = dcsHolder->GetCompactDCSAliases();
1613 }
36c99a6a 1614
1d172743 1615 if (aliases->GetEntries() != 0)
2c15234c 1616 {
1d172743 1617 result += Form("\tDCS Aliases [%d]: ", count);
1618 TIter it(aliases);
1619 TObjString* anAlias;
1620 while ((anAlias = (TObjString*) it.Next()))
1621 {
1622 result += Form("%s ", anAlias->String().Data());
1623 }
1624 result += "\n";
2c15234c 1625 }
57f50b3c 1626
1d172743 1627 const TObjArray* dataPoints = 0;
1628 if (optStr.Contains("uncompact",TString::kIgnoreCase))
1629 {
1630 dataPoints = dcsHolder->GetDCSDataPoints();
1631 } else {
1632 dataPoints = dcsHolder->GetCompactDCSDataPoints();
2c15234c 1633 }
1d172743 1634 if (dataPoints->GetEntries() != 0)
1635 {
1636 result += Form("\tDCS Data Points [%d]: ", count);
1637 TIter it(dataPoints);
1638 TObjString* aDataPoint;
1639 while ((aDataPoint = (TObjString*) it.Next())) {
1640 result += Form("%s ", aDataPoint->String().Data());
1641 }
2c15234c 1642 result += "\n";
1d172743 1643 }
1644 count++;
1645 result += "\n";
2c15234c 1646 }
73abe331 1647 }
57f50b3c 1648 if(!fIsValid) result += "\n\n********** !!!!! Configuration is INVALID !!!!! **********\n";
1649
73abe331 1650 AliInfo(result);
1651}