]> git.uio.no Git - u/mrichter/AliRoot.git/blame - SHUTTLE/AliShuttleConfig.cxx
Implementation of Shuttle access to HLT FXS and database
[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$
fc5a4708 18Revision 1.13 2006/12/07 08:51:26 jgrosseo
19update (alberto):
20table, db names in ldap configuration
21added GRP preprocessor
22DCS data can also be retrieved by data point
23
2c15234c 24Revision 1.12 2006/11/16 16:16:48 jgrosseo
25introducing strict run ordering flag
26removed giving preprocessor name to preprocessor, they have to know their name themselves ;-)
27
be48e3ea 28Revision 1.11 2006/11/06 14:23:04 jgrosseo
29major update (Alberto)
30o) reading of run parameters from the logbook
31o) online offline naming conversion
32o) standalone DCSclient package
33
eba76848 34Revision 1.10 2006/10/20 15:22:59 jgrosseo
35o) Adding time out to the execution of the preprocessors: The Shuttle forks and the parent process monitors the child
36o) Merging Collect, CollectAll, CollectNew function
37o) Removing implementation of empty copy constructors (declaration still there!)
38
cb343cfd 39Revision 1.9 2006/10/02 16:38:39 jgrosseo
40update (alberto):
41fixed memory leaks
42storing of objects that failed to be stored to the grid before
43interfacing of shuttle status table in daq system
44
2bb7b766 45Revision 1.8 2006/08/15 10:50:00 jgrosseo
46effc++ corrections (alberto)
47
4f0ab988 48Revision 1.7 2006/07/20 09:54:40 jgrosseo
49introducing status management: The processing per subdetector is divided into several steps,
50after each step the status is stored on disk. If the system crashes in any of the steps the Shuttle
51can keep track of the number of failures and skips further processing after a certain threshold is
52exceeded. These thresholds can be configured in LDAP.
53
5164a766 54Revision 1.6 2006/07/19 10:09:55 jgrosseo
55new configuration, accesst to DAQ FES (Alberto)
56
57f50b3c 57Revision 1.5 2006/07/10 13:01:41 jgrosseo
58enhanced storing of last sucessfully processed run (alberto)
59
a7160fe9 60Revision 1.4 2006/06/12 09:11:16 jgrosseo
61coding conventions (Alberto)
62
58bc3020 63Revision 1.3 2006/06/06 14:26:40 jgrosseo
64o) removed files that were moved to STEER
65o) shuttle updated to follow the new interface (Alberto)
66
b948db8d 67Revision 1.7 2006/05/12 09:07:16 colla
6812/05/06
69New configuration complete
70
71Revision 1.2 2006/03/07 07:52:34 hristov
72New version (B.Yordanov)
73
d477ad88 74Revision 1.4 2005/11/19 14:20:31 byordano
75logbook config added to AliShuttleConfig
76
77Revision 1.3 2005/11/17 19:24:25 byordano
78TList changed to TObjArray in AliShuttleConfig
79
80Revision 1.2 2005/11/17 14:43:23 byordano
81import to local CVS
82
83Revision 1.1.1.1 2005/10/28 07:33:58 hristov
84Initial import as subdirectory in AliRoot
85
73abe331 86Revision 1.1.1.1 2005/09/12 22:11:40 byordano
87SHUTTLE package
88
89Revision 1.3 2005/08/30 09:13:02 byordano
90some docs added
91
92*/
93
94
95//
96// This class keeps the AliShuttle configuration.
97// It reads the configuration for LDAP server.
98// For every child entry in basedn which has schema type 'shuttleConfig'
99// it creates a detector configuration. This configuration includes:
100// DCS server host and port and the set of aliases for which data from
101// will be retrieved (used by AliShuttle).
102//
103
104
105#include "AliShuttleConfig.h"
57f50b3c 106#include "AliShuttleInterface.h"
73abe331 107
108#include "AliLog.h"
109
b948db8d 110#include <TSystem.h>
73abe331 111#include <TObjString.h>
112#include <TLDAPResult.h>
113#include <TLDAPEntry.h>
114#include <TLDAPAttribute.h>
115
57f50b3c 116
58bc3020 117AliShuttleConfig::AliShuttleConfigHolder::AliShuttleConfigHolder(const TLDAPEntry* entry):
57f50b3c 118fDetector(""),
119fDCSHost(""),
120fDCSPort(0),
fc5a4708 121fDCSAliases(0),
122fDCSDataPoints(0),
57f50b3c 123fIsValid(kFALSE),
be48e3ea 124fSkipDCSQuery(kFALSE),
125fStrictRunOrder(kFALSE)
73abe331 126{
58bc3020 127// constructor of the shuttle configuration holder
128
73abe331 129 TLDAPAttribute* anAttribute;
2bb7b766 130 fDCSAliases = new TObjArray();
131 fDCSAliases->SetOwner(1);
2c15234c 132 fDCSDataPoints = new TObjArray();
133 fDCSDataPoints->SetOwner(1);
57f50b3c 134
135 anAttribute = entry->GetAttribute("det"); // MUST
2c15234c 136 if (!anAttribute)
137 {
138 AliError(Form("Invalid configuration! No \"det\" attribute!"));
139 return;
140 }
73abe331 141 fDetector = anAttribute->GetValue();
73abe331 142
be48e3ea 143 anAttribute = entry->GetAttribute("StrictRunOrder"); // MAY
144 if (!anAttribute)
145 {
146 AliWarning(Form("%s did not set StrictRunOrder flag - the default is FALSE",
147 fDetector.Data()));
148 } else {
149 TString strictRunStr = anAttribute->GetValue();
150 if (!(strictRunStr == "0" || strictRunStr == "1"))
151 {
152 AliError("Invalid configuration! StrictRunOrder flag must be 0 or 1!");
153 return;
154 }
155 fStrictRunOrder = (Bool_t) strictRunStr.Atoi();
156 }
157
57f50b3c 158 anAttribute = entry->GetAttribute("DCSHost"); // MAY
2c15234c 159 if (!anAttribute)
160 {
57f50b3c 161 AliWarning(
162 Form("%s has not DCS host entry - Shuttle will skip DCS data query!",
163 fDetector.Data()));
164 fIsValid = kTRUE;
165 fSkipDCSQuery = kTRUE;
73abe331 166 return;
167 }
57f50b3c 168
b948db8d 169 fDCSHost = anAttribute->GetValue();
73abe331 170
57f50b3c 171 anAttribute = entry->GetAttribute("DCSPort"); // MAY
2c15234c 172 if (!anAttribute)
173 {
57f50b3c 174 AliError(Form("Invalid configuration! %s has DCS Host but no port number!",
175 fDetector.Data()));
73abe331 176 return;
177 }
178 TString portStr = anAttribute->GetValue();
b948db8d 179 fDCSPort = portStr.Atoi();
73abe331 180
2c15234c 181 anAttribute = entry->GetAttribute("DCSalias"); // MAY
182 if (anAttribute)
183 {
184 const char* anAlias;
185 while ((anAlias = anAttribute->GetValue()))
186 {
187 fDCSAliases->AddLast(new TObjString(anAlias));
188 }
73abe331 189 }
57f50b3c 190
2c15234c 191 anAttribute = entry->GetAttribute("DCSdatapoint"); // MAY
192 if (anAttribute)
193 {
194 const char* aDataPoint;
195 while ((aDataPoint = anAttribute->GetValue()))
196 {
197 fDCSDataPoints->AddLast(new TObjString(aDataPoint));
198 }
b948db8d 199 }
200
73abe331 201 fIsValid = kTRUE;
57f50b3c 202
203
73abe331 204}
205
a7160fe9 206//______________________________________________________________________________________________
207AliShuttleConfig::AliShuttleConfigHolder::~AliShuttleConfigHolder()
58bc3020 208{
209// destructor of the shuttle configuration holder
210
2bb7b766 211 delete fDCSAliases;
2c15234c 212 delete fDCSDataPoints;
73abe331 213}
214
215ClassImp(AliShuttleConfig)
216
a7160fe9 217//______________________________________________________________________________________________
218AliShuttleConfig::AliShuttleConfig(const char* host, Int_t port,
73abe331 219 const char* binddn, const char* password, const char* basedn):
b948db8d 220 fIsValid(kFALSE),
fc5a4708 221 fDAQlbHost(""), fDAQlbPort(), fDAQlbUser(""), fDAQlbPass(""),
222 fDAQlbDB(""), fDAQlbTable(""),
cb343cfd 223 fMaxRetries(0), fPPTimeOut(0), fDetectorMap(), fDetectorList(),
2bb7b766 224 fShuttleInstanceHost(""), fProcessedDetectors(), fProcessAll(kFALSE)
73abe331 225{
226 //
227 // host: ldap server host
228 // port: ldap server port
229 // binddn: binddn used for ldap binding (simple bind is used!).
230 // password: password for binddn
b948db8d 231 // basedn: this is basedn whose childeren entries which have
73abe331 232 // (objectClass=shuttleConfig) will be used as detector configurations.
233 //
234
2bb7b766 235 fDetectorMap.SetOwner();
236 fDetectorList.SetOwner(0); //fDetectorList and fDetectorMap share the same object!
237 fProcessedDetectors.SetOwner();
238
b948db8d 239 TLDAPServer aServer(host, port, binddn, password, 3);
57f50b3c 240
73abe331 241 if (!aServer.IsConnected()) {
2bb7b766 242 AliError(Form("Can't connect to ldap server %s:%d",
73abe331 243 host, port));
244 return;
245 }
246
b948db8d 247 // reads configuration for the shuttle running on this machine
2bb7b766 248
b948db8d 249 fShuttleInstanceHost = gSystem->HostName();
2bb7b766 250 TString queryFilter = Form("(ShuttleHost=%s)", fShuttleInstanceHost.Data());
251
252 TLDAPResult* aResult = aServer.Search(basedn, LDAP_SCOPE_ONELEVEL, queryFilter.Data());
b948db8d 253
73abe331 254 if (!aResult) {
255 AliError(Form("Can't find configuration with base DN: %s",
256 basedn));
257 return;
258 }
b948db8d 259
260 if (aResult->GetCount() == 0) {
57f50b3c 261 AliError(Form("No Shuttle instance for host = %s!",
262 fShuttleInstanceHost.Data()));
b948db8d 263 AliError(Form("All detectors will be processed."));
264 fProcessAll=kTRUE;
265 }
266
267 if (aResult->GetCount() > 1) {
57f50b3c 268 AliError(Form("More than one Shuttle instance for host %s!",
269 fShuttleInstanceHost.Data()));
2bb7b766 270 delete aResult;
b948db8d 271 return;
272 }
57f50b3c 273
2bb7b766 274 TLDAPEntry* anEntry = 0;
275 TLDAPAttribute* anAttribute = 0;
b948db8d 276
277 if(!fProcessAll){
278 anEntry = aResult->GetNext();
279 anAttribute = anEntry->GetAttribute("detectors");
280 const char *detName;
281 while((detName = anAttribute->GetValue())){
282 TObjString *objDet= new TObjString(detName);
283 fProcessedDetectors.Add(objDet);
284 }
285 }
286
2bb7b766 287 delete anEntry; delete aResult;
288
57f50b3c 289 // Detector configuration (DCS Archive DB settings)
290
2bb7b766 291 aResult = aServer.Search(basedn, LDAP_SCOPE_ONELEVEL, "(objectClass=AliShuttleDetector)");
b948db8d 292 if (!aResult) {
2bb7b766 293 AliError(Form("Can't find configuration with base DN: %s", basedn));
b948db8d 294 return;
295 }
296
57f50b3c 297
73abe331 298 while ((anEntry = aResult->GetNext())) {
58bc3020 299 AliShuttleConfigHolder* aHolder = new AliShuttleConfigHolder(anEntry);
73abe331 300 delete anEntry;
301
302 if (!aHolder->IsValid()) {
57f50b3c 303 AliError("Detector configuration error!");
73abe331 304 delete aHolder;
2bb7b766 305 delete aResult;
57f50b3c 306 return;
73abe331 307 }
308
309 TObjString* detStr = new TObjString(aHolder->GetDetector());
310 fDetectorMap.Add(detStr, aHolder);
d477ad88 311 fDetectorList.AddLast(detStr);
57f50b3c 312 }
313
73abe331 314 delete aResult;
315
57f50b3c 316 // Global configuration (DAQ logbook)
d477ad88 317
318 aResult = aServer.Search(basedn, LDAP_SCOPE_ONELEVEL,
b948db8d 319 "(objectClass=AliShuttleGlobalConfig)");
d477ad88 320 if (!aResult) {
321 AliError(Form("Can't find configuration with base DN: %s",
322 basedn));
323 return;
324 }
325
326 if (aResult->GetCount() == 0) {
b948db8d 327 AliError("Can't find DAQ logbook configuration!");
2bb7b766 328 delete aResult;
d477ad88 329 return;
330 }
331
332 if (aResult->GetCount() > 1) {
b948db8d 333 AliError("More than one DAQ logbook configuration found!");
2bb7b766 334 delete aResult;
d477ad88 335 return;
336 }
337
338 anEntry = aResult->GetNext();
57f50b3c 339
b948db8d 340 anAttribute = anEntry->GetAttribute("DAQLogbookHost");
d477ad88 341 if (!anAttribute) {
b948db8d 342 AliError("Can't find DAQLogbookHost attribute!");
2bb7b766 343 delete anEntry; delete aResult;
d477ad88 344 return;
345 }
57f50b3c 346 fDAQlbHost = anAttribute->GetValue();
d477ad88 347
fc5a4708 348 anAttribute = anEntry->GetAttribute("DAQLogbookPort"); // MAY
349 if (anAttribute)
350 {
351 fDAQlbPort = ((TString) anAttribute->GetValue()).Atoi();
352 } else {
353 fDAQlbPort = 3306; // mysql
354 }
355
b948db8d 356 anAttribute = anEntry->GetAttribute("DAQLogbookUser");
d477ad88 357 if (!anAttribute) {
b948db8d 358 AliError("Can't find DAQLogbookUser attribute!");
2bb7b766 359 delete aResult; delete anEntry;
d477ad88 360 return;
361 }
57f50b3c 362 fDAQlbUser = anAttribute->GetValue();
363
b948db8d 364 anAttribute = anEntry->GetAttribute("DAQLogbookPassword");
d477ad88 365 if (!anAttribute) {
b948db8d 366 AliError("Can't find DAQLogbookPassword attribute!");
2bb7b766 367 delete aResult; delete anEntry;
d477ad88 368 return;
369 }
57f50b3c 370 fDAQlbPass = anAttribute->GetValue();
d477ad88 371
2c15234c 372 anAttribute = anEntry->GetAttribute("DAQLogbookDB");
373 if (!anAttribute) {
374 AliError("Can't find DAQLogbookDB attribute!");
375 delete aResult; delete anEntry;
376 return;
377 }
378 fDAQlbDB = anAttribute->GetValue();
379
380 anAttribute = anEntry->GetAttribute("DAQLogbookTable");
381 if (!anAttribute) {
382 AliError("Can't find DAQLogbookTable attribute!");
383 delete aResult; delete anEntry;
384 return;
385 }
386 fDAQlbTable = anAttribute->GetValue();
387
388
cb343cfd 389 anAttribute = anEntry->GetAttribute("MaxRetries");
5164a766 390 if (!anAttribute) {
cb343cfd 391 AliError("Can't find MaxRetries attribute!");
2bb7b766 392 delete aResult; delete anEntry;
5164a766 393 return;
394 }
395 TString tmpStr = anAttribute->GetValue();
cb343cfd 396 fMaxRetries = tmpStr.Atoi();
5164a766 397
cb343cfd 398 anAttribute = anEntry->GetAttribute("PPTimeOut");
5164a766 399 if (!anAttribute) {
cb343cfd 400 AliError("Can't find PPTimeOut attribute!");
2bb7b766 401 delete aResult; delete anEntry;
5164a766 402 return;
403 }
404 tmpStr = anAttribute->GetValue();
cb343cfd 405 fPPTimeOut = tmpStr.Atoi();
5164a766 406
2bb7b766 407 delete aResult; delete anEntry;
57f50b3c 408
2c15234c 409 // FXS configuration (FXS logbook and hosts)
57f50b3c 410
57f50b3c 411 for(int iSys=0;iSys<3;iSys++){
eba76848 412 queryFilter = Form("(system=%s)", AliShuttleInterface::GetSystemName(iSys));
57f50b3c 413 aResult = aServer.Search(basedn, LDAP_SCOPE_ONELEVEL, queryFilter.Data());
414 if (!aResult) {
415 AliError(Form("Can't find configuration for system: %s",
eba76848 416 AliShuttleInterface::GetSystemName(iSys)));
57f50b3c 417 return;
418 }
419
420 if (aResult->GetCount() != 1 ) {
2c15234c 421 AliError("Error in FXS configuration!");
2bb7b766 422 delete aResult;
57f50b3c 423 return;
424 }
425
426 anEntry = aResult->GetNext();
427
2c15234c 428 anAttribute = anEntry->GetAttribute("DBHost");
57f50b3c 429 if (!anAttribute) {
fc5a4708 430 AliError(Form ("Can't find DBHost attribute for %s!!",
eba76848 431 AliShuttleInterface::GetSystemName(iSys)));
2bb7b766 432 delete aResult; delete anEntry;
57f50b3c 433 return;
434 }
2c15234c 435 fFXSdbHost[iSys] = anAttribute->GetValue();
57f50b3c 436
fc5a4708 437 anAttribute = anEntry->GetAttribute("DBPort"); // MAY
438 if (anAttribute)
439 {
440 fFXSdbPort[iSys] = ((TString) anAttribute->GetValue()).Atoi();
441 } else {
442 fFXSdbPort[iSys] = 3306; // mysql
443 }
444
2c15234c 445 anAttribute = anEntry->GetAttribute("DBUser");
57f50b3c 446 if (!anAttribute) {
2c15234c 447 AliError(Form ("Can't find DBUser attribute for %s!!",
eba76848 448 AliShuttleInterface::GetSystemName(iSys)));
2bb7b766 449 delete aResult; delete anEntry;
57f50b3c 450 return;
451 }
2c15234c 452 fFXSdbUser[iSys] = anAttribute->GetValue();
57f50b3c 453
2c15234c 454 anAttribute = anEntry->GetAttribute("DBPassword");
57f50b3c 455 if (!anAttribute) {
2c15234c 456 AliError(Form ("Can't find DBPassword attribute for %s!!",
eba76848 457 AliShuttleInterface::GetSystemName(iSys)));
2bb7b766 458 delete aResult; delete anEntry;
57f50b3c 459 return;
460 }
2c15234c 461 fFXSdbPass[iSys] = anAttribute->GetValue();
462
463 anAttribute = anEntry->GetAttribute("DBName");
464 if (!anAttribute) {
465 AliError(Form ("Can't find DBName attribute for %s!!",
466 AliShuttleInterface::GetSystemName(iSys)));
467 delete aResult; delete anEntry;
468 return;
469 }
470
471 fFXSdbName[iSys] = anAttribute->GetValue();
472 anAttribute = anEntry->GetAttribute("DBTable");
473 if (!anAttribute) {
474 AliError(Form ("Can't find DBTable attribute for %s!!",
475 AliShuttleInterface::GetSystemName(iSys)));
476 delete aResult; delete anEntry;
477 return;
478 }
479 fFXSdbTable[iSys] = anAttribute->GetValue();
57f50b3c 480
481 anAttribute = anEntry->GetAttribute("FSHost");
482 if (!anAttribute) {
483 AliError(Form ("Can't find FSHost attribute for %s!!",
eba76848 484 AliShuttleInterface::GetSystemName(iSys)));
2bb7b766 485 delete aResult; delete anEntry;
57f50b3c 486 return;
487 }
2c15234c 488 fFXSHost[iSys] = anAttribute->GetValue();
57f50b3c 489
fc5a4708 490 anAttribute = anEntry->GetAttribute("FSPort"); // MAY
491 if (anAttribute)
492 {
493 fFXSPort[iSys] = ((TString) anAttribute->GetValue()).Atoi();
494 } else {
495 fFXSPort[iSys] = 22; // scp port number
496 }
497
57f50b3c 498 anAttribute = anEntry->GetAttribute("FSUser");
499 if (!anAttribute) {
500 AliError(Form ("Can't find FSUser attribute for %s!!",
eba76848 501 AliShuttleInterface::GetSystemName(iSys)));
2bb7b766 502 delete aResult; delete anEntry;
57f50b3c 503 return;
504 }
2c15234c 505 fFXSUser[iSys] = anAttribute->GetValue();
57f50b3c 506
507 anAttribute = anEntry->GetAttribute("FSPassword");
2c15234c 508 if (anAttribute) fFXSPass[iSys] = anAttribute->GetValue();
57f50b3c 509
2bb7b766 510 delete aResult; delete anEntry;
57f50b3c 511 }
512
73abe331 513 fIsValid = kTRUE;
514}
515
a7160fe9 516//______________________________________________________________________________________________
517AliShuttleConfig::~AliShuttleConfig()
58bc3020 518{
519// destructor
520
73abe331 521 fDetectorMap.DeleteAll();
2bb7b766 522 fDetectorList.Clear();
523 fProcessedDetectors.Delete();
73abe331 524}
525
a7160fe9 526//______________________________________________________________________________________________
527const TObjArray* AliShuttleConfig::GetDetectors() const
58bc3020 528{
73abe331 529 //
530 // returns collection of TObjString which contains the name
531 // of every detector which is in the configuration.
532 //
533
534 return &fDetectorList;
535}
536
a7160fe9 537//______________________________________________________________________________________________
538Bool_t AliShuttleConfig::HasDetector(const char* detector) const
58bc3020 539{
73abe331 540 //
541 // checks for paricular detector in the configuration.
542 //
543 return fDetectorMap.GetValue(detector) != NULL;
544}
545
a7160fe9 546//______________________________________________________________________________________________
547const char* AliShuttleConfig::GetDCSHost(const char* detector) const
58bc3020 548{
73abe331 549 //
550 // returns DCS server host used by particular detector
551 //
552
58bc3020 553 AliShuttleConfigHolder* aHolder = (AliShuttleConfigHolder*) fDetectorMap.GetValue(detector);
73abe331 554 if (!aHolder) {
555 AliError(Form("There isn't configuration for detector: %s",
556 detector));
557 return NULL;
558 }
559
b948db8d 560 return aHolder->GetDCSHost();
73abe331 561}
562
a7160fe9 563//______________________________________________________________________________________________
564Int_t AliShuttleConfig::GetDCSPort(const char* detector) const
58bc3020 565{
73abe331 566 //
567 // returns DCS server port used by particular detector
568 //
569
570
58bc3020 571 AliShuttleConfigHolder* aHolder = (AliShuttleConfigHolder*) fDetectorMap.GetValue(detector);
73abe331 572 if (!aHolder) {
573 AliError(Form("There isn't configuration for detector: %s",
574 detector));
575 return 0;
576 }
577
b948db8d 578 return aHolder->GetDCSPort();
73abe331 579}
580
a7160fe9 581//______________________________________________________________________________________________
582const TObjArray* AliShuttleConfig::GetDCSAliases(const char* detector) const
58bc3020 583{
73abe331 584 //
585 // returns collection of TObjString which represents the set of aliases
586 // which used for data retrieval for particular detector
587 //
588
58bc3020 589 AliShuttleConfigHolder* aHolder = (AliShuttleConfigHolder*) fDetectorMap.GetValue(detector);
73abe331 590 if (!aHolder) {
591 AliError(Form("There isn't configuration for detector: %s",
592 detector));
593 return NULL;
594 }
595
b948db8d 596 return aHolder->GetDCSAliases();
597}
598
2c15234c 599//______________________________________________________________________________________________
600const TObjArray* AliShuttleConfig::GetDCSDataPoints(const char* detector) const
601{
602 //
603 // returns collection of TObjString which represents the set of aliases
604 // which used for data retrieval for particular detector
605 //
606
607 AliShuttleConfigHolder* aHolder = (AliShuttleConfigHolder*) fDetectorMap.GetValue(detector);
608 if (!aHolder) {
609 AliError(Form("There isn't configuration for detector: %s",
610 detector));
611 return NULL;
612 }
613
614 return aHolder->GetDCSDataPoints();
615}
616
a7160fe9 617//______________________________________________________________________________________________
618Bool_t AliShuttleConfig::HostProcessDetector(const char* detector) const
58bc3020 619{
b948db8d 620 // return TRUE if detector is handled by host or if fProcessAll is TRUE
621
622 if(fProcessAll) return kTRUE;
623 TIter iter(&fProcessedDetectors);
624 TObjString* detName;
625 while((detName = (TObjString*) iter.Next())){
626 if(detName->String() == detector) return kTRUE;
627 }
628 return kFALSE;
73abe331 629}
630
be48e3ea 631//______________________________________________________________________________________________
632Bool_t AliShuttleConfig::StrictRunOrder(const char* detector) const
633{
634 // return TRUE if detector wants strict run ordering of stored data
635
636 AliShuttleConfigHolder* aHolder = (AliShuttleConfigHolder*) fDetectorMap.GetValue(detector);
637 if (!aHolder)
638 {
639 AliError(Form("There isn't configuration for detector: %s",
640 detector));
641 return kTRUE;
642 }
643
644 return aHolder->StrictRunOrder();
645}
646
a7160fe9 647//______________________________________________________________________________________________
57f50b3c 648void AliShuttleConfig::Print(Option_t* /*option*/) const
58bc3020 649{
650// print configuration
73abe331 651
652 TString result;
653 result += '\n';
d477ad88 654
57f50b3c 655 result += Form("\nShuttle running on %s \n\n", fShuttleInstanceHost.Data());
656
657 if(fProcessAll) {
658 result += Form("All detectors will be processed! \n\n");
659 } else {
660 result += "Detectors processed by this host: ";
661 TIter it(&fProcessedDetectors);
662 TObjString* aDet;
663 while ((aDet = (TObjString*) it.Next())) {
664 result += Form("%s ", aDet->String().Data());
665 }
666 result += "\n\n";
b948db8d 667 }
b948db8d 668
cb343cfd 669 result += Form("PP time out = %d - Max total retries = %d\n\n", fPPTimeOut, fMaxRetries);
2bb7b766 670
fc5a4708 671 result += Form("DAQ Logbook Configuration \n \tHost: %s:%d; \tUser: %s; ",
672 fDAQlbHost.Data(), fDAQlbPort, fDAQlbUser.Data());
b948db8d 673
2c15234c 674// result += "Password: ";
675// result.Append('*', fDAQlbPass.Length());
676 result += Form("\tDB: %s; \tTable: %s",
677 fDAQlbDB.Data(), fDAQlbTable.Data());
678
57f50b3c 679 result += "\n\n";
680
681 for(int iSys=0;iSys<3;iSys++){
2c15234c 682 result += Form("FXS Configuration for %s system\n", AliShuttleInterface::GetSystemName(iSys));
fc5a4708 683 result += Form("\tDB host: %s:%d; \tUser: %s; \tName: %s; \tTable: %s\n",
684 fFXSdbHost[iSys].Data(), fFXSdbPort[iSys], fFXSdbUser[iSys].Data(),
2c15234c 685 fFXSdbName[iSys].Data(), fFXSdbTable[iSys].Data());
686 // result += Form("DB Password:",fFXSdbPass[iSys].Data());
fc5a4708 687 result += Form("\tFXS host: %s:%d; \tUser: %s\n\n", fFXSHost[iSys].Data(), fFXSPort[iSys],
688 fFXSUser[iSys].Data());
2c15234c 689 // result += Form("FXS Password:",fFXSPass[iSys].Data());
57f50b3c 690 }
b948db8d 691
73abe331 692 TIter iter(fDetectorMap.GetTable());
693 TPair* aPair;
694 while ((aPair = (TPair*) iter.Next())) {
58bc3020 695 AliShuttleConfigHolder* aHolder = (AliShuttleConfigHolder*) aPair->Value();
be48e3ea 696 result += Form("Detector-specific configuration: *** %s *** \n", aHolder->GetDetector());
697 result += Form("\tStrict run ordering flag: %s \n", aHolder->StrictRunOrder() ? "TRUE" : "FALSE");
698 if(aHolder->SkipDCSQuery())
699 {
2c15234c 700 result += "\n";
be48e3ea 701 continue;
702 }
57f50b3c 703 result += Form("\tAmanda server: %s:%d \n", aHolder->GetDCSHost(), aHolder->GetDCSPort());
704
57f50b3c 705 const TObjArray* aliases = aHolder->GetDCSAliases();
2c15234c 706 if (aliases->GetEntries() != 0)
707 {
708 result += "\tDCS Aliases: ";
709 TIter it(aliases);
710 TObjString* anAlias;
711 while ((anAlias = (TObjString*) it.Next()))
712 {
713 result += Form("%s ", anAlias->String().Data());
714 }
715 result += "\n";
57f50b3c 716 }
717
57f50b3c 718
2c15234c 719 const TObjArray* dataPoints = aHolder->GetDCSDataPoints();
720 if (dataPoints->GetEntries() != 0)
721 {
722 result += "\tDCS Data Points: ";
723 TIter it(dataPoints);
724 TObjString* aDataPoint;
725 while ((aDataPoint = (TObjString*) it.Next())) {
726 result += Form("%s ", aDataPoint->String().Data());
727 }
728 result += "\n";
729 }
730 result += "\n";
731
73abe331 732 }
733
57f50b3c 734 if(!fIsValid) result += "\n\n********** !!!!! Configuration is INVALID !!!!! **********\n";
735
73abe331 736 AliInfo(result);
737}