|
Gaudi Framework, version v21r7 |
| Home | Generated: 22 Jan 2010 |
#include <HistorySvc.h>


Definition at line 45 of file HistorySvc.h.
typedef std::multimap<DHH,DataHistory*> HistorySvc::DataHistMap [private] |
Definition at line 97 of file HistorySvc.h.
typedef DataHistMap::iterator HistorySvc::DHMitr [private] |
Definition at line 98 of file HistorySvc.h.
typedef DataHistMap::const_iterator HistorySvc::DHMCitr [private] |
Definition at line 99 of file HistorySvc.h.
| HistorySvc::HistorySvc | ( | const std::string & | name, | |
| ISvcLocator * | svc | |||
| ) |
Definition at line 69 of file HistorySvc.cpp.
00070 : base_class( name, svc ), 00071 m_isInitialized(false), 00072 m_dump(false), 00073 p_algCtxSvc(0), 00074 m_jobHistory(0), 00075 m_outputFile(""), 00076 m_incidentSvc(0), 00077 m_log(msgSvc(), name ) 00078 00079 { 00080 declareProperty("Dump",m_dump); 00081 declareProperty("Activate", m_activate=true); 00082 declareProperty("OutputFile",m_outputFile); 00083 00084 // hack to bring in environ 00085 vector<string> envtmp = System::getEnv(); 00086 00087 }
| HistorySvc::~HistorySvc | ( | ) | [virtual] |
| StatusCode HistorySvc::initialize | ( | ) | [virtual] |
Reimplemented from Service.
Definition at line 140 of file HistorySvc.cpp.
00140 { 00141 00142 StatusCode status = Service::initialize(); 00143 m_log.setLevel( m_outputLevel.value() ); 00144 00145 if (status.isFailure()) { 00146 #ifndef NDEBUG 00147 m_log << MSG::DEBUG << "Failed to initialize the base class (Service)" 00148 << endmsg; 00149 #endif 00150 return status; 00151 } 00152 00153 #ifndef NDEBUG 00154 m_log << MSG::DEBUG << "Initializing HistorySvc" << endmsg; 00155 #endif 00156 00157 if (!m_activate) return StatusCode::SUCCESS; 00158 00159 static const bool CREATEIF(true); 00160 00161 if ( service("AlgContextSvc",p_algCtxSvc,CREATEIF).isFailure() ) { 00162 m_log << MSG::ERROR << "unable to get the AlgContextSvc" << endmsg; 00163 return StatusCode::FAILURE; 00164 } 00165 00166 if (service("IncidentSvc", m_incidentSvc, CREATEIF).isFailure()) { 00167 m_log << MSG::ERROR << "unable to get the IncidentSvc" << endmsg; 00168 return StatusCode::FAILURE; 00169 } 00170 00171 // create a weak dependency on the ToolSvc, so that it doesn't get deleted 00172 // before we're done with it in finalize 00173 if (ServiceHandle<IToolSvc>("ToolSvc/ToolSvc",name()).retrieve().isFailure()) { 00174 m_log << MSG::ERROR << "could not retrieve the ToolSvc handle !" 00175 << endmsg; 00176 return StatusCode::FAILURE; 00177 } 00178 00179 // add listener to be triggered by first BeginEvent with low priority 00180 // so it gets called first 00181 const bool rethrow = false; 00182 const bool oneShot = true; // make the listener called only once 00183 m_incidentSvc->addListener(this,IncidentType::BeginEvent, 00184 std::numeric_limits<long>::min(),rethrow,oneShot); 00185 00186 m_isInitialized = true; 00187 00188 return StatusCode::SUCCESS; 00189 00190 }
| StatusCode HistorySvc::reinitialize | ( | ) | [virtual] |
Reimplemented from Service.
Definition at line 97 of file HistorySvc.cpp.
00097 { 00098 00099 clearState(); 00100 00101 m_state = Gaudi::StateMachine::OFFLINE; 00102 00103 return initialize(); 00104 00105 }
| StatusCode HistorySvc::finalize | ( | void | ) | [virtual] |
Reimplemented from Service.
Definition at line 297 of file HistorySvc.cpp.
00297 { 00298 00299 if (!m_activate) return StatusCode::SUCCESS; 00300 00301 if (m_dump) { 00302 listProperties().ignore(); 00303 } 00304 00305 if (m_outputFile != "") { 00306 std::ofstream ofs; 00307 ofs.open(m_outputFile.c_str()); 00308 if (!ofs) { 00309 m_log << MSG::ERROR << "Unable to open output file \"m_outputFile\"" 00310 << endmsg; 00311 } else { 00312 00313 // dumpProperties(ofs); 00314 dumpState(ofs); 00315 00316 ofs.close(); 00317 } 00318 } 00319 00320 clearState(); 00321 00322 StatusCode status = Service::finalize(); 00323 00324 if ( status.isSuccess() ) 00325 m_log << MSG::INFO << "Service finalised successfully" << endmsg; 00326 00327 return status; 00328 00329 }
| StatusCode HistorySvc::captureState | ( | ) | [virtual] |
Get all the Algorithms
Get all the AlgTools
Get all the Services
Definition at line 193 of file HistorySvc.cpp.
00193 { 00194 00195 if (m_jobHistory == 0) { 00196 m_jobHistory = new JobHistory; 00197 IJobOptionsSvc *jo; 00198 if (service("JobOptionsSvc",jo).isFailure()) { 00199 m_log << MSG::ERROR 00200 << "Could not get jobOptionsSvc - " 00201 << "not adding properties to JobHistory" << endmsg; 00202 } else { 00203 00204 bool foundAppMgr(false); 00205 00206 std::vector<std::string> clients = jo->getClients(); 00207 std::vector<std::string>::const_iterator it; 00208 std::vector<const Property*>::const_iterator itr; 00209 for (it=clients.begin(); it!=clients.end(); ++it) { 00210 if (*it == "ApplicationMgr") { 00211 foundAppMgr = true; 00212 } 00213 const std::vector<const Property*> *props = jo->getProperties(*it); 00214 for (itr=props->begin(); itr != props->end(); ++itr) { 00215 m_jobHistory->addProperty( *it, *itr ); 00216 } 00217 } 00218 00219 if (!foundAppMgr) { 00220 IProperty *ap; 00221 if (service("ApplicationMgr",ap).isFailure()) { 00222 m_log << MSG::ERROR << "could not get the ApplicationMgr" << endmsg; 00223 } else { 00224 std::vector<Property*>::const_iterator itr2; 00225 const std::vector<Property*> props = ap->getProperties(); 00226 for (itr2=props.begin(); itr2 != props.end(); ++itr2) { 00227 m_jobHistory->addProperty( "ApplicationMgr", *itr2 ); 00228 } 00229 } 00230 } 00231 00232 } 00233 } 00234 00236 00237 StatusCode sc; 00238 IAlgManager* algMgr = 0; 00239 sc = Gaudi::svcLocator()->queryInterface( IAlgManager::interfaceID(), 00240 pp_cast<void>(&algMgr) ); 00241 if (sc.isFailure()) { 00242 m_log << MSG::ERROR << "Could not get AlgManager" << endmsg; 00243 return StatusCode::FAILURE; 00244 } else { 00245 00246 std::list<IAlgorithm*> algs; 00247 algs = algMgr->getAlgorithms(); 00248 std::list<IAlgorithm*>::const_iterator itr; 00249 for (itr=algs.begin(); itr!=algs.end(); ++itr) { 00250 Algorithm* alg = dynamic_cast<Algorithm*> (*itr); 00251 if (alg == 0) { 00252 m_log << MSG::WARNING << "Algorithm " << (*itr)->name() 00253 << " does not inherit from Algorithm. Not registering it." 00254 << endmsg; 00255 } else { 00256 registerAlg( *alg ).ignore(); 00257 } 00258 } 00259 00260 m_log << MSG::INFO; 00261 m_log << "Registered " << algs.size() << " Algorithms" << endmsg; 00262 00263 } 00264 00266 00267 m_isInitialized = true; 00268 std::set<const IAlgTool*>::const_iterator itra; 00269 for (itra = m_ialgtools.begin(); itra != m_ialgtools.end(); ++itra) { 00270 (const_cast<IAlgTool*>(*itra))->addRef(); 00271 registerAlgTool(**itra).ignore(); 00272 } 00273 00274 m_log << MSG::INFO << "Registered " << m_algtools.size() << " AlgTools" 00275 << endmsg; 00276 00278 00279 std::list<IService*> svcs = Gaudi::svcLocator()->getServices(); 00280 00281 std::list<IService*>::const_iterator itrs; 00282 for (itrs=svcs.begin(); itrs!=svcs.end(); ++itrs) { 00283 (*itrs)->addRef(); 00284 registerSvc(**itrs).ignore(); 00285 } 00286 00287 m_log << MSG::INFO; 00288 m_log << "Registered " << svcs.size() << " Services" << endmsg; 00289 00290 return StatusCode::SUCCESS; 00291 00292 00293 }
| StatusCode HistorySvc::registerJob | ( | ) | [virtual] |
Definition at line 439 of file HistorySvc.cpp.
00439 { 00440 00441 00442 return StatusCode(StatusCode::SUCCESS,true); 00443 00444 00445 }
| StatusCode HistorySvc::listProperties | ( | ) | const [virtual] |
Definition at line 450 of file HistorySvc.cpp.
00450 { 00451 00452 m_log << MSG::INFO; 00453 m_log.setColor(MSG::CYAN); 00454 m_log << "Dumping properties for all Algorithms" << endmsg; 00455 00456 std::map<const Algorithm*, AlgorithmHistory*>::const_iterator itr; 00457 for (itr=m_algmap.begin(); itr != m_algmap.end(); ++itr) { 00458 const Algorithm* alg = itr->first; 00459 00460 listProperties( *alg ).ignore(); 00461 00462 } 00463 00464 m_log << MSG::INFO; 00465 m_log.setColor(MSG::CYAN); 00466 m_log << "Dumping properties for all AlgTools" << endmsg; 00467 00468 std::map<const AlgTool*, AlgToolHistory*>::const_iterator itr_a; 00469 for (itr_a=m_algtoolmap.begin(); itr_a != m_algtoolmap.end(); ++itr_a) { 00470 const AlgTool* alg = itr_a->first; 00471 00472 listProperties( *alg ).ignore(); 00473 00474 } 00475 00476 m_log << MSG::INFO; 00477 m_log.setColor(MSG::CYAN); 00478 m_log << "Dumping properties for all Services" << endmsg; 00479 00480 std::map<const IService*, ServiceHistory*>::const_iterator itr_s; 00481 for (itr_s=m_svcmap.begin(); itr_s != m_svcmap.end(); ++itr_s) { 00482 const IService* svc = itr_s->first; 00483 00484 listProperties( *svc ).ignore(); 00485 00486 } 00487 00488 m_log << MSG::INFO; 00489 m_log.setColor(MSG::CYAN); 00490 m_log << "Dumping properties for Job"; 00491 m_log.resetColor(); 00492 00493 ostringstream ost; 00494 ost << *m_jobHistory; 00495 std::string str = ost.str(); 00496 00497 m_log << std::endl << str << endmsg; 00498 00499 return StatusCode(StatusCode::SUCCESS,true); 00500 00501 }
| JobHistory * HistorySvc::getJobHistory | ( | ) | const [virtual] |
Definition at line 549 of file HistorySvc.cpp.
00549 { 00550 00551 return m_jobHistory; 00552 00553 }
| StatusCode HistorySvc::registerSvc | ( | const IService & | svc | ) | [virtual] |
Definition at line 695 of file HistorySvc.cpp.
00695 { 00696 00697 if ( svc.name() == "HistoryStore" ) { 00698 // m_log << MSG::WARNING << "not registering store" << endmsg; 00699 return StatusCode(StatusCode::SUCCESS,true); 00700 } 00701 00702 JobHistory *job = getJobHistory(); 00703 const IService* psvc = &svc; 00704 map<const IService*, ServiceHistory*>::const_iterator itr = 00705 m_svcmap.find(psvc); 00706 if (itr == m_svcmap.end()) { 00707 00708 #ifndef NDEBUG 00709 m_log << MSG::DEBUG << "Registering Service: "; 00710 m_log.setColor(MSG::CYAN); 00711 m_log << svc.name() << endmsg; 00712 #endif 00713 00714 m_svcs.insert(psvc); 00715 00716 ServiceHistory *svcHist = new ServiceHistory(&svc, job); 00717 m_svcmap[psvc] = svcHist; 00718 00719 (const_cast<IService*>(psvc))->addRef(); 00720 00721 } 00722 00723 m_log.resetColor(); 00724 return StatusCode(StatusCode::SUCCESS,true); 00725 00726 }
| StatusCode HistorySvc::listProperties | ( | const IService & | svc | ) | const [virtual] |
Definition at line 762 of file HistorySvc.cpp.
00762 { 00763 00764 m_log << MSG::INFO << "Dumping properties for " << svc.name() << endl; 00765 00766 ServiceHistory *hist = getServiceHistory( svc ); 00767 00768 if (hist == 0) { 00769 return StatusCode::FAILURE; 00770 } 00771 00772 ostringstream ost; 00773 ost << *hist; 00774 00775 std::string str = ost.str(); 00776 00777 m_log << MSG::INFO << svc.name() << " --> " << endl << str << endmsg; 00778 00779 00780 00781 return StatusCode(StatusCode::SUCCESS,true); 00782 00783 }
| ServiceHistory * HistorySvc::getServiceHistory | ( | const IService & | svc | ) | const [virtual] |
Definition at line 731 of file HistorySvc.cpp.
00731 { 00732 00733 const IService *psvc = &svc; 00734 map<const IService*, ServiceHistory*>::const_iterator itr = 00735 m_svcmap.find(psvc); 00736 if ( itr == m_svcmap.end() ) { 00737 m_log << MSG::WARNING << "Service " << svc.name() << " not registered" 00738 << endmsg; 00739 return 0; 00740 } 00741 00742 return ( itr->second ); 00743 00744 }
| void HistorySvc::getServiceHistory | ( | std::set< ServiceHistory * > & | svcs | ) | const [virtual] |
Definition at line 748 of file HistorySvc.cpp.
00748 { 00749 00750 set<const IService*>::const_iterator itr; 00751 for (itr=m_svcs.begin(); itr!=m_svcs.end(); ++itr) { 00752 ServiceHistory *sh = m_svcmap.find( *itr )->second; 00753 00754 svcs.insert(sh); 00755 } 00756 00757 }
| StatusCode HistorySvc::registerAlg | ( | const Algorithm & | alg | ) | [virtual] |
Definition at line 337 of file HistorySvc.cpp.
00337 { 00338 00339 JobHistory *job = getJobHistory(); 00340 if (m_algmap.find(&alg) != m_algmap.end()) { 00341 m_log << MSG::WARNING << "Algorithm " << alg.name() 00342 << " already registered with HistorySvc" << endmsg; 00343 return StatusCode::SUCCESS; 00344 } 00345 00346 (const_cast<Algorithm*>(&alg))->addRef(); 00347 00348 m_algs.insert(&alg); 00349 00350 AlgorithmHistory *algHist = new AlgorithmHistory(alg, job); 00351 m_algmap[&alg] = algHist; 00352 00353 #ifndef NDEBUG 00354 m_log << MSG::DEBUG << "Registering algorithm: "; 00355 m_log.setColor(MSG::CYAN); 00356 m_log << alg.name() << endmsg; 00357 m_log.resetColor(); 00358 #endif 00359 00360 return StatusCode(StatusCode::SUCCESS,true); 00361 00362 }
| StatusCode HistorySvc::listProperties | ( | const Algorithm & | alg | ) | const [virtual] |
Definition at line 366 of file HistorySvc.cpp.
00366 { 00367 00368 m_log << MSG::INFO << "Dumping properties for " << alg.name() << endl; 00369 00370 AlgorithmHistory *hist = getAlgHistory( alg ); 00371 00372 if (hist == 0) { 00373 return StatusCode::FAILURE; 00374 } 00375 00376 ostringstream ost; 00377 ost << *hist; 00378 00379 std::string str = ost.str(); 00380 00381 m_log << MSG::INFO << alg.name() << " --> " << endl << str << endmsg; 00382 00383 return StatusCode(StatusCode::SUCCESS,true); 00384 00385 }
| AlgorithmHistory * HistorySvc::getAlgHistory | ( | const Algorithm & | alg | ) | const [virtual] |
Definition at line 406 of file HistorySvc.cpp.
00406 { 00407 00408 const Algorithm *palg = &alg; 00409 set<const Algorithm*>::const_iterator itr = m_algs.find(palg); 00410 if ( itr == m_algs.end() ) { 00411 m_log << MSG::WARNING << "Algorithm " << alg.name() << " not registered" 00412 << endmsg; 00413 return 0; 00414 } 00415 00416 map<const Algorithm*, AlgorithmHistory*>::const_iterator itr2; 00417 itr2 = m_algmap.find( *itr ); 00418 00419 return ( itr2->second ); 00420 00421 }
| void HistorySvc::getAlgHistory | ( | std::set< AlgorithmHistory * > & | algs | ) | const [virtual] |
Definition at line 425 of file HistorySvc.cpp.
00425 { 00426 00427 set<const Algorithm*>::const_iterator itr; 00428 for (itr=m_algs.begin(); itr!=m_algs.end(); ++itr) { 00429 AlgorithmHistory *ah = m_algmap.find(*itr)->second; 00430 00431 algs.insert(ah); 00432 } 00433 00434 }
| StatusCode HistorySvc::registerAlgTool | ( | const IAlgTool & | ialg | ) | [virtual] |
Definition at line 806 of file HistorySvc.cpp.
00806 { 00807 00808 if (! m_isInitialized) { 00809 if (p_algCtxSvc == 0) { 00810 if ( service("AlgContextSvc",p_algCtxSvc,true).isFailure() ) { 00811 m_log << MSG::ERROR << "unable to get the AlgContextSvc" << endmsg; 00812 return StatusCode::FAILURE; 00813 } 00814 } 00815 00816 m_ialgtools.insert(&ialg); 00817 return StatusCode::SUCCESS; 00818 } 00819 00820 const AlgTool *alg = dynamic_cast<const AlgTool*>( &ialg ); 00821 if ( alg == 0 ) { 00822 m_log << MSG::ERROR << "Could not dcast IAlgTool \"" << ialg.name() 00823 << "\" to an AlgTool" << endmsg; 00824 return StatusCode::FAILURE; 00825 } 00826 00827 if (m_algtools.find(alg) != m_algtools.end()) { 00828 m_log << MSG::WARNING << "AlgTool " << ialg.name() 00829 << " already registered in HistorySvc" << endmsg; 00830 return StatusCode::SUCCESS; 00831 } 00832 00833 m_algtools.insert(alg); 00834 (const_cast<AlgTool*>(alg))->addRef(); 00835 00836 const JobHistory *job = getJobHistory(); 00837 AlgToolHistory *algHist = new AlgToolHistory(*alg, job); 00838 m_algtoolmap[alg] = algHist; 00839 00840 #ifndef NDEBUG 00841 m_log << MSG::DEBUG << "Registering algtool: "; 00842 m_log.setColor(MSG::CYAN); 00843 m_log << alg->name() << endmsg; 00844 m_log.resetColor(); 00845 #endif 00846 00847 return StatusCode::SUCCESS; 00848 00849 }
| StatusCode HistorySvc::listProperties | ( | const IAlgTool & | alg | ) | const [virtual] |
Definition at line 854 of file HistorySvc.cpp.
00854 { 00855 00856 m_log << MSG::INFO << "Dumping properties for " << alg.name() << endl; 00857 00858 AlgToolHistory *hist = getAlgToolHistory( alg ); 00859 00860 if (hist == 0) { 00861 return StatusCode::FAILURE; 00862 } 00863 00864 ostringstream ost; 00865 ost << *hist; 00866 00867 std::string str = ost.str(); 00868 00869 m_log << MSG::INFO << alg.name() << " --> " << endl << str << endmsg; 00870 00871 return StatusCode::SUCCESS; 00872 00873 }
| AlgToolHistory * HistorySvc::getAlgToolHistory | ( | const IAlgTool & | alg | ) | const [virtual] |
Definition at line 895 of file HistorySvc.cpp.
00895 { 00896 00897 const AlgTool *palg = dynamic_cast<const AlgTool*>(&alg); 00898 set<const AlgTool*>::const_iterator itr = m_algtools.find(palg); 00899 if ( itr == m_algtools.end() ) { 00900 m_log << MSG::WARNING << "AlgTool " << alg.name() << " not registered" 00901 << endmsg; 00902 return 0; 00903 } 00904 00905 map<const AlgTool*, AlgToolHistory*>::const_iterator itr2; 00906 itr2 = m_algtoolmap.find( *itr ); 00907 00908 return ( itr2->second ); 00909 00910 }
| void HistorySvc::getAlgToolHistory | ( | std::set< AlgToolHistory * > & | algs | ) | const [virtual] |
Definition at line 915 of file HistorySvc.cpp.
00915 { 00916 00917 set<const AlgTool*>::const_iterator itr; 00918 for (itr=m_algtools.begin(); itr!=m_algtools.end(); ++itr) { 00919 AlgToolHistory *ah = m_algtoolmap.find(*itr)->second; 00920 00921 algs.insert(ah); 00922 } 00923 00924 }
| DataHistory * HistorySvc::createDataHistoryObj | ( | const CLID & | id, | |
| const std::string & | key, | |||
| const std::string & | store | |||
| ) | [virtual] |
Definition at line 572 of file HistorySvc.cpp.
00573 { 00574 00575 if (!m_activate) return 0; 00576 00577 00578 AlgorithmHistory *algHist; 00579 00580 IAlgorithm* ialg = getCurrentIAlg(); 00581 if (ialg == 0) { 00582 #ifndef NDEBUG 00583 m_log << MSG::DEBUG 00584 << "Could not discover current Algorithm:" << endl 00585 << " object CLID: " << id << " key: \"" << key 00586 << "\"" << endmsg; 00587 #endif 00588 algHist = 0; 00589 } else { 00590 Algorithm* alg = dynamic_cast<Algorithm*>(ialg); 00591 if (alg != 0) { 00592 algHist = getAlgHistory( *alg ); 00593 } else { 00594 m_log << MSG::WARNING 00595 << "Could not extract concerete Algorithm:" 00596 << endl 00597 << " object CLID: " << id << " key: \"" << key 00598 << "\"" << endmsg; 00599 algHist = 0; 00600 } 00601 } 00602 00603 DataHistory *hist = new DataHistory(id, key, algHist); 00604 00605 return hist; 00606 00607 }
| StatusCode HistorySvc::registerDataHistory | ( | const CLID & | id, | |
| const std::string & | key, | |||
| const std::string & | store | |||
| ) | [virtual] |
Definition at line 611 of file HistorySvc.cpp.
00612 { 00613 00614 DHH dhh(id,key); 00615 00616 pair<DHMitr,DHMitr> mitr = m_datMap.equal_range(dhh); 00617 00618 if (mitr.first == mitr.second) { 00619 // not in the map 00620 DataHistory *dh = createDataHistoryObj(id,key,storeName); 00621 m_datMap.insert(pair<DHH,DataHistory*>(dhh,dh)); 00622 } else { 00623 // found at least one 00624 bool match(false); 00625 00626 std::string algName; 00627 IAlgorithm *ialg = getCurrentIAlg(); 00628 if (ialg != 0) { 00629 algName = ialg->name(); 00630 } else { 00631 algName = "UNKNOWN"; 00632 } 00633 00634 for (DHMitr itr = mitr.first; itr != mitr.second; ++itr) { 00635 DataHistory *dh = itr->second; 00636 if (dh->algorithmHistory()->algorithm_name() == algName) { 00637 match = true; 00638 break; 00639 } 00640 } 00641 00642 if (! match) { 00643 DataHistory *dh = createDataHistoryObj(id,key,storeName); 00644 m_datMap.insert(pair<DHH,DataHistory*>(dhh,dh)); 00645 } 00646 } 00647 00648 return StatusCode::SUCCESS; 00649 00650 }
| DataHistory * HistorySvc::getDataHistory | ( | const CLID & | id, | |
| const std::string & | key, | |||
| const std::string & | store | |||
| ) | const [virtual] |
Definition at line 655 of file HistorySvc.cpp.
00656 { 00657 00658 DHH dhh(id,key); 00659 00660 pair<DHMCitr,DHMCitr> mitr = m_datMap.equal_range(dhh); 00661 00662 if(mitr.first == mitr.second) { 00663 return 0; 00664 } 00665 00666 return mitr.first->second; 00667 00668 }
| int HistorySvc::getDataHistory | ( | const CLID & | id, | |
| const std::string & | key, | |||
| const std::string & | storeName, | |||
| std::list< DataHistory * > & | dhlist | |||
| ) | const [virtual] |
Definition at line 673 of file HistorySvc.cpp.
00675 { 00676 00677 DHH dhh(id,key); 00678 00679 int n(0); 00680 00681 pair<DHMCitr,DHMCitr> mitr = m_datMap.equal_range(dhh); 00682 00683 for (DHMCitr itr=mitr.first; itr != mitr.second; ++itr) { 00684 dhlist.push_back(itr->second); 00685 n++; 00686 } 00687 00688 return n; 00689 00690 }
| void HistorySvc::handle | ( | const Incident & | inc | ) | [virtual] |
Definition at line 929 of file HistorySvc.cpp.
00929 { 00930 00931 if (incident.type() == IncidentType::BeginEvent) { 00932 if (captureState().isFailure()) { 00933 m_log << MSG::WARNING << "Error capturing state." << endl 00934 << "Will try again at next BeginEvent incident" << endmsg; 00935 } 00936 } 00937 00938 }
| void HistorySvc::clearState | ( | ) | [private] |
Definition at line 109 of file HistorySvc.cpp.
00109 { 00110 m_algs.clear(); 00111 std::map<const Algorithm*, AlgorithmHistory*>::iterator algitr; 00112 for (algitr = m_algmap.begin(); algitr != m_algmap.end(); ++algitr) { 00113 AlgorithmHistory* h = algitr->second; 00114 (const_cast<Algorithm*> (algitr->first))->release(); 00115 delete h; 00116 } 00117 m_algmap.clear(); 00118 00119 m_ialgtools.clear(); 00120 m_algtools.clear(); 00121 std::map<const AlgTool*, AlgToolHistory*>::iterator atitr; 00122 for (atitr=m_algtoolmap.begin(); atitr != m_algtoolmap.end(); ++atitr) { 00123 (const_cast<AlgTool*> (atitr->first))->release(); 00124 delete atitr->second; 00125 } 00126 m_algtoolmap.clear(); 00127 00128 m_svcs.clear(); 00129 std::map<const IService*, ServiceHistory*>::iterator svitr; 00130 for (svitr = m_svcmap.begin(); svitr != m_svcmap.end(); ++svitr) { 00131 (const_cast<IService*> (svitr->first))->release(); 00132 delete svitr->second; 00133 } 00134 m_svcmap.clear(); 00135 }
| void HistorySvc::dumpProperties | ( | std::ofstream & | ofs | ) | const [private] |
Definition at line 505 of file HistorySvc.cpp.
00505 { 00506 00507 00508 ofs << "GLOBAL" << std::endl; 00509 const JobHistory::PropertyList props = m_jobHistory->properties(); 00510 JobHistory::PropertyList::const_iterator itrj; 00511 for (itrj=props.begin(); itrj != props.end(); ++itrj) { 00512 std::string client = itrj->first; 00513 const Property* prp = itrj->second; 00514 ofs << client << " " << dumpProp(prp) << std::endl; 00515 } 00516 00517 ofs << std::endl << "SERVICES" << std::endl; 00518 std::map<const IService*, ServiceHistory*>::const_iterator itr_s; 00519 for (itr_s=m_svcmap.begin(); itr_s != m_svcmap.end(); ++itr_s) { 00520 const IService* svc = itr_s->first; 00521 00522 dumpProperties( *svc, ofs ); 00523 00524 } 00525 00526 ofs << std::endl << "ALGORITHMS" << std::endl; 00527 std::map<const Algorithm*, AlgorithmHistory*>::const_iterator itr; 00528 for (itr=m_algmap.begin(); itr != m_algmap.end(); ++itr) { 00529 const Algorithm* alg = itr->first; 00530 00531 dumpProperties( *alg, ofs ); 00532 00533 } 00534 00535 ofs << std::endl << "ALGTOOLS" << std::endl; 00536 std::map<const AlgTool*, AlgToolHistory*>::const_iterator itr_a; 00537 for (itr_a=m_algtoolmap.begin(); itr_a != m_algtoolmap.end(); ++itr_a) { 00538 const AlgTool* alg = itr_a->first; 00539 00540 dumpProperties( *alg, ofs ); 00541 00542 } 00543 00544 00545 }
| void HistorySvc::dumpProperties | ( | const IService & | svc, | |
| std::ofstream & | ofs | |||
| ) | const [private] |
Definition at line 788 of file HistorySvc.cpp.
00788 { 00789 00790 ServiceHistory *hist = getServiceHistory( svc ); 00791 00792 if (hist == 0) { 00793 return; 00794 } 00795 00796 ServiceHistory::PropertyList::const_iterator itr; 00797 for (itr=hist->properties().begin(); itr != hist->properties().end();++itr) { 00798 ofs << svc.name() << " " << dumpProp(*itr) << std::endl; 00799 } 00800 00801 }
| void HistorySvc::dumpProperties | ( | const Algorithm & | alg, | |
| std::ofstream & | ofs | |||
| ) | const [private] |
Definition at line 389 of file HistorySvc.cpp.
00389 { 00390 00391 AlgorithmHistory *hist = getAlgHistory( alg ); 00392 00393 if (hist == 0) { 00394 return; 00395 } 00396 00397 AlgorithmHistory::PropertyList::const_iterator itr; 00398 for (itr=hist->properties().begin(); itr!=hist->properties().end(); ++itr) { 00399 ofs << alg.name() << " " << dumpProp(*itr) << std::endl; 00400 } 00401 00402 }
| void HistorySvc::dumpProperties | ( | const IAlgTool & | alg, | |
| std::ofstream & | ofs | |||
| ) | const [private] |
Definition at line 877 of file HistorySvc.cpp.
00877 { 00878 00879 AlgToolHistory *hist = getAlgToolHistory( alg ); 00880 00881 if (hist == 0) { 00882 return; 00883 } 00884 00885 AlgToolHistory::PropertyList::const_iterator itr; 00886 for (itr=hist->properties().begin(); itr!=hist->properties().end(); ++itr) { 00887 ofs << alg.name() << " " << dumpProp(*itr) << std::endl; 00888 } 00889 00890 }
| void HistorySvc::dumpState | ( | std::ofstream & | ofs | ) | const [private] |
Definition at line 953 of file HistorySvc.cpp.
00953 { 00954 00955 00956 ofs << "GLOBAL" << std::endl; 00957 const JobHistory::PropertyList props = m_jobHistory->properties(); 00958 JobHistory::PropertyList::const_iterator itrj; 00959 for (itrj=props.begin(); itrj != props.end(); ++itrj) { 00960 std::string client = itrj->first; 00961 const Property* prp = itrj->second; 00962 ofs << client << " " << dumpProp(prp) << std::endl; 00963 } 00964 00965 00966 ofs << "SERVICES" << std::endl; 00967 std::map<const IService*, ServiceHistory*>::const_iterator itr_s; 00968 for (itr_s=m_svcmap.begin(); itr_s != m_svcmap.end(); ++itr_s) { 00969 const IService* svc = itr_s->first; 00970 00971 dumpState( *svc, ofs ); 00972 00973 } 00974 00975 ofs << "ALGORITHMS" << std::endl; 00976 std::map<const Algorithm*, AlgorithmHistory*>::const_iterator itr; 00977 for (itr=m_algmap.begin(); itr != m_algmap.end(); ++itr) { 00978 const Algorithm* alg = itr->first; 00979 00980 dumpState( *alg, ofs ); 00981 00982 } 00983 00984 00985 ofs << "ALGTOOLS" << std::endl; 00986 std::map<const AlgTool*, AlgToolHistory*>::const_iterator itr_a; 00987 for (itr_a=m_algtoolmap.begin(); itr_a != m_algtoolmap.end(); ++itr_a) { 00988 const AlgTool* alg = itr_a->first; 00989 00990 dumpState( *alg, ofs ); 00991 00992 } 00993 00994 }
| void HistorySvc::dumpState | ( | const IService & | svc, | |
| std::ofstream & | ofs | |||
| ) | const [private] |
Definition at line 1014 of file HistorySvc.cpp.
01014 { 01015 01016 ServiceHistory *hist = getServiceHistory( svc ); 01017 01018 if (hist == 0) { 01019 return; 01020 } 01021 01022 ofs << ">> " << svc.name() << endl << *hist << endl; 01023 01024 }
| void HistorySvc::dumpState | ( | const Algorithm & | alg, | |
| std::ofstream & | ofs | |||
| ) | const [private] |
Definition at line 999 of file HistorySvc.cpp.
00999 { 01000 01001 AlgorithmHistory *hist = getAlgHistory( alg ); 01002 01003 if (hist == 0) { 01004 return; 01005 } 01006 01007 ofs << ">> " << alg.name() << endl << *hist << endl; 01008 01009 }
| void HistorySvc::dumpState | ( | const IAlgTool & | alg, | |
| std::ofstream & | ofs | |||
| ) | const [private] |
Definition at line 1029 of file HistorySvc.cpp.
01029 { 01030 01031 AlgToolHistory *hist = getAlgToolHistory( alg ); 01032 01033 if (hist == 0) { 01034 return; 01035 } 01036 01037 ofs << ">> " << alg.name() << endl << *hist << endl; 01038 01039 }
| std::string HistorySvc::dumpProp | ( | const Property * | prop | ) | const [private] |
Definition at line 944 of file HistorySvc.cpp.
00944 { 00945 std::ostringstream ost; 00946 prop->fillStream(ost); 00947 return ost.str(); 00948 }
| IAlgorithm * HistorySvc::getCurrentIAlg | ( | ) | const [private] |
Definition at line 557 of file HistorySvc.cpp.
00557 { 00558 if (p_algCtxSvc == 0) { 00559 m_log << MSG::WARNING << "trying to create DataHistoryObj before " 00560 << "HistorySvc has been initialized" << endmsg; 00561 return 0; 00562 00563 } else { 00564 return p_algCtxSvc->currentAlg(); 00565 } 00566 }
friend class SvcFactory< HistorySvc > [friend] |
Definition at line 104 of file HistorySvc.h.
bool HistorySvc::m_isInitialized [private] |
Definition at line 106 of file HistorySvc.h.
bool HistorySvc::m_dump [private] |
Definition at line 107 of file HistorySvc.h.
bool HistorySvc::m_activate [private] |
Definition at line 108 of file HistorySvc.h.
IAlgContextSvc* HistorySvc::p_algCtxSvc [private] |
Definition at line 110 of file HistorySvc.h.
std::set<const Algorithm*> HistorySvc::m_algs [private] |
Definition at line 112 of file HistorySvc.h.
std::map<const Algorithm*, AlgorithmHistory*> HistorySvc::m_algmap [private] |
Definition at line 113 of file HistorySvc.h.
std::set<const IAlgTool*> HistorySvc::m_ialgtools [private] |
Definition at line 115 of file HistorySvc.h.
std::set<const AlgTool*> HistorySvc::m_algtools [private] |
Definition at line 116 of file HistorySvc.h.
std::map<const AlgTool*, AlgToolHistory*> HistorySvc::m_algtoolmap [private] |
Definition at line 117 of file HistorySvc.h.
std::set<const IService*> HistorySvc::m_svcs [private] |
Definition at line 119 of file HistorySvc.h.
std::map<const IService*, ServiceHistory*> HistorySvc::m_svcmap [private] |
Definition at line 120 of file HistorySvc.h.
std::multimap<DHH, DataHistory*> HistorySvc::m_datMap [private] |
Definition at line 122 of file HistorySvc.h.
JobHistory* HistorySvc::m_jobHistory [private] |
Definition at line 126 of file HistorySvc.h.
std::string HistorySvc::m_outputFile [private] |
Definition at line 128 of file HistorySvc.h.
IIncidentSvc* HistorySvc::m_incidentSvc [private] |
Definition at line 144 of file HistorySvc.h.
MsgStream HistorySvc::m_log [mutable, private] |
Definition at line 146 of file HistorySvc.h.