]> git.uio.no Git - u/mrichter/AliRoot.git/blame - SHUTTLE/AliShuttleConfig.cxx
Removing old files
[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),
57c1a579 123fResponsibles(0),
57f50b3c 124fIsValid(kFALSE),
be48e3ea 125fSkipDCSQuery(kFALSE),
126fStrictRunOrder(kFALSE)
73abe331 127{
58bc3020 128// constructor of the shuttle configuration holder
129
73abe331 130 TLDAPAttribute* anAttribute;
2bb7b766 131 fDCSAliases = new TObjArray();
132 fDCSAliases->SetOwner(1);
2c15234c 133 fDCSDataPoints = new TObjArray();
134 fDCSDataPoints->SetOwner(1);
57c1a579 135 fResponsibles = new TObjArray();
136 fResponsibles->SetOwner(1);
57f50b3c 137
138 anAttribute = entry->GetAttribute("det"); // MUST
2c15234c 139 if (!anAttribute)
140 {
141 AliError(Form("Invalid configuration! No \"det\" attribute!"));
142 return;
143 }
73abe331 144 fDetector = anAttribute->GetValue();
73abe331 145
be48e3ea 146 anAttribute = entry->GetAttribute("StrictRunOrder"); // MAY
147 if (!anAttribute)
148 {
149 AliWarning(Form("%s did not set StrictRunOrder flag - the default is FALSE",
150 fDetector.Data()));
151 } else {
152 TString strictRunStr = anAttribute->GetValue();
153 if (!(strictRunStr == "0" || strictRunStr == "1"))
154 {
155 AliError("Invalid configuration! StrictRunOrder flag must be 0 or 1!");
156 return;
157 }
158 fStrictRunOrder = (Bool_t) strictRunStr.Atoi();
159 }
160
57c1a579 161 anAttribute = entry->GetAttribute("responsible"); // MUST
162 if (!anAttribute)
163 {
164 AliError(Form("Invalid configuration! No \"responsible\" attribute!"));
165 return;
166 }
167 const char* aResponsible;
168 while ((aResponsible = anAttribute->GetValue()))
169 {
170 fResponsibles->AddLast(new TObjString(aResponsible));
171 }
172
57f50b3c 173 anAttribute = entry->GetAttribute("DCSHost"); // MAY
2c15234c 174 if (!anAttribute)
175 {
57c1a579 176 AliDebug(2,
57f50b3c 177 Form("%s has not DCS host entry - Shuttle will skip DCS data query!",
178 fDetector.Data()));
179 fIsValid = kTRUE;
180 fSkipDCSQuery = kTRUE;
73abe331 181 return;
182 }
57f50b3c 183
b948db8d 184 fDCSHost = anAttribute->GetValue();
73abe331 185
57f50b3c 186 anAttribute = entry->GetAttribute("DCSPort"); // MAY
2c15234c 187 if (!anAttribute)
188 {
57f50b3c 189 AliError(Form("Invalid configuration! %s has DCS Host but no port number!",
190 fDetector.Data()));
73abe331 191 return;
192 }
193 TString portStr = anAttribute->GetValue();
b948db8d 194 fDCSPort = portStr.Atoi();
73abe331 195
2c15234c 196 anAttribute = entry->GetAttribute("DCSalias"); // MAY
197 if (anAttribute)
198 {
199 const char* anAlias;
200 while ((anAlias = anAttribute->GetValue()))
201 {
202 fDCSAliases->AddLast(new TObjString(anAlias));
203 }
73abe331 204 }
57f50b3c 205
2c15234c 206 anAttribute = entry->GetAttribute("DCSdatapoint"); // MAY
207 if (anAttribute)
208 {
209 const char* aDataPoint;
210 while ((aDataPoint = anAttribute->GetValue()))
211 {
212 fDCSDataPoints->AddLast(new TObjString(aDataPoint));
213 }
b948db8d 214 }
215
73abe331 216 fIsValid = kTRUE;
217}
218
a7160fe9 219//______________________________________________________________________________________________
220AliShuttleConfig::AliShuttleConfigHolder::~AliShuttleConfigHolder()
58bc3020 221{
222// destructor of the shuttle configuration holder
223
2bb7b766 224 delete fDCSAliases;
2c15234c 225 delete fDCSDataPoints;
57c1a579 226 delete fResponsibles;
73abe331 227}
228
229ClassImp(AliShuttleConfig)
230
a7160fe9 231//______________________________________________________________________________________________
232AliShuttleConfig::AliShuttleConfig(const char* host, Int_t port,
73abe331 233 const char* binddn, const char* password, const char* basedn):
57c1a579 234 fIsValid(kFALSE), fConfigHost(host),
fc5a4708 235 fDAQlbHost(""), fDAQlbPort(), fDAQlbUser(""), fDAQlbPass(""),
236 fDAQlbDB(""), fDAQlbTable(""),
cb343cfd 237 fMaxRetries(0), fPPTimeOut(0), fDetectorMap(), fDetectorList(),
2bb7b766 238 fShuttleInstanceHost(""), fProcessedDetectors(), fProcessAll(kFALSE)
73abe331 239{
240 //
241 // host: ldap server host
242 // port: ldap server port
243 // binddn: binddn used for ldap binding (simple bind is used!).
244 // password: password for binddn
b948db8d 245 // basedn: this is basedn whose childeren entries which have
73abe331 246 // (objectClass=shuttleConfig) will be used as detector configurations.
247 //
248
2bb7b766 249 fDetectorMap.SetOwner();
250 fDetectorList.SetOwner(0); //fDetectorList and fDetectorMap share the same object!
251 fProcessedDetectors.SetOwner();
252
b948db8d 253 TLDAPServer aServer(host, port, binddn, password, 3);
57f50b3c 254
73abe331 255 if (!aServer.IsConnected()) {
2bb7b766 256 AliError(Form("Can't connect to ldap server %s:%d",
73abe331 257 host, port));
258 return;
259 }
260
b948db8d 261 // reads configuration for the shuttle running on this machine
2bb7b766 262
b948db8d 263 fShuttleInstanceHost = gSystem->HostName();
2bb7b766 264 TString queryFilter = Form("(ShuttleHost=%s)", fShuttleInstanceHost.Data());
265
266 TLDAPResult* aResult = aServer.Search(basedn, LDAP_SCOPE_ONELEVEL, queryFilter.Data());
b948db8d 267
73abe331 268 if (!aResult) {
269 AliError(Form("Can't find configuration with base DN: %s",
270 basedn));
271 return;
272 }
b948db8d 273
274 if (aResult->GetCount() == 0) {
57f50b3c 275 AliError(Form("No Shuttle instance for host = %s!",
276 fShuttleInstanceHost.Data()));
b948db8d 277 AliError(Form("All detectors will be processed."));
278 fProcessAll=kTRUE;
279 }
280
281 if (aResult->GetCount() > 1) {
57f50b3c 282 AliError(Form("More than one Shuttle instance for host %s!",
283 fShuttleInstanceHost.Data()));
2bb7b766 284 delete aResult;
b948db8d 285 return;
286 }
57f50b3c 287
2bb7b766 288 TLDAPEntry* anEntry = 0;
289 TLDAPAttribute* anAttribute = 0;
b948db8d 290
291 if(!fProcessAll){
292 anEntry = aResult->GetNext();
293 anAttribute = anEntry->GetAttribute("detectors");
294 const char *detName;
295 while((detName = anAttribute->GetValue())){
296 TObjString *objDet= new TObjString(detName);
297 fProcessedDetectors.Add(objDet);
298 }
299 }
300
2bb7b766 301 delete anEntry; delete aResult;
302
57f50b3c 303 // Detector configuration (DCS Archive DB settings)
304
2bb7b766 305 aResult = aServer.Search(basedn, LDAP_SCOPE_ONELEVEL, "(objectClass=AliShuttleDetector)");
b948db8d 306 if (!aResult) {
2bb7b766 307 AliError(Form("Can't find configuration with base DN: %s", basedn));
b948db8d 308 return;
309 }
310
57f50b3c 311
73abe331 312 while ((anEntry = aResult->GetNext())) {
58bc3020 313 AliShuttleConfigHolder* aHolder = new AliShuttleConfigHolder(anEntry);
73abe331 314 delete anEntry;
315
316 if (!aHolder->IsValid()) {
57f50b3c 317 AliError("Detector configuration error!");
73abe331 318 delete aHolder;
2bb7b766 319 delete aResult;
57f50b3c 320 return;
73abe331 321 }
322
323 TObjString* detStr = new TObjString(aHolder->GetDetector());
324 fDetectorMap.Add(detStr, aHolder);
d477ad88 325 fDetectorList.AddLast(detStr);
57f50b3c 326 }
327
73abe331 328 delete aResult;
329
57f50b3c 330 // Global configuration (DAQ logbook)
d477ad88 331
332 aResult = aServer.Search(basedn, LDAP_SCOPE_ONELEVEL,
b948db8d 333 "(objectClass=AliShuttleGlobalConfig)");
d477ad88 334 if (!aResult) {
335 AliError(Form("Can't find configuration with base DN: %s",
336 basedn));
337 return;
338 }
339
340 if (aResult->GetCount() == 0) {
b948db8d 341 AliError("Can't find DAQ logbook configuration!");
2bb7b766 342 delete aResult;
d477ad88 343 return;
344 }
345
346 if (aResult->GetCount() > 1) {
b948db8d 347 AliError("More than one DAQ logbook configuration found!");
2bb7b766 348 delete aResult;
d477ad88 349 return;
350 }
351
352 anEntry = aResult->GetNext();
57f50b3c 353
b948db8d 354 anAttribute = anEntry->GetAttribute("DAQLogbookHost");
d477ad88 355 if (!anAttribute) {
b948db8d 356 AliError("Can't find DAQLogbookHost attribute!");
2bb7b766 357 delete anEntry; delete aResult;
d477ad88 358 return;
359 }
57f50b3c 360 fDAQlbHost = anAttribute->GetValue();
d477ad88 361
fc5a4708 362 anAttribute = anEntry->GetAttribute("DAQLogbookPort"); // MAY
363 if (anAttribute)
364 {
365 fDAQlbPort = ((TString) anAttribute->GetValue()).Atoi();
366 } else {
367 fDAQlbPort = 3306; // mysql
368 }
369
b948db8d 370 anAttribute = anEntry->GetAttribute("DAQLogbookUser");
d477ad88 371 if (!anAttribute) {
b948db8d 372 AliError("Can't find DAQLogbookUser attribute!");
2bb7b766 373 delete aResult; delete anEntry;
d477ad88 374 return;
375 }
57f50b3c 376 fDAQlbUser = anAttribute->GetValue();
377
b948db8d 378 anAttribute = anEntry->GetAttribute("DAQLogbookPassword");
d477ad88 379 if (!anAttribute) {
b948db8d 380 AliError("Can't find DAQLogbookPassword attribute!");
2bb7b766 381 delete aResult; delete anEntry;
d477ad88 382 return;
383 }
57f50b3c 384 fDAQlbPass = anAttribute->GetValue();
d477ad88 385
2c15234c 386 anAttribute = anEntry->GetAttribute("DAQLogbookDB");
387 if (!anAttribute) {
388 AliError("Can't find DAQLogbookDB attribute!");
389 delete aResult; delete anEntry;
390 return;
391 }
392 fDAQlbDB = anAttribute->GetValue();
393
394 anAttribute = anEntry->GetAttribute("DAQLogbookTable");
395 if (!anAttribute) {
396 AliError("Can't find DAQLogbookTable attribute!");
397 delete aResult; delete anEntry;
398 return;
399 }
400 fDAQlbTable = anAttribute->GetValue();
401
402
cb343cfd 403 anAttribute = anEntry->GetAttribute("MaxRetries");
5164a766 404 if (!anAttribute) {
cb343cfd 405 AliError("Can't find MaxRetries attribute!");
2bb7b766 406 delete aResult; delete anEntry;
5164a766 407 return;
408 }
409 TString tmpStr = anAttribute->GetValue();
cb343cfd 410 fMaxRetries = tmpStr.Atoi();
5164a766 411
cb343cfd 412 anAttribute = anEntry->GetAttribute("PPTimeOut");
5164a766 413 if (!anAttribute) {
cb343cfd 414 AliError("Can't find PPTimeOut attribute!");
2bb7b766 415 delete aResult; delete anEntry;
5164a766 416 return;
417 }
418 tmpStr = anAttribute->GetValue();
cb343cfd 419 fPPTimeOut = tmpStr.Atoi();
5164a766 420
2bb7b766 421 delete aResult; delete anEntry;
57f50b3c 422
2c15234c 423 // FXS configuration (FXS logbook and hosts)
57f50b3c 424
57f50b3c 425 for(int iSys=0;iSys<3;iSys++){
eba76848 426 queryFilter = Form("(system=%s)", AliShuttleInterface::GetSystemName(iSys));
57f50b3c 427 aResult = aServer.Search(basedn, LDAP_SCOPE_ONELEVEL, queryFilter.Data());
428 if (!aResult) {
429 AliError(Form("Can't find configuration for system: %s",
eba76848 430 AliShuttleInterface::GetSystemName(iSys)));
57f50b3c 431 return;
432 }
433
434 if (aResult->GetCount() != 1 ) {
2c15234c 435 AliError("Error in FXS configuration!");
2bb7b766 436 delete aResult;
57f50b3c 437 return;
438 }
439
440 anEntry = aResult->GetNext();
441
2c15234c 442 anAttribute = anEntry->GetAttribute("DBHost");
57f50b3c 443 if (!anAttribute) {
fc5a4708 444 AliError(Form ("Can't find DBHost attribute for %s!!",
eba76848 445 AliShuttleInterface::GetSystemName(iSys)));
2bb7b766 446 delete aResult; delete anEntry;
57f50b3c 447 return;
448 }
2c15234c 449 fFXSdbHost[iSys] = anAttribute->GetValue();
57f50b3c 450
fc5a4708 451 anAttribute = anEntry->GetAttribute("DBPort"); // MAY
452 if (anAttribute)
453 {
454 fFXSdbPort[iSys] = ((TString) anAttribute->GetValue()).Atoi();
455 } else {
456 fFXSdbPort[iSys] = 3306; // mysql
457 }
458
2c15234c 459 anAttribute = anEntry->GetAttribute("DBUser");
57f50b3c 460 if (!anAttribute) {
2c15234c 461 AliError(Form ("Can't find DBUser attribute for %s!!",
eba76848 462 AliShuttleInterface::GetSystemName(iSys)));
2bb7b766 463 delete aResult; delete anEntry;
57f50b3c 464 return;
465 }
2c15234c 466 fFXSdbUser[iSys] = anAttribute->GetValue();
57f50b3c 467
2c15234c 468 anAttribute = anEntry->GetAttribute("DBPassword");
57f50b3c 469 if (!anAttribute) {
2c15234c 470 AliError(Form ("Can't find DBPassword attribute for %s!!",
eba76848 471 AliShuttleInterface::GetSystemName(iSys)));
2bb7b766 472 delete aResult; delete anEntry;
57f50b3c 473 return;
474 }
2c15234c 475 fFXSdbPass[iSys] = anAttribute->GetValue();
476
477 anAttribute = anEntry->GetAttribute("DBName");
478 if (!anAttribute) {
479 AliError(Form ("Can't find DBName attribute for %s!!",
480 AliShuttleInterface::GetSystemName(iSys)));
481 delete aResult; delete anEntry;
482 return;
483 }
484
485 fFXSdbName[iSys] = anAttribute->GetValue();
486 anAttribute = anEntry->GetAttribute("DBTable");
487 if (!anAttribute) {
488 AliError(Form ("Can't find DBTable attribute for %s!!",
489 AliShuttleInterface::GetSystemName(iSys)));
490 delete aResult; delete anEntry;
491 return;
492 }
493 fFXSdbTable[iSys] = anAttribute->GetValue();
57f50b3c 494
495 anAttribute = anEntry->GetAttribute("FSHost");
496 if (!anAttribute) {
497 AliError(Form ("Can't find FSHost attribute for %s!!",
eba76848 498 AliShuttleInterface::GetSystemName(iSys)));
2bb7b766 499 delete aResult; delete anEntry;
57f50b3c 500 return;
501 }
2c15234c 502 fFXSHost[iSys] = anAttribute->GetValue();
57f50b3c 503
fc5a4708 504 anAttribute = anEntry->GetAttribute("FSPort"); // MAY
505 if (anAttribute)
506 {
507 fFXSPort[iSys] = ((TString) anAttribute->GetValue()).Atoi();
508 } else {
509 fFXSPort[iSys] = 22; // scp port number
510 }
511
57f50b3c 512 anAttribute = anEntry->GetAttribute("FSUser");
513 if (!anAttribute) {
514 AliError(Form ("Can't find FSUser attribute for %s!!",
eba76848 515 AliShuttleInterface::GetSystemName(iSys)));
2bb7b766 516 delete aResult; delete anEntry;
57f50b3c 517 return;
518 }
2c15234c 519 fFXSUser[iSys] = anAttribute->GetValue();
57f50b3c 520
521 anAttribute = anEntry->GetAttribute("FSPassword");
2c15234c 522 if (anAttribute) fFXSPass[iSys] = anAttribute->GetValue();
57f50b3c 523
2bb7b766 524 delete aResult; delete anEntry;
57f50b3c 525 }
526
73abe331 527 fIsValid = kTRUE;
528}
529
a7160fe9 530//______________________________________________________________________________________________
531AliShuttleConfig::~AliShuttleConfig()
58bc3020 532{
533// destructor
534
73abe331 535 fDetectorMap.DeleteAll();
2bb7b766 536 fDetectorList.Clear();
537 fProcessedDetectors.Delete();
73abe331 538}
539
a7160fe9 540//______________________________________________________________________________________________
541const TObjArray* AliShuttleConfig::GetDetectors() const
58bc3020 542{
73abe331 543 //
544 // returns collection of TObjString which contains the name
545 // of every detector which is in the configuration.
546 //
547
548 return &fDetectorList;
549}
550
a7160fe9 551//______________________________________________________________________________________________
552Bool_t AliShuttleConfig::HasDetector(const char* detector) const
58bc3020 553{
73abe331 554 //
555 // checks for paricular detector in the configuration.
556 //
557 return fDetectorMap.GetValue(detector) != NULL;
558}
559
a7160fe9 560//______________________________________________________________________________________________
561const char* AliShuttleConfig::GetDCSHost(const char* detector) const
58bc3020 562{
73abe331 563 //
564 // returns DCS server host used by particular detector
565 //
566
58bc3020 567 AliShuttleConfigHolder* aHolder = (AliShuttleConfigHolder*) fDetectorMap.GetValue(detector);
73abe331 568 if (!aHolder) {
569 AliError(Form("There isn't configuration for detector: %s",
570 detector));
571 return NULL;
572 }
573
b948db8d 574 return aHolder->GetDCSHost();
73abe331 575}
576
a7160fe9 577//______________________________________________________________________________________________
578Int_t AliShuttleConfig::GetDCSPort(const char* detector) const
58bc3020 579{
73abe331 580 //
581 // returns DCS server port used by particular detector
582 //
583
584
58bc3020 585 AliShuttleConfigHolder* aHolder = (AliShuttleConfigHolder*) fDetectorMap.GetValue(detector);
73abe331 586 if (!aHolder) {
587 AliError(Form("There isn't configuration for detector: %s",
588 detector));
589 return 0;
590 }
591
b948db8d 592 return aHolder->GetDCSPort();
73abe331 593}
594
a7160fe9 595//______________________________________________________________________________________________
596const TObjArray* AliShuttleConfig::GetDCSAliases(const char* detector) const
58bc3020 597{
73abe331 598 //
599 // returns collection of TObjString which represents the set of aliases
600 // which used for data retrieval for particular detector
601 //
602
58bc3020 603 AliShuttleConfigHolder* aHolder = (AliShuttleConfigHolder*) fDetectorMap.GetValue(detector);
73abe331 604 if (!aHolder) {
605 AliError(Form("There isn't configuration for detector: %s",
606 detector));
607 return NULL;
608 }
609
b948db8d 610 return aHolder->GetDCSAliases();
611}
612
2c15234c 613//______________________________________________________________________________________________
614const TObjArray* AliShuttleConfig::GetDCSDataPoints(const char* detector) const
615{
616 //
617 // returns collection of TObjString which represents the set of aliases
618 // which used for data retrieval for particular detector
619 //
620
621 AliShuttleConfigHolder* aHolder = (AliShuttleConfigHolder*) fDetectorMap.GetValue(detector);
622 if (!aHolder) {
623 AliError(Form("There isn't configuration for detector: %s",
624 detector));
625 return NULL;
626 }
627
628 return aHolder->GetDCSDataPoints();
629}
630
57c1a579 631//______________________________________________________________________________________________
632const TObjArray* AliShuttleConfig::GetResponsibles(const char* detector) const
633{
634 //
635 // returns collection of TObjString which represents the list of mail addresses
636 // of the detector's responsible(s)
637 //
638
639 AliShuttleConfigHolder* aHolder = (AliShuttleConfigHolder*) fDetectorMap.GetValue(detector);
640 if (!aHolder) {
641 AliError(Form("There isn't configuration for detector: %s",
642 detector));
643 return NULL;
644 }
645
646 return aHolder->GetResponsibles();
647}
648
a7160fe9 649//______________________________________________________________________________________________
650Bool_t AliShuttleConfig::HostProcessDetector(const char* detector) const
58bc3020 651{
b948db8d 652 // return TRUE if detector is handled by host or if fProcessAll is TRUE
653
654 if(fProcessAll) return kTRUE;
655 TIter iter(&fProcessedDetectors);
656 TObjString* detName;
657 while((detName = (TObjString*) iter.Next())){
658 if(detName->String() == detector) return kTRUE;
659 }
660 return kFALSE;
73abe331 661}
662
be48e3ea 663//______________________________________________________________________________________________
664Bool_t AliShuttleConfig::StrictRunOrder(const char* detector) const
665{
666 // return TRUE if detector wants strict run ordering of stored data
667
668 AliShuttleConfigHolder* aHolder = (AliShuttleConfigHolder*) fDetectorMap.GetValue(detector);
669 if (!aHolder)
670 {
671 AliError(Form("There isn't configuration for detector: %s",
672 detector));
673 return kTRUE;
674 }
675
676 return aHolder->StrictRunOrder();
677}
678
a7160fe9 679//______________________________________________________________________________________________
57f50b3c 680void AliShuttleConfig::Print(Option_t* /*option*/) const
58bc3020 681{
682// print configuration
73abe331 683
684 TString result;
685 result += '\n';
d477ad88 686
57c1a579 687 result += "####################################################\n";
688 result += Form(" Shuttle configuration from %s \n", fConfigHost.Data());
689 result += "####################################################\n";
690 result += Form("\nShuttle running on %s \n", fShuttleInstanceHost.Data());
57f50b3c 691
692 if(fProcessAll) {
57c1a579 693 result += Form("All detectors will be processed! \n");
57f50b3c 694 } else {
695 result += "Detectors processed by this host: ";
696 TIter it(&fProcessedDetectors);
697 TObjString* aDet;
698 while ((aDet = (TObjString*) it.Next())) {
699 result += Form("%s ", aDet->String().Data());
700 }
57c1a579 701 result += "\n";
b948db8d 702 }
b948db8d 703
cb343cfd 704 result += Form("PP time out = %d - Max total retries = %d\n\n", fPPTimeOut, fMaxRetries);
57c1a579 705 result += "------------------------------------------------------\n";
2bb7b766 706
57c1a579 707 result += Form("Logbook Configuration \n\n \tHost: %s:%d; \tUser: %s; ",
fc5a4708 708 fDAQlbHost.Data(), fDAQlbPort, fDAQlbUser.Data());
b948db8d 709
2c15234c 710// result += "Password: ";
711// result.Append('*', fDAQlbPass.Length());
712 result += Form("\tDB: %s; \tTable: %s",
713 fDAQlbDB.Data(), fDAQlbTable.Data());
714
57f50b3c 715 result += "\n\n";
716
57c1a579 717 result += "------------------------------------------------------\n";
718 result += "FXS configuration\n\n";
719
57f50b3c 720 for(int iSys=0;iSys<3;iSys++){
57c1a579 721 result += Form("*** %s ***\n", AliShuttleInterface::GetSystemName(iSys));
fc5a4708 722 result += Form("\tDB host: %s:%d; \tUser: %s; \tName: %s; \tTable: %s\n",
723 fFXSdbHost[iSys].Data(), fFXSdbPort[iSys], fFXSdbUser[iSys].Data(),
2c15234c 724 fFXSdbName[iSys].Data(), fFXSdbTable[iSys].Data());
725 // result += Form("DB Password:",fFXSdbPass[iSys].Data());
fc5a4708 726 result += Form("\tFXS host: %s:%d; \tUser: %s\n\n", fFXSHost[iSys].Data(), fFXSPort[iSys],
727 fFXSUser[iSys].Data());
2c15234c 728 // result += Form("FXS Password:",fFXSPass[iSys].Data());
57f50b3c 729 }
b948db8d 730
57c1a579 731 result += "------------------------------------------------------\n";
732 result += "Detector-specific configuration\n\n";
73abe331 733 TIter iter(fDetectorMap.GetTable());
734 TPair* aPair;
735 while ((aPair = (TPair*) iter.Next())) {
58bc3020 736 AliShuttleConfigHolder* aHolder = (AliShuttleConfigHolder*) aPair->Value();
57c1a579 737 result += Form("*** %s *** \n", aHolder->GetDetector());
738
739 const TObjArray* responsibles = aHolder->GetResponsibles();
740 if (responsibles->GetEntries() != 0)
741 {
742 result += "\tDetector responsible(s): ";
743 TIter it(responsibles);
744 TObjString* aResponsible;
745 while ((aResponsible = (TObjString*) it.Next()))
746 {
747 result += Form("%s ", aResponsible->String().Data());
748 }
749 result += "\n";
750 }
751
752 result += Form("\tStrict run ordering: %s \n", aHolder->StrictRunOrder() ? "YES" : "NO");
be48e3ea 753 if(aHolder->SkipDCSQuery())
754 {
2c15234c 755 result += "\n";
be48e3ea 756 continue;
757 }
57f50b3c 758 result += Form("\tAmanda server: %s:%d \n", aHolder->GetDCSHost(), aHolder->GetDCSPort());
759
57f50b3c 760 const TObjArray* aliases = aHolder->GetDCSAliases();
2c15234c 761 if (aliases->GetEntries() != 0)
762 {
763 result += "\tDCS Aliases: ";
764 TIter it(aliases);
765 TObjString* anAlias;
766 while ((anAlias = (TObjString*) it.Next()))
767 {
768 result += Form("%s ", anAlias->String().Data());
769 }
770 result += "\n";
57f50b3c 771 }
772
2c15234c 773 const TObjArray* dataPoints = aHolder->GetDCSDataPoints();
774 if (dataPoints->GetEntries() != 0)
775 {
776 result += "\tDCS Data Points: ";
777 TIter it(dataPoints);
778 TObjString* aDataPoint;
779 while ((aDataPoint = (TObjString*) it.Next())) {
780 result += Form("%s ", aDataPoint->String().Data());
781 }
782 result += "\n";
783 }
784 result += "\n";
73abe331 785 }
786
57f50b3c 787 if(!fIsValid) result += "\n\n********** !!!!! Configuration is INVALID !!!!! **********\n";
788
73abe331 789 AliInfo(result);
790}