|
Gaudi Framework, version v22r0 |
| Home | Generated: 9 Feb 2011 |
HistorySvc class definition. More...
#include <HistorySvc.h>


HistorySvc class definition.
Definition at line 45 of file HistorySvc.h.
typedef std::multimap<DHH,DataHistory*> HistorySvc::DataHistMap [private] |
Definition at line 98 of file HistorySvc.h.
typedef DataHistMap::const_iterator HistorySvc::DHMCitr [private] |
Definition at line 100 of file HistorySvc.h.
typedef DataHistMap::iterator HistorySvc::DHMitr [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 envtmp.size(); // prevent icc remark #177: X declared but never referenced 00087 }
| HistorySvc::~HistorySvc | ( | ) | [virtual] |
Definition at line 91 of file HistorySvc.cpp.
00091 { 00092 delete m_jobHistory; 00093 }
| StatusCode HistorySvc::captureState | ( | ) | [virtual] |
Get all the Algorithms
Get all the AlgTools
Get all the Services
Definition at line 194 of file HistorySvc.cpp.
00194 { 00195 00196 if (m_jobHistory == 0) { 00197 m_jobHistory = new JobHistory; 00198 IJobOptionsSvc *jo; 00199 if (service("JobOptionsSvc",jo).isFailure()) { 00200 m_log << MSG::ERROR 00201 << "Could not get jobOptionsSvc - " 00202 << "not adding properties to JobHistory" << endmsg; 00203 } else { 00204 00205 bool foundAppMgr(false); 00206 00207 std::vector<std::string> clients = jo->getClients(); 00208 std::vector<std::string>::const_iterator it; 00209 std::vector<const Property*>::const_iterator itr; 00210 for (it=clients.begin(); it!=clients.end(); ++it) { 00211 if (*it == "ApplicationMgr") { 00212 foundAppMgr = true; 00213 } 00214 const std::vector<const Property*> *props = jo->getProperties(*it); 00215 for (itr=props->begin(); itr != props->end(); ++itr) { 00216 m_jobHistory->addProperty( *it, *itr ); 00217 } 00218 } 00219 00220 if (!foundAppMgr) { 00221 IProperty *ap; 00222 if (service("ApplicationMgr",ap).isFailure()) { 00223 m_log << MSG::ERROR << "could not get the ApplicationMgr" << endmsg; 00224 } else { 00225 std::vector<Property*>::const_iterator itr2; 00226 const std::vector<Property*> props = ap->getProperties(); 00227 for (itr2=props.begin(); itr2 != props.end(); ++itr2) { 00228 m_jobHistory->addProperty( "ApplicationMgr", *itr2 ); 00229 } 00230 } 00231 } 00232 00233 } 00234 } 00235 00237 00238 StatusCode sc; 00239 IAlgManager* algMgr = 0; 00240 sc = Gaudi::svcLocator()->queryInterface( IAlgManager::interfaceID(), 00241 pp_cast<void>(&algMgr) ); 00242 if (sc.isFailure()) { 00243 m_log << MSG::ERROR << "Could not get AlgManager" << endmsg; 00244 return StatusCode::FAILURE; 00245 } else { 00246 00247 std::list<IAlgorithm*> algs; 00248 algs = algMgr->getAlgorithms(); 00249 std::list<IAlgorithm*>::const_iterator itr; 00250 for (itr=algs.begin(); itr!=algs.end(); ++itr) { 00251 Algorithm* alg = dynamic_cast<Algorithm*> (*itr); 00252 if (alg == 0) { 00253 m_log << MSG::WARNING << "Algorithm " << (*itr)->name() 00254 << " does not inherit from Algorithm. Not registering it." 00255 << endmsg; 00256 } else { 00257 registerAlg( *alg ).ignore(); 00258 } 00259 } 00260 00261 m_log << MSG::INFO; 00262 m_log << "Registered " << algs.size() << " Algorithms" << endmsg; 00263 00264 } 00265 00267 00268 m_isInitialized = true; 00269 std::set<const IAlgTool*>::const_iterator itra; 00270 for (itra = m_ialgtools.begin(); itra != m_ialgtools.end(); ++itra) { 00271 (const_cast<IAlgTool*>(*itra))->addRef(); 00272 registerAlgTool(**itra).ignore(); 00273 } 00274 00275 m_log << MSG::INFO << "Registered " << m_algtools.size() << " AlgTools" 00276 << endmsg; 00277 00279 00280 std::list<IService*> svcs = Gaudi::svcLocator()->getServices(); 00281 00282 std::list<IService*>::const_iterator itrs; 00283 for (itrs=svcs.begin(); itrs!=svcs.end(); ++itrs) { 00284 (*itrs)->addRef(); 00285 registerSvc(**itrs).ignore(); 00286 } 00287 00288 m_log << MSG::INFO; 00289 m_log << "Registered " << svcs.size() << " Services" << endmsg; 00290 00291 return StatusCode::SUCCESS; 00292 00293 00294 }
| 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 }
| DataHistory * HistorySvc::createDataHistoryObj | ( | const CLID & | id, | |
| const std::string & | key, | |||
| const std::string & | store | |||
| ) | [virtual] |
Definition at line 588 of file HistorySvc.cpp.
00589 { 00590 00591 if (!m_activate) return 0; 00592 00593 00594 AlgorithmHistory *algHist; 00595 00596 IAlgorithm* ialg = getCurrentIAlg(); 00597 if (ialg == 0) { 00598 #ifndef NDEBUG 00599 m_log << MSG::DEBUG 00600 << "Could not discover current Algorithm:" << endl 00601 << " object CLID: " << id << " key: \"" << key 00602 << "\"" << endmsg; 00603 #endif 00604 algHist = 0; 00605 } else { 00606 Algorithm* alg = dynamic_cast<Algorithm*>(ialg); 00607 if (alg != 0) { 00608 algHist = getAlgHistory( *alg ); 00609 } else { 00610 m_log << MSG::WARNING 00611 << "Could not extract concerete Algorithm:" 00612 << endl 00613 << " object CLID: " << id << " key: \"" << key 00614 << "\"" << endmsg; 00615 algHist = 0; 00616 } 00617 } 00618 00619 DataHistory *hist = new DataHistory(id, key, algHist); 00620 00621 return hist; 00622 00623 }
| std::string HistorySvc::dumpProp | ( | const Property * | prop | ) | const [private] |
Definition at line 960 of file HistorySvc.cpp.
00960 { 00961 std::ostringstream ost; 00962 prop->fillStream(ost); 00963 return ost.str(); 00964 }
| void HistorySvc::dumpProperties | ( | const IAlgTool & | alg, | |
| std::ofstream & | ofs | |||
| ) | const [private] |
Definition at line 893 of file HistorySvc.cpp.
00893 { 00894 00895 AlgToolHistory *hist = getAlgToolHistory( alg ); 00896 00897 if (hist == 0) { 00898 return; 00899 } 00900 00901 AlgToolHistory::PropertyList::const_iterator itr; 00902 for (itr=hist->properties().begin(); itr!=hist->properties().end(); ++itr) { 00903 ofs << alg.name() << " " << dumpProp(*itr) << std::endl; 00904 } 00905 00906 }
| void HistorySvc::dumpProperties | ( | const Algorithm & | alg, | |
| std::ofstream & | ofs | |||
| ) | const [private] |
Definition at line 401 of file HistorySvc.cpp.
00401 { 00402 00403 AlgorithmHistory *hist = getAlgHistory( alg ); 00404 00405 if (hist == 0) { 00406 return; 00407 } 00408 00409 AlgorithmHistory::PropertyList::const_iterator itr; 00410 for (itr=hist->properties().begin(); itr!=hist->properties().end(); ++itr) { 00411 ofs << alg.name() << " " << dumpProp(*itr) << std::endl; 00412 } 00413 00414 }
| void HistorySvc::dumpProperties | ( | const IService & | svc, | |
| std::ofstream & | ofs | |||
| ) | const [private] |
Definition at line 804 of file HistorySvc.cpp.
00804 { 00805 00806 ServiceHistory *hist = getServiceHistory( svc ); 00807 00808 if (hist == 0) { 00809 return; 00810 } 00811 00812 ServiceHistory::PropertyList::const_iterator itr; 00813 for (itr=hist->properties().begin(); itr != hist->properties().end();++itr) { 00814 ofs << svc.name() << " " << dumpProp(*itr) << std::endl; 00815 } 00816 00817 }
| void HistorySvc::dumpProperties | ( | std::ofstream & | ofs | ) | const [private] |
Definition at line 521 of file HistorySvc.cpp.
00521 { 00522 00523 00524 ofs << "GLOBAL" << std::endl; 00525 const JobHistory::PropertyList props = m_jobHistory->properties(); 00526 JobHistory::PropertyList::const_iterator itrj; 00527 for (itrj=props.begin(); itrj != props.end(); ++itrj) { 00528 std::string client = itrj->first; 00529 const Property* prp = itrj->second; 00530 ofs << client << " " << dumpProp(prp) << std::endl; 00531 } 00532 00533 ofs << std::endl << "SERVICES" << std::endl; 00534 std::map<const IService*, ServiceHistory*>::const_iterator itr_s; 00535 for (itr_s=m_svcmap.begin(); itr_s != m_svcmap.end(); ++itr_s) { 00536 const IService* svc = itr_s->first; 00537 00538 dumpProperties( *svc, ofs ); 00539 00540 } 00541 00542 ofs << std::endl << "ALGORITHMS" << std::endl; 00543 std::map<const Algorithm*, AlgorithmHistory*>::const_iterator itr; 00544 for (itr=m_algmap.begin(); itr != m_algmap.end(); ++itr) { 00545 const Algorithm* alg = itr->first; 00546 00547 dumpProperties( *alg, ofs ); 00548 00549 } 00550 00551 ofs << std::endl << "ALGTOOLS" << std::endl; 00552 std::map<const AlgTool*, AlgToolHistory*>::const_iterator itr_a; 00553 for (itr_a=m_algtoolmap.begin(); itr_a != m_algtoolmap.end(); ++itr_a) { 00554 const AlgTool* alg = itr_a->first; 00555 00556 dumpProperties( *alg, ofs ); 00557 00558 } 00559 00560 00561 }
| void HistorySvc::dumpState | ( | const IAlgTool & | alg, | |
| std::ofstream & | ofs | |||
| ) | const [private] |
Definition at line 1045 of file HistorySvc.cpp.
01045 { 01046 01047 AlgToolHistory *hist = getAlgToolHistory( alg ); 01048 01049 if (hist == 0) { 01050 return; 01051 } 01052 01053 ofs << ">> " << alg.name() << endl << *hist << endl; 01054 01055 }
| void HistorySvc::dumpState | ( | const Algorithm & | alg, | |
| std::ofstream & | ofs | |||
| ) | const [private] |
Definition at line 1015 of file HistorySvc.cpp.
01015 { 01016 01017 AlgorithmHistory *hist = getAlgHistory( alg ); 01018 01019 if (hist == 0) { 01020 return; 01021 } 01022 01023 ofs << ">> " << alg.name() << endl << *hist << endl; 01024 01025 }
| void HistorySvc::dumpState | ( | const IService & | svc, | |
| std::ofstream & | ofs | |||
| ) | const [private] |
Definition at line 1030 of file HistorySvc.cpp.
01030 { 01031 01032 ServiceHistory *hist = getServiceHistory( svc ); 01033 01034 if (hist == 0) { 01035 return; 01036 } 01037 01038 ofs << ">> " << svc.name() << endl << *hist << endl; 01039 01040 }
| void HistorySvc::dumpState | ( | std::ofstream & | ofs | ) | const [private] |
Definition at line 969 of file HistorySvc.cpp.
00969 { 00970 00971 00972 ofs << "GLOBAL" << std::endl; 00973 const JobHistory::PropertyList props = m_jobHistory->properties(); 00974 JobHistory::PropertyList::const_iterator itrj; 00975 for (itrj=props.begin(); itrj != props.end(); ++itrj) { 00976 std::string client = itrj->first; 00977 const Property* prp = itrj->second; 00978 ofs << client << " " << dumpProp(prp) << std::endl; 00979 } 00980 00981 00982 ofs << "SERVICES" << std::endl; 00983 std::map<const IService*, ServiceHistory*>::const_iterator itr_s; 00984 for (itr_s=m_svcmap.begin(); itr_s != m_svcmap.end(); ++itr_s) { 00985 const IService* svc = itr_s->first; 00986 00987 dumpState( *svc, ofs ); 00988 00989 } 00990 00991 ofs << "ALGORITHMS" << std::endl; 00992 std::map<const Algorithm*, AlgorithmHistory*>::const_iterator itr; 00993 for (itr=m_algmap.begin(); itr != m_algmap.end(); ++itr) { 00994 const Algorithm* alg = itr->first; 00995 00996 dumpState( *alg, ofs ); 00997 00998 } 00999 01000 01001 ofs << "ALGTOOLS" << std::endl; 01002 std::map<const AlgTool*, AlgToolHistory*>::const_iterator itr_a; 01003 for (itr_a=m_algtoolmap.begin(); itr_a != m_algtoolmap.end(); ++itr_a) { 01004 const AlgTool* alg = itr_a->first; 01005 01006 dumpState( *alg, ofs ); 01007 01008 } 01009 01010 }
| StatusCode HistorySvc::finalize | ( | ) | [virtual] |
Reimplemented from Service.
Definition at line 329 of file HistorySvc.cpp.
00329 { 00330 00331 00332 clearState(); 00333 00334 StatusCode status = Service::finalize(); 00335 00336 if ( status.isSuccess() ) 00337 m_log << MSG::INFO << "Service finalised successfully" << endmsg; 00338 00339 return status; 00340 00341 }
| void HistorySvc::getAlgHistory | ( | std::set< AlgorithmHistory * > & | algs | ) | const [virtual] |
Definition at line 437 of file HistorySvc.cpp.
00437 { 00438 00439 set<const Algorithm*>::const_iterator itr; 00440 for (itr=m_algs.begin(); itr!=m_algs.end(); ++itr) { 00441 AlgorithmHistory *ah = m_algmap.find(*itr)->second; 00442 00443 algs.insert(ah); 00444 } 00445 00446 }
| AlgorithmHistory * HistorySvc::getAlgHistory | ( | const Algorithm & | alg | ) | const [virtual] |
Definition at line 418 of file HistorySvc.cpp.
00418 { 00419 00420 const Algorithm *palg = &alg; 00421 set<const Algorithm*>::const_iterator itr = m_algs.find(palg); 00422 if ( itr == m_algs.end() ) { 00423 m_log << MSG::WARNING << "Algorithm " << alg.name() << " not registered" 00424 << endmsg; 00425 return 0; 00426 } 00427 00428 map<const Algorithm*, AlgorithmHistory*>::const_iterator itr2; 00429 itr2 = m_algmap.find( *itr ); 00430 00431 return ( itr2->second ); 00432 00433 }
| void HistorySvc::getAlgToolHistory | ( | std::set< AlgToolHistory * > & | algs | ) | const [virtual] |
Definition at line 931 of file HistorySvc.cpp.
00931 { 00932 00933 set<const AlgTool*>::const_iterator itr; 00934 for (itr=m_algtools.begin(); itr!=m_algtools.end(); ++itr) { 00935 AlgToolHistory *ah = m_algtoolmap.find(*itr)->second; 00936 00937 algs.insert(ah); 00938 } 00939 00940 }
| AlgToolHistory * HistorySvc::getAlgToolHistory | ( | const IAlgTool & | alg | ) | const [virtual] |
Definition at line 911 of file HistorySvc.cpp.
00911 { 00912 00913 const AlgTool *palg = dynamic_cast<const AlgTool*>(&alg); 00914 set<const AlgTool*>::const_iterator itr = m_algtools.find(palg); 00915 if ( itr == m_algtools.end() ) { 00916 m_log << MSG::WARNING << "AlgTool " << alg.name() << " not registered" 00917 << endmsg; 00918 return 0; 00919 } 00920 00921 map<const AlgTool*, AlgToolHistory*>::const_iterator itr2; 00922 itr2 = m_algtoolmap.find( *itr ); 00923 00924 return ( itr2->second ); 00925 00926 }
| IAlgorithm * HistorySvc::getCurrentIAlg | ( | ) | const [private] |
Definition at line 573 of file HistorySvc.cpp.
00573 { 00574 if (p_algCtxSvc == 0) { 00575 m_log << MSG::WARNING << "trying to create DataHistoryObj before " 00576 << "HistorySvc has been initialized" << endmsg; 00577 return 0; 00578 00579 } else { 00580 return p_algCtxSvc->currentAlg(); 00581 } 00582 }
| int HistorySvc::getDataHistory | ( | const CLID & | id, | |
| const std::string & | key, | |||
| const std::string & | storeName, | |||
| std::list< DataHistory * > & | dhlist | |||
| ) | const [virtual] |
Definition at line 689 of file HistorySvc.cpp.
00691 { 00692 00693 DHH dhh(id,key); 00694 00695 int n(0); 00696 00697 pair<DHMCitr,DHMCitr> mitr = m_datMap.equal_range(dhh); 00698 00699 for (DHMCitr itr=mitr.first; itr != mitr.second; ++itr) { 00700 dhlist.push_back(itr->second); 00701 n++; 00702 } 00703 00704 return n; 00705 00706 }
| DataHistory * HistorySvc::getDataHistory | ( | const CLID & | id, | |
| const std::string & | key, | |||
| const std::string & | store | |||
| ) | const [virtual] |
Definition at line 671 of file HistorySvc.cpp.
00672 { 00673 00674 DHH dhh(id,key); 00675 00676 pair<DHMCitr,DHMCitr> mitr = m_datMap.equal_range(dhh); 00677 00678 if(mitr.first == mitr.second) { 00679 return 0; 00680 } 00681 00682 return mitr.first->second; 00683 00684 }
| JobHistory * HistorySvc::getJobHistory | ( | ) | const [virtual] |
Definition at line 565 of file HistorySvc.cpp.
00565 { 00566 00567 return m_jobHistory; 00568 00569 }
| void HistorySvc::getServiceHistory | ( | std::set< ServiceHistory * > & | svcs | ) | const [virtual] |
Definition at line 764 of file HistorySvc.cpp.
00764 { 00765 00766 set<const IService*>::const_iterator itr; 00767 for (itr=m_svcs.begin(); itr!=m_svcs.end(); ++itr) { 00768 ServiceHistory *sh = m_svcmap.find( *itr )->second; 00769 00770 svcs.insert(sh); 00771 } 00772 00773 }
| ServiceHistory * HistorySvc::getServiceHistory | ( | const IService & | svc | ) | const [virtual] |
Definition at line 747 of file HistorySvc.cpp.
00747 { 00748 00749 const IService *psvc = &svc; 00750 map<const IService*, ServiceHistory*>::const_iterator itr = 00751 m_svcmap.find(psvc); 00752 if ( itr == m_svcmap.end() ) { 00753 m_log << MSG::WARNING << "Service " << svc.name() << " not registered" 00754 << endmsg; 00755 return 0; 00756 } 00757 00758 return ( itr->second ); 00759 00760 }
| void HistorySvc::handle | ( | const Incident & | inc | ) | [virtual] |
Definition at line 945 of file HistorySvc.cpp.
00945 { 00946 00947 if (incident.type() == IncidentType::BeginEvent) { 00948 if (captureState().isFailure()) { 00949 m_log << MSG::WARNING << "Error capturing state." << endl 00950 << "Will try again at next BeginEvent incident" << endmsg; 00951 } 00952 } 00953 00954 }
| 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 m_toolSvc = serviceLocator()->service("ToolSvc"); 00174 if (! m_toolSvc) { 00175 m_log << MSG::ERROR << "could not retrieve the ToolSvc handle !" 00176 << endmsg; 00177 return StatusCode::FAILURE; 00178 } 00179 00180 // add listener to be triggered by first BeginEvent with low priority 00181 // so it gets called first 00182 const bool rethrow = false; 00183 const bool oneShot = true; // make the listener called only once 00184 m_incidentSvc->addListener(this,IncidentType::BeginEvent, 00185 std::numeric_limits<long>::min(),rethrow,oneShot); 00186 00187 m_isInitialized = true; 00188 00189 return StatusCode::SUCCESS; 00190 00191 }
| StatusCode HistorySvc::listProperties | ( | const IAlgTool & | alg | ) | const [virtual] |
Definition at line 870 of file HistorySvc.cpp.
00870 { 00871 00872 m_log << MSG::INFO << "Dumping properties for " << alg.name() << endl; 00873 00874 AlgToolHistory *hist = getAlgToolHistory( alg ); 00875 00876 if (hist == 0) { 00877 return StatusCode::FAILURE; 00878 } 00879 00880 ostringstream ost; 00881 ost << *hist; 00882 00883 std::string str = ost.str(); 00884 00885 m_log << MSG::INFO << alg.name() << " --> " << endl << str << endmsg; 00886 00887 return StatusCode::SUCCESS; 00888 00889 }
| StatusCode HistorySvc::listProperties | ( | const Algorithm & | alg | ) | const [virtual] |
Definition at line 378 of file HistorySvc.cpp.
00378 { 00379 00380 m_log << MSG::INFO << "Dumping properties for " << alg.name() << endl; 00381 00382 AlgorithmHistory *hist = getAlgHistory( alg ); 00383 00384 if (hist == 0) { 00385 return StatusCode::FAILURE; 00386 } 00387 00388 ostringstream ost; 00389 ost << *hist; 00390 00391 std::string str = ost.str(); 00392 00393 m_log << MSG::INFO << alg.name() << " --> " << endl << str << endmsg; 00394 00395 return StatusCode(StatusCode::SUCCESS,true); 00396 00397 }
| StatusCode HistorySvc::listProperties | ( | const IService & | svc | ) | const [virtual] |
Definition at line 778 of file HistorySvc.cpp.
00778 { 00779 00780 m_log << MSG::INFO << "Dumping properties for " << svc.name() << endl; 00781 00782 ServiceHistory *hist = getServiceHistory( svc ); 00783 00784 if (hist == 0) { 00785 return StatusCode::FAILURE; 00786 } 00787 00788 ostringstream ost; 00789 ost << *hist; 00790 00791 std::string str = ost.str(); 00792 00793 m_log << MSG::INFO << svc.name() << " --> " << endl << str << endmsg; 00794 00795 00796 00797 return StatusCode(StatusCode::SUCCESS,true); 00798 00799 }
| StatusCode HistorySvc::listProperties | ( | ) | const [virtual] |
Definition at line 462 of file HistorySvc.cpp.
00462 { 00463 00464 m_log << MSG::INFO; 00465 m_log.setColor(MSG::CYAN); 00466 m_log << "Dumping properties for all Algorithms (" << m_algmap.size() 00467 << ")" << endmsg; 00468 00469 std::map<const Algorithm*, AlgorithmHistory*>::const_iterator itr; 00470 for (itr=m_algmap.begin(); itr != m_algmap.end(); ++itr) { 00471 const Algorithm* alg = itr->first; 00472 00473 listProperties( *alg ).ignore(); 00474 00475 } 00476 00477 m_log << MSG::INFO; 00478 m_log.setColor(MSG::CYAN); 00479 m_log << "Dumping properties for all AlgTools (" << m_algtoolmap.size() 00480 << ")" << endmsg; 00481 00482 std::map<const AlgTool*, AlgToolHistory*>::const_iterator itr_a; 00483 for (itr_a=m_algtoolmap.begin(); itr_a != m_algtoolmap.end(); ++itr_a) { 00484 m_log << MSG::DEBUG << " --> " << itr_a->second->algtool_name() << endmsg; 00485 const AlgTool* alg = itr_a->first; 00486 00487 listProperties( *alg ).ignore(); 00488 00489 } 00490 00491 m_log << MSG::INFO; 00492 m_log.setColor(MSG::CYAN); 00493 m_log << "Dumping properties for all Services (" << m_svcmap.size() 00494 << ")" << endmsg; 00495 00496 std::map<const IService*, ServiceHistory*>::const_iterator itr_s; 00497 for (itr_s=m_svcmap.begin(); itr_s != m_svcmap.end(); ++itr_s) { 00498 const IService* svc = itr_s->first; 00499 00500 listProperties( *svc ).ignore(); 00501 00502 } 00503 00504 m_log << MSG::INFO; 00505 m_log.setColor(MSG::CYAN); 00506 m_log << "Dumping properties for Job"; 00507 m_log.resetColor(); 00508 00509 ostringstream ost; 00510 ost << *m_jobHistory; 00511 std::string str = ost.str(); 00512 00513 m_log << std::endl << str << endmsg; 00514 00515 return StatusCode(StatusCode::SUCCESS,true); 00516 00517 }
| StatusCode HistorySvc::registerAlg | ( | const Algorithm & | alg | ) | [virtual] |
Definition at line 349 of file HistorySvc.cpp.
00349 { 00350 00351 JobHistory *job = getJobHistory(); 00352 if (m_algmap.find(&alg) != m_algmap.end()) { 00353 m_log << MSG::WARNING << "Algorithm " << alg.name() 00354 << " already registered with HistorySvc" << endmsg; 00355 return StatusCode::SUCCESS; 00356 } 00357 00358 (const_cast<Algorithm*>(&alg))->addRef(); 00359 00360 m_algs.insert(&alg); 00361 00362 AlgorithmHistory *algHist = new AlgorithmHistory(alg, job); 00363 m_algmap[&alg] = algHist; 00364 00365 #ifndef NDEBUG 00366 m_log << MSG::DEBUG << "Registering algorithm: "; 00367 m_log.setColor(MSG::CYAN); 00368 m_log << alg.name() << endmsg; 00369 m_log.resetColor(); 00370 #endif 00371 00372 return StatusCode(StatusCode::SUCCESS,true); 00373 00374 }
| StatusCode HistorySvc::registerAlgTool | ( | const IAlgTool & | ialg | ) | [virtual] |
Definition at line 822 of file HistorySvc.cpp.
00822 { 00823 00824 if (! m_isInitialized) { 00825 if (p_algCtxSvc == 0) { 00826 if ( service("AlgContextSvc",p_algCtxSvc,true).isFailure() ) { 00827 m_log << MSG::ERROR << "unable to get the AlgContextSvc" << endmsg; 00828 return StatusCode::FAILURE; 00829 } 00830 } 00831 00832 m_ialgtools.insert(&ialg); 00833 return StatusCode::SUCCESS; 00834 } 00835 00836 const AlgTool *alg = dynamic_cast<const AlgTool*>( &ialg ); 00837 if ( alg == 0 ) { 00838 m_log << MSG::ERROR << "Could not dcast IAlgTool \"" << ialg.name() 00839 << "\" to an AlgTool" << endmsg; 00840 return StatusCode::FAILURE; 00841 } 00842 00843 if (m_algtools.find(alg) != m_algtools.end()) { 00844 m_log << MSG::WARNING << "AlgTool " << ialg.name() 00845 << " already registered in HistorySvc" << endmsg; 00846 return StatusCode::SUCCESS; 00847 } 00848 00849 m_algtools.insert(alg); 00850 (const_cast<AlgTool*>(alg))->addRef(); 00851 00852 const JobHistory *job = getJobHistory(); 00853 AlgToolHistory *algHist = new AlgToolHistory(*alg, job); 00854 m_algtoolmap[alg] = algHist; 00855 00856 #ifndef NDEBUG 00857 m_log << MSG::DEBUG << "Registering algtool: "; 00858 m_log.setColor(MSG::CYAN); 00859 m_log << alg->name() << endmsg; 00860 m_log.resetColor(); 00861 #endif 00862 00863 return StatusCode::SUCCESS; 00864 00865 }
| StatusCode HistorySvc::registerDataHistory | ( | const CLID & | id, | |
| const std::string & | key, | |||
| const std::string & | store | |||
| ) | [virtual] |
Definition at line 627 of file HistorySvc.cpp.
00628 { 00629 00630 DHH dhh(id,key); 00631 00632 pair<DHMitr,DHMitr> mitr = m_datMap.equal_range(dhh); 00633 00634 if (mitr.first == mitr.second) { 00635 // not in the map 00636 DataHistory *dh = createDataHistoryObj(id,key,storeName); 00637 m_datMap.insert(pair<DHH,DataHistory*>(dhh,dh)); 00638 } else { 00639 // found at least one 00640 bool match(false); 00641 00642 std::string algName; 00643 IAlgorithm *ialg = getCurrentIAlg(); 00644 if (ialg != 0) { 00645 algName = ialg->name(); 00646 } else { 00647 algName = "UNKNOWN"; 00648 } 00649 00650 for (DHMitr itr = mitr.first; itr != mitr.second; ++itr) { 00651 DataHistory *dh = itr->second; 00652 if (dh->algorithmHistory()->algorithm_name() == algName) { 00653 match = true; 00654 break; 00655 } 00656 } 00657 00658 if (! match) { 00659 DataHistory *dh = createDataHistoryObj(id,key,storeName); 00660 m_datMap.insert(pair<DHH,DataHistory*>(dhh,dh)); 00661 } 00662 } 00663 00664 return StatusCode::SUCCESS; 00665 00666 }
| StatusCode HistorySvc::registerJob | ( | ) | [virtual] |
Definition at line 451 of file HistorySvc.cpp.
00451 { 00452 00453 00454 return StatusCode(StatusCode::SUCCESS,true); 00455 00456 00457 }
| StatusCode HistorySvc::registerSvc | ( | const IService & | svc | ) | [virtual] |
Definition at line 711 of file HistorySvc.cpp.
00711 { 00712 00713 if ( svc.name() == "HistoryStore" ) { 00714 // m_log << MSG::WARNING << "not registering store" << endmsg; 00715 return StatusCode(StatusCode::SUCCESS,true); 00716 } 00717 00718 JobHistory *job = getJobHistory(); 00719 const IService* psvc = &svc; 00720 map<const IService*, ServiceHistory*>::const_iterator itr = 00721 m_svcmap.find(psvc); 00722 if (itr == m_svcmap.end()) { 00723 00724 #ifndef NDEBUG 00725 m_log << MSG::DEBUG << "Registering Service: "; 00726 m_log.setColor(MSG::CYAN); 00727 m_log << svc.name() << endmsg; 00728 #endif 00729 00730 m_svcs.insert(psvc); 00731 00732 ServiceHistory *svcHist = new ServiceHistory(&svc, job); 00733 m_svcmap[psvc] = svcHist; 00734 00735 (const_cast<IService*>(psvc))->addRef(); 00736 00737 } 00738 00739 m_log.resetColor(); 00740 return StatusCode(StatusCode::SUCCESS,true); 00741 00742 }
| 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::stop | ( | ) | [virtual] |
Reimplemented from Service.
Definition at line 298 of file HistorySvc.cpp.
00298 { 00299 00300 if (!m_activate) return StatusCode::SUCCESS; 00301 00302 if (m_dump) { 00303 listProperties().ignore(); 00304 } 00305 00306 if (m_outputFile != "") { 00307 std::ofstream ofs; 00308 ofs.open(m_outputFile.c_str()); 00309 if (!ofs) { 00310 m_log << MSG::ERROR << "Unable to open output file \"m_outputFile\"" 00311 << endmsg; 00312 } else { 00313 00314 // dumpProperties(ofs); 00315 dumpState(ofs); 00316 00317 ofs.close(); 00318 } 00319 } 00320 00321 clearState(); 00322 00323 return StatusCode::SUCCESS; 00324 00325 }
friend class SvcFactory< HistorySvc > [friend] |
Definition at line 105 of file HistorySvc.h.
bool HistorySvc::m_activate [private] |
Definition at line 109 of file HistorySvc.h.
std::map<const Algorithm*, AlgorithmHistory*> HistorySvc::m_algmap [private] |
Definition at line 114 of file HistorySvc.h.
std::set<const Algorithm*> HistorySvc::m_algs [private] |
Definition at line 113 of file HistorySvc.h.
std::map<const AlgTool*, AlgToolHistory*> HistorySvc::m_algtoolmap [private] |
Definition at line 118 of file HistorySvc.h.
std::set<const AlgTool*> HistorySvc::m_algtools [private] |
Definition at line 117 of file HistorySvc.h.
std::multimap<DHH, DataHistory*> HistorySvc::m_datMap [private] |
Definition at line 123 of file HistorySvc.h.
bool HistorySvc::m_dump [private] |
Definition at line 108 of file HistorySvc.h.
std::set<const IAlgTool*> HistorySvc::m_ialgtools [private] |
Definition at line 116 of file HistorySvc.h.
IIncidentSvc* HistorySvc::m_incidentSvc [private] |
Definition at line 145 of file HistorySvc.h.
bool HistorySvc::m_isInitialized [private] |
Definition at line 107 of file HistorySvc.h.
JobHistory* HistorySvc::m_jobHistory [private] |
Definition at line 127 of file HistorySvc.h.
MsgStream HistorySvc::m_log [mutable, private] |
Definition at line 148 of file HistorySvc.h.
std::string HistorySvc::m_outputFile [private] |
Definition at line 129 of file HistorySvc.h.
std::map<const IService*, ServiceHistory*> HistorySvc::m_svcmap [private] |
Definition at line 121 of file HistorySvc.h.
std::set<const IService*> HistorySvc::m_svcs [private] |
Definition at line 120 of file HistorySvc.h.
SmartIF<IToolSvc> HistorySvc::m_toolSvc [private] |
Definition at line 146 of file HistorySvc.h.
IAlgContextSvc* HistorySvc::p_algCtxSvc [private] |
Definition at line 111 of file HistorySvc.h.