]>
Commit | Line | Data |
---|---|---|
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$ | |
18 | Revision 1.13 2006/12/07 08:51:26 jgrosseo | |
19 | update (alberto): | |
20 | table, db names in ldap configuration | |
21 | added GRP preprocessor | |
22 | DCS data can also be retrieved by data point | |
23 | ||
24 | Revision 1.12 2006/11/16 16:16:48 jgrosseo | |
25 | introducing strict run ordering flag | |
26 | removed giving preprocessor name to preprocessor, they have to know their name themselves ;-) | |
27 | ||
28 | Revision 1.11 2006/11/06 14:23:04 jgrosseo | |
29 | major update (Alberto) | |
30 | o) reading of run parameters from the logbook | |
31 | o) online offline naming conversion | |
32 | o) standalone DCSclient package | |
33 | ||
34 | Revision 1.10 2006/10/20 15:22:59 jgrosseo | |
35 | o) Adding time out to the execution of the preprocessors: The Shuttle forks and the parent process monitors the child | |
36 | o) Merging Collect, CollectAll, CollectNew function | |
37 | o) Removing implementation of empty copy constructors (declaration still there!) | |
38 | ||
39 | Revision 1.9 2006/10/02 16:38:39 jgrosseo | |
40 | update (alberto): | |
41 | fixed memory leaks | |
42 | storing of objects that failed to be stored to the grid before | |
43 | interfacing of shuttle status table in daq system | |
44 | ||
45 | Revision 1.8 2006/08/15 10:50:00 jgrosseo | |
46 | effc++ corrections (alberto) | |
47 | ||
48 | Revision 1.7 2006/07/20 09:54:40 jgrosseo | |
49 | introducing status management: The processing per subdetector is divided into several steps, | |
50 | after each step the status is stored on disk. If the system crashes in any of the steps the Shuttle | |
51 | can keep track of the number of failures and skips further processing after a certain threshold is | |
52 | exceeded. These thresholds can be configured in LDAP. | |
53 | ||
54 | Revision 1.6 2006/07/19 10:09:55 jgrosseo | |
55 | new configuration, accesst to DAQ FES (Alberto) | |
56 | ||
57 | Revision 1.5 2006/07/10 13:01:41 jgrosseo | |
58 | enhanced storing of last sucessfully processed run (alberto) | |
59 | ||
60 | Revision 1.4 2006/06/12 09:11:16 jgrosseo | |
61 | coding conventions (Alberto) | |
62 | ||
63 | Revision 1.3 2006/06/06 14:26:40 jgrosseo | |
64 | o) removed files that were moved to STEER | |
65 | o) shuttle updated to follow the new interface (Alberto) | |
66 | ||
67 | Revision 1.7 2006/05/12 09:07:16 colla | |
68 | 12/05/06 | |
69 | New configuration complete | |
70 | ||
71 | Revision 1.2 2006/03/07 07:52:34 hristov | |
72 | New version (B.Yordanov) | |
73 | ||
74 | Revision 1.4 2005/11/19 14:20:31 byordano | |
75 | logbook config added to AliShuttleConfig | |
76 | ||
77 | Revision 1.3 2005/11/17 19:24:25 byordano | |
78 | TList changed to TObjArray in AliShuttleConfig | |
79 | ||
80 | Revision 1.2 2005/11/17 14:43:23 byordano | |
81 | import to local CVS | |
82 | ||
83 | Revision 1.1.1.1 2005/10/28 07:33:58 hristov | |
84 | Initial import as subdirectory in AliRoot | |
85 | ||
86 | Revision 1.1.1.1 2005/09/12 22:11:40 byordano | |
87 | SHUTTLE package | |
88 | ||
89 | Revision 1.3 2005/08/30 09:13:02 byordano | |
90 | some 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" | |
106 | #include "AliShuttleInterface.h" | |
107 | ||
108 | #include "AliLog.h" | |
109 | ||
110 | #include <TSystem.h> | |
111 | #include <TObjString.h> | |
112 | #include <TLDAPResult.h> | |
113 | #include <TLDAPEntry.h> | |
114 | #include <TLDAPAttribute.h> | |
115 | ||
116 | ||
117 | AliShuttleConfig::AliShuttleConfigHolder::AliShuttleConfigHolder(const TLDAPEntry* entry): | |
118 | fDetector(""), | |
119 | fDCSHost(""), | |
120 | fDCSPort(0), | |
121 | fDCSAliases(0), | |
122 | fDCSDataPoints(0), | |
123 | fIsValid(kFALSE), | |
124 | fSkipDCSQuery(kFALSE), | |
125 | fStrictRunOrder(kFALSE) | |
126 | { | |
127 | // constructor of the shuttle configuration holder | |
128 | ||
129 | TLDAPAttribute* anAttribute; | |
130 | fDCSAliases = new TObjArray(); | |
131 | fDCSAliases->SetOwner(1); | |
132 | fDCSDataPoints = new TObjArray(); | |
133 | fDCSDataPoints->SetOwner(1); | |
134 | ||
135 | anAttribute = entry->GetAttribute("det"); // MUST | |
136 | if (!anAttribute) | |
137 | { | |
138 | AliError(Form("Invalid configuration! No \"det\" attribute!")); | |
139 | return; | |
140 | } | |
141 | fDetector = anAttribute->GetValue(); | |
142 | ||
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 | ||
158 | anAttribute = entry->GetAttribute("DCSHost"); // MAY | |
159 | if (!anAttribute) | |
160 | { | |
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; | |
166 | return; | |
167 | } | |
168 | ||
169 | fDCSHost = anAttribute->GetValue(); | |
170 | ||
171 | anAttribute = entry->GetAttribute("DCSPort"); // MAY | |
172 | if (!anAttribute) | |
173 | { | |
174 | AliError(Form("Invalid configuration! %s has DCS Host but no port number!", | |
175 | fDetector.Data())); | |
176 | return; | |
177 | } | |
178 | TString portStr = anAttribute->GetValue(); | |
179 | fDCSPort = portStr.Atoi(); | |
180 | ||
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 | } | |
189 | } | |
190 | ||
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 | } | |
199 | } | |
200 | ||
201 | fIsValid = kTRUE; | |
202 | ||
203 | ||
204 | } | |
205 | ||
206 | //______________________________________________________________________________________________ | |
207 | AliShuttleConfig::AliShuttleConfigHolder::~AliShuttleConfigHolder() | |
208 | { | |
209 | // destructor of the shuttle configuration holder | |
210 | ||
211 | delete fDCSAliases; | |
212 | delete fDCSDataPoints; | |
213 | } | |
214 | ||
215 | ClassImp(AliShuttleConfig) | |
216 | ||
217 | //______________________________________________________________________________________________ | |
218 | AliShuttleConfig::AliShuttleConfig(const char* host, Int_t port, | |
219 | const char* binddn, const char* password, const char* basedn): | |
220 | fIsValid(kFALSE), | |
221 | fDAQlbHost(""), fDAQlbPort(), fDAQlbUser(""), fDAQlbPass(""), | |
222 | fDAQlbDB(""), fDAQlbTable(""), | |
223 | fMaxRetries(0), fPPTimeOut(0), fDetectorMap(), fDetectorList(), | |
224 | fShuttleInstanceHost(""), fProcessedDetectors(), fProcessAll(kFALSE) | |
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 | |
231 | // basedn: this is basedn whose childeren entries which have | |
232 | // (objectClass=shuttleConfig) will be used as detector configurations. | |
233 | // | |
234 | ||
235 | fDetectorMap.SetOwner(); | |
236 | fDetectorList.SetOwner(0); //fDetectorList and fDetectorMap share the same object! | |
237 | fProcessedDetectors.SetOwner(); | |
238 | ||
239 | TLDAPServer aServer(host, port, binddn, password, 3); | |
240 | ||
241 | if (!aServer.IsConnected()) { | |
242 | AliError(Form("Can't connect to ldap server %s:%d", | |
243 | host, port)); | |
244 | return; | |
245 | } | |
246 | ||
247 | // reads configuration for the shuttle running on this machine | |
248 | ||
249 | fShuttleInstanceHost = gSystem->HostName(); | |
250 | TString queryFilter = Form("(ShuttleHost=%s)", fShuttleInstanceHost.Data()); | |
251 | ||
252 | TLDAPResult* aResult = aServer.Search(basedn, LDAP_SCOPE_ONELEVEL, queryFilter.Data()); | |
253 | ||
254 | if (!aResult) { | |
255 | AliError(Form("Can't find configuration with base DN: %s", | |
256 | basedn)); | |
257 | return; | |
258 | } | |
259 | ||
260 | if (aResult->GetCount() == 0) { | |
261 | AliError(Form("No Shuttle instance for host = %s!", | |
262 | fShuttleInstanceHost.Data())); | |
263 | AliError(Form("All detectors will be processed.")); | |
264 | fProcessAll=kTRUE; | |
265 | } | |
266 | ||
267 | if (aResult->GetCount() > 1) { | |
268 | AliError(Form("More than one Shuttle instance for host %s!", | |
269 | fShuttleInstanceHost.Data())); | |
270 | delete aResult; | |
271 | return; | |
272 | } | |
273 | ||
274 | TLDAPEntry* anEntry = 0; | |
275 | TLDAPAttribute* anAttribute = 0; | |
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 | ||
287 | delete anEntry; delete aResult; | |
288 | ||
289 | // Detector configuration (DCS Archive DB settings) | |
290 | ||
291 | aResult = aServer.Search(basedn, LDAP_SCOPE_ONELEVEL, "(objectClass=AliShuttleDetector)"); | |
292 | if (!aResult) { | |
293 | AliError(Form("Can't find configuration with base DN: %s", basedn)); | |
294 | return; | |
295 | } | |
296 | ||
297 | ||
298 | while ((anEntry = aResult->GetNext())) { | |
299 | AliShuttleConfigHolder* aHolder = new AliShuttleConfigHolder(anEntry); | |
300 | delete anEntry; | |
301 | ||
302 | if (!aHolder->IsValid()) { | |
303 | AliError("Detector configuration error!"); | |
304 | delete aHolder; | |
305 | delete aResult; | |
306 | return; | |
307 | } | |
308 | ||
309 | TObjString* detStr = new TObjString(aHolder->GetDetector()); | |
310 | fDetectorMap.Add(detStr, aHolder); | |
311 | fDetectorList.AddLast(detStr); | |
312 | } | |
313 | ||
314 | delete aResult; | |
315 | ||
316 | // Global configuration (DAQ logbook) | |
317 | ||
318 | aResult = aServer.Search(basedn, LDAP_SCOPE_ONELEVEL, | |
319 | "(objectClass=AliShuttleGlobalConfig)"); | |
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) { | |
327 | AliError("Can't find DAQ logbook configuration!"); | |
328 | delete aResult; | |
329 | return; | |
330 | } | |
331 | ||
332 | if (aResult->GetCount() > 1) { | |
333 | AliError("More than one DAQ logbook configuration found!"); | |
334 | delete aResult; | |
335 | return; | |
336 | } | |
337 | ||
338 | anEntry = aResult->GetNext(); | |
339 | ||
340 | anAttribute = anEntry->GetAttribute("DAQLogbookHost"); | |
341 | if (!anAttribute) { | |
342 | AliError("Can't find DAQLogbookHost attribute!"); | |
343 | delete anEntry; delete aResult; | |
344 | return; | |
345 | } | |
346 | fDAQlbHost = anAttribute->GetValue(); | |
347 | ||
348 | anAttribute = anEntry->GetAttribute("DAQLogbookPort"); // MAY | |
349 | if (anAttribute) | |
350 | { | |
351 | fDAQlbPort = ((TString) anAttribute->GetValue()).Atoi(); | |
352 | } else { | |
353 | fDAQlbPort = 3306; // mysql | |
354 | } | |
355 | ||
356 | anAttribute = anEntry->GetAttribute("DAQLogbookUser"); | |
357 | if (!anAttribute) { | |
358 | AliError("Can't find DAQLogbookUser attribute!"); | |
359 | delete aResult; delete anEntry; | |
360 | return; | |
361 | } | |
362 | fDAQlbUser = anAttribute->GetValue(); | |
363 | ||
364 | anAttribute = anEntry->GetAttribute("DAQLogbookPassword"); | |
365 | if (!anAttribute) { | |
366 | AliError("Can't find DAQLogbookPassword attribute!"); | |
367 | delete aResult; delete anEntry; | |
368 | return; | |
369 | } | |
370 | fDAQlbPass = anAttribute->GetValue(); | |
371 | ||
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 | ||
389 | anAttribute = anEntry->GetAttribute("MaxRetries"); | |
390 | if (!anAttribute) { | |
391 | AliError("Can't find MaxRetries attribute!"); | |
392 | delete aResult; delete anEntry; | |
393 | return; | |
394 | } | |
395 | TString tmpStr = anAttribute->GetValue(); | |
396 | fMaxRetries = tmpStr.Atoi(); | |
397 | ||
398 | anAttribute = anEntry->GetAttribute("PPTimeOut"); | |
399 | if (!anAttribute) { | |
400 | AliError("Can't find PPTimeOut attribute!"); | |
401 | delete aResult; delete anEntry; | |
402 | return; | |
403 | } | |
404 | tmpStr = anAttribute->GetValue(); | |
405 | fPPTimeOut = tmpStr.Atoi(); | |
406 | ||
407 | delete aResult; delete anEntry; | |
408 | ||
409 | // FXS configuration (FXS logbook and hosts) | |
410 | ||
411 | for(int iSys=0;iSys<3;iSys++){ | |
412 | queryFilter = Form("(system=%s)", AliShuttleInterface::GetSystemName(iSys)); | |
413 | aResult = aServer.Search(basedn, LDAP_SCOPE_ONELEVEL, queryFilter.Data()); | |
414 | if (!aResult) { | |
415 | AliError(Form("Can't find configuration for system: %s", | |
416 | AliShuttleInterface::GetSystemName(iSys))); | |
417 | return; | |
418 | } | |
419 | ||
420 | if (aResult->GetCount() != 1 ) { | |
421 | AliError("Error in FXS configuration!"); | |
422 | delete aResult; | |
423 | return; | |
424 | } | |
425 | ||
426 | anEntry = aResult->GetNext(); | |
427 | ||
428 | anAttribute = anEntry->GetAttribute("DBHost"); | |
429 | if (!anAttribute) { | |
430 | AliError(Form ("Can't find DBHost attribute for %s!!", | |
431 | AliShuttleInterface::GetSystemName(iSys))); | |
432 | delete aResult; delete anEntry; | |
433 | return; | |
434 | } | |
435 | fFXSdbHost[iSys] = anAttribute->GetValue(); | |
436 | ||
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 | ||
445 | anAttribute = anEntry->GetAttribute("DBUser"); | |
446 | if (!anAttribute) { | |
447 | AliError(Form ("Can't find DBUser attribute for %s!!", | |
448 | AliShuttleInterface::GetSystemName(iSys))); | |
449 | delete aResult; delete anEntry; | |
450 | return; | |
451 | } | |
452 | fFXSdbUser[iSys] = anAttribute->GetValue(); | |
453 | ||
454 | anAttribute = anEntry->GetAttribute("DBPassword"); | |
455 | if (!anAttribute) { | |
456 | AliError(Form ("Can't find DBPassword attribute for %s!!", | |
457 | AliShuttleInterface::GetSystemName(iSys))); | |
458 | delete aResult; delete anEntry; | |
459 | return; | |
460 | } | |
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(); | |
480 | ||
481 | anAttribute = anEntry->GetAttribute("FSHost"); | |
482 | if (!anAttribute) { | |
483 | AliError(Form ("Can't find FSHost attribute for %s!!", | |
484 | AliShuttleInterface::GetSystemName(iSys))); | |
485 | delete aResult; delete anEntry; | |
486 | return; | |
487 | } | |
488 | fFXSHost[iSys] = anAttribute->GetValue(); | |
489 | ||
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 | ||
498 | anAttribute = anEntry->GetAttribute("FSUser"); | |
499 | if (!anAttribute) { | |
500 | AliError(Form ("Can't find FSUser attribute for %s!!", | |
501 | AliShuttleInterface::GetSystemName(iSys))); | |
502 | delete aResult; delete anEntry; | |
503 | return; | |
504 | } | |
505 | fFXSUser[iSys] = anAttribute->GetValue(); | |
506 | ||
507 | anAttribute = anEntry->GetAttribute("FSPassword"); | |
508 | if (anAttribute) fFXSPass[iSys] = anAttribute->GetValue(); | |
509 | ||
510 | delete aResult; delete anEntry; | |
511 | } | |
512 | ||
513 | fIsValid = kTRUE; | |
514 | } | |
515 | ||
516 | //______________________________________________________________________________________________ | |
517 | AliShuttleConfig::~AliShuttleConfig() | |
518 | { | |
519 | // destructor | |
520 | ||
521 | fDetectorMap.DeleteAll(); | |
522 | fDetectorList.Clear(); | |
523 | fProcessedDetectors.Delete(); | |
524 | } | |
525 | ||
526 | //______________________________________________________________________________________________ | |
527 | const TObjArray* AliShuttleConfig::GetDetectors() const | |
528 | { | |
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 | ||
537 | //______________________________________________________________________________________________ | |
538 | Bool_t AliShuttleConfig::HasDetector(const char* detector) const | |
539 | { | |
540 | // | |
541 | // checks for paricular detector in the configuration. | |
542 | // | |
543 | return fDetectorMap.GetValue(detector) != NULL; | |
544 | } | |
545 | ||
546 | //______________________________________________________________________________________________ | |
547 | const char* AliShuttleConfig::GetDCSHost(const char* detector) const | |
548 | { | |
549 | // | |
550 | // returns DCS server host used by particular detector | |
551 | // | |
552 | ||
553 | AliShuttleConfigHolder* aHolder = (AliShuttleConfigHolder*) fDetectorMap.GetValue(detector); | |
554 | if (!aHolder) { | |
555 | AliError(Form("There isn't configuration for detector: %s", | |
556 | detector)); | |
557 | return NULL; | |
558 | } | |
559 | ||
560 | return aHolder->GetDCSHost(); | |
561 | } | |
562 | ||
563 | //______________________________________________________________________________________________ | |
564 | Int_t AliShuttleConfig::GetDCSPort(const char* detector) const | |
565 | { | |
566 | // | |
567 | // returns DCS server port used by particular detector | |
568 | // | |
569 | ||
570 | ||
571 | AliShuttleConfigHolder* aHolder = (AliShuttleConfigHolder*) fDetectorMap.GetValue(detector); | |
572 | if (!aHolder) { | |
573 | AliError(Form("There isn't configuration for detector: %s", | |
574 | detector)); | |
575 | return 0; | |
576 | } | |
577 | ||
578 | return aHolder->GetDCSPort(); | |
579 | } | |
580 | ||
581 | //______________________________________________________________________________________________ | |
582 | const TObjArray* AliShuttleConfig::GetDCSAliases(const char* detector) const | |
583 | { | |
584 | // | |
585 | // returns collection of TObjString which represents the set of aliases | |
586 | // which used for data retrieval for particular detector | |
587 | // | |
588 | ||
589 | AliShuttleConfigHolder* aHolder = (AliShuttleConfigHolder*) fDetectorMap.GetValue(detector); | |
590 | if (!aHolder) { | |
591 | AliError(Form("There isn't configuration for detector: %s", | |
592 | detector)); | |
593 | return NULL; | |
594 | } | |
595 | ||
596 | return aHolder->GetDCSAliases(); | |
597 | } | |
598 | ||
599 | //______________________________________________________________________________________________ | |
600 | const 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 | ||
617 | //______________________________________________________________________________________________ | |
618 | Bool_t AliShuttleConfig::HostProcessDetector(const char* detector) const | |
619 | { | |
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; | |
629 | } | |
630 | ||
631 | //______________________________________________________________________________________________ | |
632 | Bool_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 | ||
647 | //______________________________________________________________________________________________ | |
648 | void AliShuttleConfig::Print(Option_t* /*option*/) const | |
649 | { | |
650 | // print configuration | |
651 | ||
652 | TString result; | |
653 | result += '\n'; | |
654 | ||
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"; | |
667 | } | |
668 | ||
669 | result += Form("PP time out = %d - Max total retries = %d\n\n", fPPTimeOut, fMaxRetries); | |
670 | ||
671 | result += Form("DAQ Logbook Configuration \n \tHost: %s:%d; \tUser: %s; ", | |
672 | fDAQlbHost.Data(), fDAQlbPort, fDAQlbUser.Data()); | |
673 | ||
674 | // result += "Password: "; | |
675 | // result.Append('*', fDAQlbPass.Length()); | |
676 | result += Form("\tDB: %s; \tTable: %s", | |
677 | fDAQlbDB.Data(), fDAQlbTable.Data()); | |
678 | ||
679 | result += "\n\n"; | |
680 | ||
681 | for(int iSys=0;iSys<3;iSys++){ | |
682 | result += Form("FXS Configuration for %s system\n", AliShuttleInterface::GetSystemName(iSys)); | |
683 | result += Form("\tDB host: %s:%d; \tUser: %s; \tName: %s; \tTable: %s\n", | |
684 | fFXSdbHost[iSys].Data(), fFXSdbPort[iSys], fFXSdbUser[iSys].Data(), | |
685 | fFXSdbName[iSys].Data(), fFXSdbTable[iSys].Data()); | |
686 | // result += Form("DB Password:",fFXSdbPass[iSys].Data()); | |
687 | result += Form("\tFXS host: %s:%d; \tUser: %s\n\n", fFXSHost[iSys].Data(), fFXSPort[iSys], | |
688 | fFXSUser[iSys].Data()); | |
689 | // result += Form("FXS Password:",fFXSPass[iSys].Data()); | |
690 | } | |
691 | ||
692 | TIter iter(fDetectorMap.GetTable()); | |
693 | TPair* aPair; | |
694 | while ((aPair = (TPair*) iter.Next())) { | |
695 | AliShuttleConfigHolder* aHolder = (AliShuttleConfigHolder*) aPair->Value(); | |
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 | { | |
700 | result += "\n"; | |
701 | continue; | |
702 | } | |
703 | result += Form("\tAmanda server: %s:%d \n", aHolder->GetDCSHost(), aHolder->GetDCSPort()); | |
704 | ||
705 | const TObjArray* aliases = aHolder->GetDCSAliases(); | |
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"; | |
716 | } | |
717 | ||
718 | ||
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 | ||
732 | } | |
733 | ||
734 | if(!fIsValid) result += "\n\n********** !!!!! Configuration is INVALID !!!!! **********\n"; | |
735 | ||
736 | AliInfo(result); | |
737 | } |