| The Gaudi Framework v28r2p1 (f1a77ff4)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
HistorySvc Class Reference

HistorySvc class definition. More...

`#include <src/HistorySvc.h>`

Inheritance diagram for HistorySvc:
[legend]
Collaboration diagram for HistorySvc:
[legend]

## Public Member Functions
StatusCode | initialize () override
StatusCode | reinitialize () override
StatusCode | finalize () override
StatusCode | stop () override
virtual StatusCode | captureState ()
StatusCode | registerJob () override
StatusCode | listProperties () const override
JobHistory * | getJobHistory () const override
StatusCode | registerSvc (const IService &) override
StatusCode | listProperties (const IService &) const override
ServiceHistory * | getServiceHistory (const IService &) const override
void | getServiceHistory (std::set< ServiceHistory * > &) const override
StatusCode | registerAlg (const Algorithm &) override
StatusCode | listProperties (const Algorithm &) const override
AlgorithmHistory * | getAlgHistory (const Algorithm &) const override
void | getAlgHistory (std::set< AlgorithmHistory * > &) const override
StatusCode | registerAlgTool (const IAlgTool &) override
StatusCode | listProperties (const IAlgTool &) const override
AlgToolHistory * | getAlgToolHistory (const IAlgTool &) const override
void | getAlgToolHistory (std::set< AlgToolHistory * > &) const override
DataHistory * | createDataHistoryObj (const CLID &id, const std::string &key, const std::string &store) override
virtual StatusCode | registerDataHistory (const CLID &id, const std::string &key, const std::string &store)
DataHistory * | getDataHistory (const CLID &id, const std::string &key, const std::string &store) const override
virtual int | getDataHistory (const CLID &id, const std::string &key, const std::string &storeName, std::list< DataHistory * > &dhlist) const
void | handle (const Incident &inc) override
| ~HistorySvc () override=default
Public Member Functions inherited from extends< Service, IHistorySvc, IIncidentListener >
void * | i_cast (const InterfaceID &tid) const override
| Implementation of IInterface::i_cast. More...
StatusCode | queryInterface (const InterfaceID &ti, void **pp) override
| Implementation of IInterface::queryInterface. More...
std::vector< std::string > | getInterfaceNames () const override
| Implementation of IInterface::getInterfaceNames. More...
| ~extends () override=default
| Virtual destructor. More...
Public Member Functions inherited from Service
const std::string & | name () const override
| Retrieve name of the service. More...
StatusCode | configure () override
StatusCode | initialize () override
StatusCode | start () override
StatusCode | stop () override
StatusCode | finalize () override
StatusCode | terminate () override
Gaudi::StateMachine::State | FSMState () const override
Gaudi::StateMachine::State | targetFSMState () const override
StatusCode | reinitialize () override
StatusCode | restart () override
StatusCode | sysInitialize () override
| Initialize Service. More...
StatusCode | sysStart () override
| Initialize Service. More...
StatusCode | sysStop () override
| Initialize Service. More...
StatusCode | sysFinalize () override
| Finalize Service. More...
StatusCode | sysReinitialize () override
| Re-initialize the Service. More...
StatusCode | sysRestart () override
| Re-initialize the Service. More...
| Service (std::string name, ISvcLocator *svcloc)
| Standard Constructor. More...
SmartIF< ISvcLocator > & | serviceLocator () const override
| Retrieve pointer to service locator. More...
StatusCode | setProperties ()
| Method for setting declared properties to the values specified for the job. More...
template<class T >
StatusCode | service (const std::string &name, const T *&psvc, bool createIf=true) const
| Access a service by name, creating it if it doesn't already exist. More...
template<class T >
StatusCode | service (const std::string &name, T *&psvc, bool createIf=true) const
template<typename IFace = IService>
SmartIF< IFace > | service (const std::string &name, bool createIf=true) const
template<class T >
StatusCode | service (const std::string &svcType, const std::string &svcName, T *&psvc) const
| Access a service by name and type, creating it if it doesn't already exist. More...
template<class T >
StatusCode | declarePrivateTool (ToolHandle< T > &handle, std::string toolTypeAndName="", bool createIf=true)
| Declare used Private tool. More...
template<class T >
StatusCode | declarePublicTool (ToolHandle< T > &handle, std::string toolTypeAndName="", bool createIf=true)
| Declare used Public tool. More...
SmartIF< IAuditorSvc > & | auditorSvc () const
| The standard auditor service.May not be invoked before sysInitialize() has been invoked. More...
Public Member Functions inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
| PropertyHolder ()=default
| ~PropertyHolder () override=default
Gaudi::Details::PropertyBase & | declareProperty (Gaudi::Details::PropertyBase &prop)
| Declare a property. More...
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, TYPE &value, const std::string &doc="none")
| Helper to wrap a regular data member and use it as a regular property. More...
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, TYPE &value, const std::string &doc="none") const
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, Gaudi::Property< TYPE, VERIFIER, HANDLERS > &prop, const std::string &doc="none")
| Declare a PropertyBase instance setting name and documentation. More...
Gaudi::Details::PropertyBase * | declareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="")
| Declare a remote property. More...
StatusCode | setProperty (const Gaudi::Details::PropertyBase &p) override
| set the property form another property More...
StatusCode | setProperty (const std::string &s) override
| set the property from the formatted string More...
StatusCode | setProperty (const std::string &n, const std::string &v) override
| set the property from name and the value More...
StatusCode | setProperty (const std::string &name, const TYPE &value)
| set the property form the value More...
StatusCode | getProperty (Gaudi::Details::PropertyBase *p) const override
| get the property More...
const Gaudi::Details::PropertyBase & | getProperty (const std::string &name) const override
| get the property by name More...
StatusCode | getProperty (const std::string &n, std::string &v) const override
| convert the property to the string More...
const std::vector< Gaudi::Details::PropertyBase * > & | getProperties () const override
| get all properties More...
bool | hasProperty (const std::string &name) const override
| Return true if we have a property with the given name. More...
| PropertyHolder (const PropertyHolder &)=delete
PropertyHolder & | operator= (const PropertyHolder &)=delete
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, GaudiHandleBase &ref, const std::string &doc="none")
| Specializations for various GaudiHandles. More...
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, GaudiHandleArrayBase &ref, const std::string &doc="none")
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, DataObjectHandleBase &ref, const std::string &doc="none")
Public Member Functions inherited from CommonMessagingBase
virtual | ~CommonMessagingBase ()=default
| Virtual destructor. More...
SmartIF< IMessageSvc > & | msgSvc () const
| The standard message service. More...
MsgStream & | msgStream () const
| Return an uninitialized MsgStream. More...
MsgStream & | msgStream (const MSG::Level level) const
| Predefined configurable message stream for the efficient printouts. More...
MsgStream & | always () const
| shortcut for the method msgStream(MSG::ALWAYS) More...
MsgStream & | fatal () const
| shortcut for the method msgStream(MSG::FATAL) More...
MsgStream & | err () const
| shortcut for the method msgStream(MSG::ERROR) More...
MsgStream & | error () const
| shortcut for the method msgStream(MSG::ERROR) More...
MsgStream & | warning () const
| shortcut for the method msgStream(MSG::WARNING) More...
MsgStream & | info () const
| shortcut for the method msgStream(MSG::INFO) More...
MsgStream & | debug () const
| shortcut for the method msgStream(MSG::DEBUG) More...
MsgStream & | verbose () const
| shortcut for the method msgStream(MSG::VERBOSE) More...
MsgStream & | msg () const
| shortcut for the method msgStream(MSG::INFO) More...
MSG::Level | msgLevel () const
| get the output level from the embedded MsgStream More...
MSG::Level | outputLevel () const __attribute__((deprecated))
| Backward compatibility function for getting the output level. More...
bool | msgLevel (MSG::Level lvl) const
| get the output level from the embedded MsgStream More...
Public Member Functions inherited from extend_interfaces< Interfaces... >
| ~extend_interfaces () override=default
| Virtual destructor. More...

## Private Types
typedef IVersHistoryObj::PropertyList | PropertyList
typedef std::multimap< DHH, DataHistory * > | DataHistMap
typedef DataHistMap::iterator | DHMitr
typedef DataHistMap::const_iterator | DHMCitr

## Private Member Functions
void | clearState ()
void | dumpProperties (std::ofstream &) const
void | dumpProperties (const IService &, std::ofstream &) const
void | dumpProperties (const Algorithm &, std::ofstream &) const
void | dumpProperties (const IAlgTool &, std::ofstream &) const
void | dumpState (std::ofstream &) const
void | dumpState (const INamedInterface *, std::ofstream &) const
std::string | dumpProp (const Gaudi::Details::PropertyBase *, const bool isXML=false, int indent=0) const
IAlgorithm * | getCurrentIAlg () const

## Private Attributes
Gaudi::Property< bool > | m_dump {this, "Dump", false}
Gaudi::Property< bool > | m_activate {this, "Activate", true}
Gaudi::Property< std::string > | m_outputFile {this, "OutputFile"}
bool | m_isInitialized = false
IAlgContextSvc * | p_algCtxSvc = nullptr
std::map< const Algorithm *, AlgorithmHistory * > | m_algmap
std::set< const IAlgTool * > | m_ialgtools
std::map< const AlgTool *, AlgToolHistory * > | m_algtoolmap
std::map< const IService *, ServiceHistory * > | m_svcmap
std::multimap< DHH, DataHistory * > | m_datMap
std::unique_ptr< JobHistory > | m_jobHistory
IIncidentSvc * | m_incidentSvc = nullptr
SmartIF< IToolSvc > | m_toolSvc
bool | m_outputFileTypeXML = false

## Additional Inherited Members
Public Types inherited from extends< Service, IHistorySvc, IIncidentListener >
using | base_class = extends
| Typedef to this class. More...
using | extend_interfaces_base = extend_interfaces< Interfaces... >
| Typedef to the base of this class. More...
Public Types inherited from Service
typedef Gaudi::PluginService::Factory< IService *, const std::string &, ISvcLocator * > | Factory
Public Types inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
using | PropertyHolderImpl = PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
| Typedef used to refer to this class from derived classes, as in. More...
Public Types inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
using | base_class = CommonMessaging
Public Types inherited from extend_interfaces< Interfaces... >
using | ext_iids = typename Gaudi::interface_list_cat< typename Interfaces::ext_iids... >::type
| take union of the ext_iids of all Interfaces... More...
Protected Member Functions inherited from Service
| ~Service () override
| Standard Destructor. More...
int | outputLevel () const
| get the `Service's` output level More...
Protected Member Functions inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
Gaudi::Details::PropertyBase * | property (const std::string &name) const
Protected Member Functions inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
void | updateMsgStreamOutputLevel (int level)
| Update the output level of the cached MsgStream. More...
Protected Attributes inherited from Service
Gaudi::StateMachine::State | m_state = Gaudi::StateMachine::OFFLINE
| Service state. More...
Gaudi::StateMachine::State | m_targetState = Gaudi::StateMachine::OFFLINE
| Service state. More...
Gaudi::Property< int > | m_outputLevel {this, "OutputLevel", MSG::NIL, "output level"}
Gaudi::Property< bool > | m_auditInit {this, "AuditServices", false, "[[deprecated]] unused"}
Gaudi::Property< bool > | m_auditorInitialize {this, "AuditInitialize", false, "trigger auditor on initialize()"}
Gaudi::Property< bool > | m_auditorStart {this, "AuditStart", false, "trigger auditor on start()"}
Gaudi::Property< bool > | m_auditorStop {this, "AuditStop", false, "trigger auditor on stop()"}
Gaudi::Property< bool > | m_auditorFinalize {this, "AuditFinalize", false, "trigger auditor on finalize()"}
Gaudi::Property< bool > | m_auditorReinitialize {this, "AuditReinitialize", false, "trigger auditor on reinitialize()"}
Gaudi::Property< bool > | m_auditorRestart {this, "AuditRestart", false, "trigger auditor on restart()"}
SmartIF< IAuditorSvc > | m_pAuditorSvc
| Auditor Service. More...

## Detailed Description

HistorySvc class definition.

Definition at line 36 of file HistorySvc.h.

## Member Typedef Documentation

typedef std::multimap<DHH, DataHistory*> HistorySvc::DataHistMap
| private

Definition at line 84 of file HistorySvc.h.

typedef DataHistMap::const_iterator HistorySvc::DHMCitr
| private

Definition at line 86 of file HistorySvc.h.

typedef DataHistMap::iterator HistorySvc::DHMitr
| private

Definition at line 85 of file HistorySvc.h.

typedef IVersHistoryObj::PropertyList HistorySvc::PropertyList
| private

Definition at line 82 of file HistorySvc.h.

## Constructor & Destructor Documentation

HistorySvc::~HistorySvc | ( |  | ) |
| override default

## Member Function Documentation

StatusCode HistorySvc::captureState | ( |  | ) |
| virtual

Get all the Algorithms

Get all the AlgTools

Get all the Services

Definition at line 169 of file HistorySvc.cpp.

170 {
171
172 if ( !m_jobHistory ) {
173 m_jobHistory.reset( new JobHistory );
174 IJobOptionsSvc* jo;
175 if ( service( "JobOptionsSvc", jo ).isFailure() ) {
176 error() << "Could not get jobOptionsSvc - "
177 << "not adding properties to JobHistory" << endmsg;
178 } else {
179
180 bool foundAppMgr( false );
181
182 for ( auto& client : jo->getClients() ) {
183 if ( client == "ApplicationMgr" ) foundAppMgr = true;
184 for ( auto prop : *jo->getProperties( client ) ) {
185 m_jobHistory->addProperty( client, prop );
186 }
187 }
188
189 if ( !foundAppMgr ) {
190 auto ap = service<IProperty>( "ApplicationMgr" );
191 if ( !ap ) {
192 error() << "could not get the ApplicationMgr" << endmsg;
193 } else {
194 for ( auto prop : ap->getProperties() ) {
195 m_jobHistory->addProperty( "ApplicationMgr", prop );
196 }
197 }
198 }
199 }
200 }
201
203
204 auto algMgr = Gaudi::svcLocator()->as<IAlgManager>();
205 if ( !algMgr ) {
206 error() << "Could not get AlgManager" << endmsg;
207 return StatusCode::FAILURE;
208 }
209
210 size_t count = 0;
211 for ( auto ialg : algMgr->getAlgorithms() ) {
212 Algorithm* alg = dynamic_cast<Algorithm*>( ialg );
213 if ( !alg ) {
214 warning() << "Algorithm " << ialg->name() << " does not inherit from Algorithm. Not registering it." << endmsg;
215 } else {
216 ++count;
217 registerAlg( *alg ).ignore();
218 }
219 }
220
221 info() << "Registered " << count << " Algorithms" << endmsg;
222
224
225 m_isInitialized = true;
226 for ( auto algtool : m_ialgtools ) {
227 ( const_cast<IAlgTool*>( algtool ) )->addRef();
228 registerAlgTool( *algtool ).ignore();
229 }
230
231 info() << "Registered " << m_algtoolmap.size() << " AlgTools" << endmsg;
232
234
235 for ( auto svc : Gaudi::svcLocator()->getServices() ) {
236 svc->addRef();
237 registerSvc( *svc ).ignore();
238 }
239
240 info() << "Registered " << Gaudi::svcLocator()->getServices().size() << " Services" << endmsg;
241
242 return StatusCode::SUCCESS;
243 }
StatusCode::SUCCESS
Definition: StatusCode.h:30
StatusCode::FAILURE
Definition: StatusCode.h:29
HistorySvc::registerSvc
StatusCode registerSvc(const IService &) override
Definition: HistorySvc.cpp:535
HistorySvc::registerAlgTool
StatusCode registerAlgTool(const IAlgTool &) override
Definition: HistorySvc.cpp:612
CommonMessagingBase::info
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
Definition: CommonMessaging.h:123
HistorySvc::registerAlg
StatusCode registerAlg(const Algorithm &) override
Definition: HistorySvc.cpp:293
IAlgManager
The IAlgManager is the interface implemented by the Algorithm Factory in the Application Manager to s...
Definition: IAlgManager.h:27
ISvcLocator::as
SmartIF< IFace > as()
Definition: ISvcLocator.h:106
HistorySvc::m_algtoolmap
std::map< const AlgTool *, AlgToolHistory * > m_algtoolmap
Definition: HistorySvc.h:101
JobHistory
JobHistory class definition.
Definition: JobHistory.h:22
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:117
JobHistory::addProperty
void addProperty(const std::string &, const Gaudi::Details::PropertyBase *)
Definition: JobHistory.cpp:85
IJobOptionsSvc
Main interface for the JobOptions service.
Definition: IJobOptionsSvc.h:20
CommonMessagingBase::warning
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
Definition: CommonMessaging.h:120
Gaudi::svcLocator
GAUDI_API ISvcLocator * svcLocator()
HistorySvc::m_isInitialized
bool m_isInitialized
Definition: HistorySvc.h:94
IJobOptionsSvc::getClients
virtual std::vector< std::string > getClients() const =0
Get the list of clients.
std::unique_ptr::reset
T reset(T...args)
IJobOptionsSvc::getProperties
virtual const std::vector< const Gaudi::Details::PropertyBase * > * getProperties(const std::string &client) const =0
Get the properties associated to a given client.
std::count
T count(T...args)
Algorithm
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:78
std::map::size
T size(T...args)
IAlgTool
The interface implemented by the AlgTool base class.
Definition: IAlgTool.h:23
ISvcLocator::getServices
virtual const std::list< IService * > & getServices() const =0
Get a reference to a service and create it if it does not exists.
Service::service
StatusCode service(const std::string &name, const T *&psvc, bool createIf=true) const
Access a service by name, creating it if it doesn&#39;t already exist.
Definition: Service.h:85
HistorySvc::m_ialgtools
std::set< const IAlgTool * > m_ialgtools
Definition: HistorySvc.h:100
StatusCode::ignore
void ignore() const
Definition: StatusCode.h:106
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
HistorySvc::m_jobHistory
std::unique_ptr< JobHistory > m_jobHistory
Definition: HistorySvc.h:106

void HistorySvc::clearState | ( |  | ) |
| private

Definition at line 107 of file HistorySvc.cpp.

108 {
109 clear( m_algmap );
110
111 m_ialgtools.clear();
112 clear( m_algtoolmap );
113
114 clear( m_svcmap );
115 }
HistorySvc::m_algtoolmap
std::map< const AlgTool *, AlgToolHistory * > m_algtoolmap
Definition: HistorySvc.h:101
std::set::clear
T clear(T...args)
HistorySvc::m_algmap
std::map< const Algorithm *, AlgorithmHistory * > m_algmap
Definition: HistorySvc.h:98
HistorySvc::m_ialgtools
std::set< const IAlgTool * > m_ialgtools
Definition: HistorySvc.h:100
HistorySvc::m_svcmap
std::map< const IService *, ServiceHistory * > m_svcmap
Definition: HistorySvc.h:102

DataHistory * HistorySvc::createDataHistoryObj | ( | const CLID & | id,
|  | const std::string & | key,
|  | const std::string & | store
| ) |  |
| override

Definition at line 443 of file HistorySvc.cpp.

445 {
446
447 if ( !m_activate ) return nullptr;
448
449 AlgorithmHistory* algHist = nullptr;
450
451 IAlgorithm* ialg = getCurrentIAlg();
452 if ( !ialg ) {
453 ON_DEBUG
454 debug() << "Could not discover current Algorithm:" << endl
455 << " object CLID: " << id << " key: \"" << key << "\"" << endmsg;
456 algHist = nullptr;
457 } else {
458 Algorithm* alg = dynamic_cast<Algorithm*>( ialg );
459 if ( alg ) {
460 algHist = getAlgHistory( *alg );
461 } else {
462 warning() << "Could not extract concrete Algorithm:" << endl
463 << " object CLID: " << id << " key: \"" << key << "\"" << endmsg;
464 algHist = nullptr;
465 }
466 }
467 return new DataHistory( id, key, algHist );
468 }
AlgorithmHistory
AlgorithmHistory class definition.
Definition: AlgorithmHistory.h:26
std::endl
T endl(T...args)
HistorySvc::getAlgHistory
AlgorithmHistory * getAlgHistory(const Algorithm &) const override
Definition: HistorySvc.cpp:352
HistorySvc::getCurrentIAlg
IAlgorithm * getCurrentIAlg() const
Definition: HistorySvc.cpp:433
CommonMessagingBase::warning
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
Definition: CommonMessaging.h:120
ON_DEBUG
#define ON_DEBUG
Definition: HistorySvc.cpp:40
DataHistory
DataHistory class definition.
Definition: DataHistory.h:23
IAlgorithm
The IAlgorithm is the interface implemented by the Algorithm base class.
Definition: IAlgorithm.h:27
Algorithm
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:78
CommonMessagingBase::debug
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
Definition: CommonMessaging.h:126
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
HistorySvc::m_activate
Gaudi::Property< bool > m_activate
Definition: HistorySvc.h:89

std::string HistorySvc::dumpProp | ( | const Gaudi::Details::PropertyBase * | prop,
|  | const bool | isXML = `false`,
|  | int | indent = `0`
| ) |  | const
| private

Definition at line 713 of file HistorySvc.cpp.

714 {
715 std::ostringstream ost;
716 if ( isXML ) {
717 while ( ind > 0 ) {
718 ost << " ";
719 ind--;
720 }
721 ost << "<PROPERTY name=\"" << prop->name() << "\" value=\"" << HistoryObj::convert_string( prop->toString() )
722 << "\" documentation=\"" << HistoryObj::convert_string( prop->documentation() ) << "\">";
723 } else {
724 prop->fillStream( ost );
725 }
726 return ost.str();
727 }
Gaudi::Details::PropertyBase::name
const std::string name() const
property name
Definition: Property.h:40
Gaudi::Details::PropertyBase::toString
virtual std::string toString() const =0
value -> string
std::ostringstream
STL class.
std::ostringstream::str
T str(T...args)
Gaudi::Details::PropertyBase::fillStream
virtual std::ostream & fillStream(std::ostream &) const
the printout of the property value
Definition: Property.cpp:52
HistoryObj::convert_string
static std::string convert_string(const std::string &)
Definition: HistoryObj.cpp:21
Gaudi::Details::PropertyBase::documentation
std::string documentation() const
property documentation
Definition: Property.h:42

void HistorySvc::dumpProperties | ( | std::ofstream & | ofs | ) | const
| private

Definition at line 411 of file HistorySvc.cpp.

412 {
413
414 ofs << "GLOBAL" << std::endl;
415 for ( const auto& prop : m_jobHistory->propertyPairs() ) {
416 ofs << prop.first << " " << dumpProp( prop.second ) << std::endl;
417 }
418
419 ofs << std::endl << "SERVICES" << std::endl;
420 for ( const auto& s : m_svcmap ) dumpProperties( *s.first, ofs );
421
422 ofs << std::endl << "ALGORITHMS" << std::endl;
423 for ( const auto& alg : m_algmap ) dumpProperties( *alg.first, ofs );
424
425 ofs << std::endl << "ALGTOOLS" << std::endl;
426 for ( const auto& tool : m_algtoolmap ) dumpProperties( *tool.first, ofs );
427 }
HistorySvc::dumpProp
std::string dumpProp(const Gaudi::Details::PropertyBase *, const bool isXML=false, int indent=0) const
Definition: HistorySvc.cpp:713
std::endl
T endl(T...args)
HistorySvc::m_algtoolmap
std::map< const AlgTool *, AlgToolHistory * > m_algtoolmap
Definition: HistorySvc.h:101
JobHistory::propertyPairs
const PropertyPairList & propertyPairs() const
Definition: JobHistory.h:72
HistorySvc::dumpProperties
void dumpProperties(std::ofstream &) const
Definition: HistorySvc.cpp:411
gaudirun.s
string s
Definition: gaudirun.py:245
HistorySvc::m_algmap
std::map< const Algorithm *, AlgorithmHistory * > m_algmap
Definition: HistorySvc.h:98
HistorySvc::m_svcmap
std::map< const IService *, ServiceHistory * > m_svcmap
Definition: HistorySvc.h:102
HistorySvc::m_jobHistory
std::unique_ptr< JobHistory > m_jobHistory
Definition: HistorySvc.h:106

void HistorySvc::dumpProperties | ( | const IService & | svc,
|  | std::ofstream & | ofs
| ) |  | const
| private

Definition at line 598 of file HistorySvc.cpp.

599 {
600
601 ServiceHistory* hist = getServiceHistory( svc );
602
603 if ( !hist ) return;
604
605 for ( auto& prop : hist->properties() ) {
606 ofs << svc.name() << " " << dumpProp( prop ) << std::endl;
607 }
608 }
HistorySvc::dumpProp
std::string dumpProp(const Gaudi::Details::PropertyBase *, const bool isXML=false, int indent=0) const
Definition: HistorySvc.cpp:713
std::endl
T endl(T...args)
ServiceHistory::properties
const PropertyList & properties() const override
Definition: ServiceHistory.h:36
ServiceHistory
ServiceHistory class definition.
Definition: ServiceHistory.h:21
HistorySvc::getServiceHistory
ServiceHistory * getServiceHistory(const IService &) const override
Definition: HistorySvc.cpp:566

void HistorySvc::dumpProperties | ( | const Algorithm & | alg,
|  | std::ofstream & | ofs
| ) |  | const
| private

Definition at line 336 of file HistorySvc.cpp.

337 {
338
339 AlgorithmHistory* hist = getAlgHistory( alg );
340
341 if ( !hist ) {
342 return;
343 }
344
345 PropertyList::const_iterator itr;
346 for ( auto prop : hist->properties() ) {
347 ofs << alg.name() << " " << dumpProp( prop ) << std::endl;
348 }
349 }
Algorithm::name
const std::string & name() const override
The identifying name of the algorithm object.
Definition: Algorithm.cpp:715
HistorySvc::dumpProp
std::string dumpProp(const Gaudi::Details::PropertyBase *, const bool isXML=false, int indent=0) const
Definition: HistorySvc.cpp:713
AlgorithmHistory
AlgorithmHistory class definition.
Definition: AlgorithmHistory.h:26
std::endl
T endl(T...args)
HistorySvc::getAlgHistory
AlgorithmHistory * getAlgHistory(const Algorithm &) const override
Definition: HistorySvc.cpp:352
AlgorithmHistory::properties
const PropertyList & properties() const override
Definition: AlgorithmHistory.h:82

void HistorySvc::dumpProperties | ( | const IAlgTool & | alg,
|  | std::ofstream & | ofs
| ) |  | const
| private

Definition at line 669 of file HistorySvc.cpp.

670 {
671
672 AlgToolHistory* hist = getAlgToolHistory( alg );
673
674 if ( !hist ) return;
675
676 for ( auto& prop : hist->properties() ) {
677 ofs << alg.name() << " " << dumpProp( prop ) << std::endl;
678 }
679 }
HistorySvc::getAlgToolHistory
AlgToolHistory * getAlgToolHistory(const IAlgTool &) const override
Definition: HistorySvc.cpp:683
HistorySvc::dumpProp
std::string dumpProp(const Gaudi::Details::PropertyBase *, const bool isXML=false, int indent=0) const
Definition: HistorySvc.cpp:713
std::endl
T endl(T...args)
AlgToolHistory::properties
const PropertyList & properties() const override
Definition: AlgToolHistory.h:69
AlgToolHistory
AlgToolHistory class definition.
Definition: AlgToolHistory.h:21
INamedInterface::name
virtual const std::string & name() const =0
Retrieve the name of the instance.

void HistorySvc::dumpState | ( | std::ofstream & | ofs | ) | const
| private

Definition at line 731 of file HistorySvc.cpp.

732 {
733
734 if ( m_outputFileTypeXML ) {
735 // xml header
736 ofs << "<?xml version=\"1.0\" ?> " << std::endl;
737 ofs << "<!--Test-xml-->" << std::endl;
738 ofs << "<SETUP>" << std::endl;
739 ofs << " <GLOBAL>" << std::endl;
740 } else {
741 ofs << "GLOBAL" << std::endl;
742 }
743
744 std::string client_currently_open = "start";
745 for ( auto& item : m_jobHistory->propertyPairs() ) {
746 // client is the name of the component of the current property
747 const std::string& client = item.first;
748 const Gaudi::Details::PropertyBase* prp = item.second;
749
750 if ( m_outputFileTypeXML ) {
751
752 if ( client != client_currently_open ) {
753 if ( client_currently_open != "start" ) ofs << " </COMPONENT>" << endl;
754 ofs << " <COMPONENT name=\"" << client << "\" class=\"undefined\">" << std::endl;
755 }
756 } else {
757 ofs << client << " ";
758 }
759
760 ofs << dumpProp( prp, m_outputFileTypeXML, 6 ) << endl;
761
762 client_currently_open = client;
763
764 if ( m_outputFileTypeXML ) ofs << " </COMPONENT>" << endl;
765 }
766
767 if ( m_outputFileTypeXML ) {
768 ofs << "</GLOBAL>" << endl << "<SERVICES>" << endl;
769 } else {
770 ofs << "SERVICES" << std::endl;
771 }
772
773 for ( auto& item : m_svcmap ) {
774 const IService* svc = item.first;
775 dumpState( svc, ofs );
776 }
777
778 if ( m_outputFileTypeXML ) {
779 ofs << "</SERVICES>" << endl << "<ALGORITHMS> " << endl;
780 } else {
781 ofs << "ALGORITHMS" << std::endl;
782 }
783
784 for ( auto& item : m_algmap ) {
785 const Algorithm* alg = item.first;
786 dumpState( alg, ofs );
787 }
788
789 if ( m_outputFileTypeXML ) {
790 ofs << "</ALGORITHMS>" << endl << "<ALGTOOLS> " << endl;
791 } else {
792 ofs << "ALGTOOLS" << std::endl;
793 }
794
795 for ( auto& item : m_algtoolmap ) {
796 const AlgTool* algtool = item.first;
797 dumpState( algtool, ofs );
798 }
799
800 if ( m_outputFileTypeXML ) {
801 ofs << "</ALGTOOLS>" << endl << "</SETUP>" << endl;
802 }
803 }
HistorySvc::dumpProp
std::string dumpProp(const Gaudi::Details::PropertyBase *, const bool isXML=false, int indent=0) const
Definition: HistorySvc.cpp:713
std::endl
T endl(T...args)
HistorySvc::m_algtoolmap
std::map< const AlgTool *, AlgToolHistory * > m_algtoolmap
Definition: HistorySvc.h:101
std::string
STL class.
IService
General service interface definition.
Definition: IService.h:18
HistorySvc::m_outputFileTypeXML
bool m_outputFileTypeXML
Definition: HistorySvc.h:123
Gaudi::Details::PropertyBase
PropertyBase base class allowing PropertyBase* collections to be "homogeneous".
Definition: Property.h:32
JobHistory::propertyPairs
const PropertyPairList & propertyPairs() const
Definition: JobHistory.h:72
HistorySvc::dumpState
void dumpState(std::ofstream &) const
Definition: HistorySvc.cpp:731
Algorithm
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:78
AlgTool
Base class from which all the concrete tool classes should be derived.
Definition: AlgTool.h:48
HistorySvc::m_algmap
std::map< const Algorithm *, AlgorithmHistory * > m_algmap
Definition: HistorySvc.h:98
HistorySvc::m_svcmap
std::map< const IService *, ServiceHistory * > m_svcmap
Definition: HistorySvc.h:102
HistorySvc::m_jobHistory
std::unique_ptr< JobHistory > m_jobHistory
Definition: HistorySvc.h:106

void HistorySvc::dumpState | ( | const INamedInterface * | in,
|  | std::ofstream & | ofs
| ) |  | const
| private

Definition at line 807 of file HistorySvc.cpp.

808 {
809
810 HistoryObj* hist = nullptr;
811 IVersHistoryObj* vhist = nullptr;
812
813 const IService* is = nullptr;
814 const Algorithm* ia = nullptr;
815 const IAlgTool* it = nullptr;
816 if ( ( is = dynamic_cast<const IService*>( in ) ) != nullptr ) {
817 ON_VERBOSE
818 verbose() << in->name() << " is Service" << endmsg;
819 ServiceHistory* o = getServiceHistory( *is );
820 hist = dynamic_cast<HistoryObj*>( o );
821 vhist = dynamic_cast<IVersHistoryObj*>( o );
822 } else if ( ( ia = dynamic_cast<const Algorithm*>( in ) ) != nullptr ) {
823 ON_VERBOSE
824 verbose() << in->name() << " is Alg" << endmsg;
825 AlgorithmHistory* o = getAlgHistory( *ia );
826 hist = dynamic_cast<HistoryObj*>( o );
827 vhist = dynamic_cast<IVersHistoryObj*>( o );
828 } else if ( ( it = dynamic_cast<const IAlgTool*>( in ) ) != nullptr ) {
829 ON_VERBOSE
830 verbose() << in->name() << " is AlgTool" << endmsg;
831 AlgToolHistory* o = getAlgToolHistory( *it );
832 hist = dynamic_cast<HistoryObj*>( o );
833 vhist = dynamic_cast<IVersHistoryObj*>( o );
834 } else {
835 error() << "Could not dcast interface to accepted History Obj type for " << in->name() << endmsg;
836 return;
837 }
838
839 if ( !hist || !vhist ) {
840 error() << "Could not dcast recognized object to HistoryObj or IVersHistoryObj. This should never happen."
841 << endmsg;
842 return;
843 }
844
845 if ( m_outputFileTypeXML ) {
846 hist->dump( ofs, true );
847 } else {
848 ofs << ">> " << vhist->name() << endl << *hist << endl;
849 }
850 }
IVersHistoryObj::name
virtual const std::string & name() const =0
HistorySvc::getAlgToolHistory
AlgToolHistory * getAlgToolHistory(const IAlgTool &) const override
Definition: HistorySvc.cpp:683
AlgorithmHistory
AlgorithmHistory class definition.
Definition: AlgorithmHistory.h:26
CommonMessagingBase::verbose
MsgStream & verbose() const
shortcut for the method msgStream(MSG::VERBOSE)
Definition: CommonMessaging.h:129
std::endl
T endl(T...args)
HistorySvc::getAlgHistory
AlgorithmHistory * getAlgHistory(const Algorithm &) const override
Definition: HistorySvc.cpp:352
HistoryObj::dump
virtual void dump(std::ostream &, const bool isXML=false, int indent=0) const =0
HistoryObj
Base class for History Objects.
Definition: HistoryObj.h:21
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:117
IService
General service interface definition.
Definition: IService.h:18
HistorySvc::m_outputFileTypeXML
bool m_outputFileTypeXML
Definition: HistorySvc.h:123
AlgToolHistory
AlgToolHistory class definition.
Definition: AlgToolHistory.h:21
Algorithm
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:78
IAlgTool
The interface implemented by the AlgTool base class.
Definition: IAlgTool.h:23
ServiceHistory
ServiceHistory class definition.
Definition: ServiceHistory.h:21
ON_VERBOSE
#define ON_VERBOSE
Definition: HistorySvc.cpp:41
IVersHistoryObj
Interface for Versioned History Objects.
Definition: IVersHistoryObj.h:17
HistorySvc::getServiceHistory
ServiceHistory * getServiceHistory(const IService &) const override
Definition: HistorySvc.cpp:566
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
INamedInterface::name
virtual const std::string & name() const =0
Retrieve the name of the instance.

StatusCode HistorySvc::finalize | ( |  | ) |
| override

Definition at line 273 of file HistorySvc.cpp.

274 {
275
276 ON_VERBOSE
277 verbose() << "HistorySvc::finalize()" << endmsg;
278
279 clearState();
280
281 StatusCode status = Service::finalize();
282
283 if ( status.isSuccess() ) info() << "Service finalised successfully" << endmsg;
284
285 return status;
286 }
Service::finalize
StatusCode finalize() override
Definition: Service.cpp:174
CommonMessagingBase::info
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
Definition: CommonMessaging.h:123
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:74
CommonMessagingBase::verbose
MsgStream & verbose() const
shortcut for the method msgStream(MSG::VERBOSE)
Definition: CommonMessaging.h:129
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
ON_VERBOSE
#define ON_VERBOSE
Definition: HistorySvc.cpp:41
HistorySvc::clearState
void clearState()
Definition: HistorySvc.cpp:107
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244

AlgorithmHistory * HistorySvc::getAlgHistory | ( | const Algorithm & | alg | ) | const
| override

Definition at line 352 of file HistorySvc.cpp.

353 {
354
355 auto itr = m_algmap.find( &alg );
356 if ( itr == m_algmap.end() ) {
357 warning() << "Algorithm " << alg.name() << " not registered" << endmsg;
358 return nullptr;
359 }
360 return itr->second;
361 }
Algorithm::name
const std::string & name() const override
The identifying name of the algorithm object.
Definition: Algorithm.cpp:715
std::map::end
T end(T...args)
CommonMessagingBase::warning
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
Definition: CommonMessaging.h:120
std::map::find
T find(T...args)
HistorySvc::m_algmap
std::map< const Algorithm *, AlgorithmHistory * > m_algmap
Definition: HistorySvc.h:98
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244

void HistorySvc::getAlgHistory | ( | std::set< AlgorithmHistory * > & | algs | ) | const
| override

Definition at line 364 of file HistorySvc.cpp.

364 { map_to_set( m_algmap, algs ); }
HistorySvc::m_algmap
std::map< const Algorithm *, AlgorithmHistory * > m_algmap
Definition: HistorySvc.h:98

AlgToolHistory * HistorySvc::getAlgToolHistory | ( | const IAlgTool & | alg | ) | const
| override

Definition at line 683 of file HistorySvc.cpp.

684 {
685
686 const AlgTool* palg = dynamic_cast<const AlgTool*>( &alg );
687 auto itr = m_algtoolmap.find( palg );
688 if ( itr == m_algtoolmap.end() ) {
689 warning() << "AlgTool " << alg.name() << " not registered" << endmsg;
690 return nullptr;
691 }
692 return itr->second;
693 }
std::map::end
T end(T...args)
HistorySvc::m_algtoolmap
std::map< const AlgTool *, AlgToolHistory * > m_algtoolmap
Definition: HistorySvc.h:101
CommonMessagingBase::warning
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
Definition: CommonMessaging.h:120
std::map::find
T find(T...args)
AlgTool
Base class from which all the concrete tool classes should be derived.
Definition: AlgTool.h:48
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
INamedInterface::name
virtual const std::string & name() const =0
Retrieve the name of the instance.

void HistorySvc::getAlgToolHistory | ( | std::set< AlgToolHistory * > & | algs | ) | const
| override

Definition at line 697 of file HistorySvc.cpp.

697 { map_to_set( m_algtoolmap, algs ); }
HistorySvc::m_algtoolmap
std::map< const AlgTool *, AlgToolHistory * > m_algtoolmap
Definition: HistorySvc.h:101

IAlgorithm * HistorySvc::getCurrentIAlg | ( |  | ) | const
| private

Definition at line 433 of file HistorySvc.cpp.

434 {
435 if ( p_algCtxSvc ) return p_algCtxSvc->currentAlg();
436 warning() << "trying to create DataHistoryObj before "
437 << "HistorySvc has been initialized" << endmsg;
438 return nullptr;
439 }
IAlgContextSvc::currentAlg
virtual IAlgorithm * currentAlg() const =0
accessor to current algorithm:
CommonMessagingBase::warning
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
Definition: CommonMessaging.h:120
HistorySvc::p_algCtxSvc
IAlgContextSvc * p_algCtxSvc
Definition: HistorySvc.h:96
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244

DataHistory * HistorySvc::getDataHistory | ( | const CLID & | id,
|  | const std::string & | key,
|  | const std::string & | store
| ) |  | const
| override

Definition at line 505 of file HistorySvc.cpp.

507 {
508
509 DHH dhh( id, key );
510
511 auto mitr = m_datMap.equal_range( dhh );
512 return ( mitr.first != mitr.second ) ? mitr.first->second : nullptr;
513 }
DHH
Definition: HistorySvc.cpp:62
HistorySvc::m_datMap
std::multimap< DHH, DataHistory * > m_datMap
Definition: HistorySvc.h:104
std::multimap::equal_range
T equal_range(T...args)

int HistorySvc::getDataHistory | ( | const CLID & | id,
|  | const std::string & | key,
|  | const std::string & | storeName,
|  | std::list< DataHistory * > & | dhlist
| ) |  | const
| virtual

Definition at line 517 of file HistorySvc.cpp.

519 {
520
521 DHH dhh( id, key );
522
523 int n( 0 );
524
525 auto mitr = m_datMap.equal_range( dhh );
526 for ( auto itr = mitr.first; itr != mitr.second; ++itr ) {
527 dhlist.push_back( itr->second );
528 ++n;
529 }
530 return n;
531 }
DHH
Definition: HistorySvc.cpp:62
HistorySvc::m_datMap
std::multimap< DHH, DataHistory * > m_datMap
Definition: HistorySvc.h:104
GaudiPluginService.cpluginsvc.n
n
Definition: cpluginsvc.py:217
std::list::push_back
T push_back(T...args)
std::multimap::equal_range
T equal_range(T...args)

JobHistory * HistorySvc::getJobHistory | ( |  | ) | const
| override

Definition at line 430 of file HistorySvc.cpp.

430 { return m_jobHistory.get(); }
std::unique_ptr::get
T get(T...args)
HistorySvc::m_jobHistory
std::unique_ptr< JobHistory > m_jobHistory
Definition: HistorySvc.h:106

ServiceHistory * HistorySvc::getServiceHistory | ( | const IService & | svc | ) | const
| override

Definition at line 566 of file HistorySvc.cpp.

567 {
568
569 const IService* psvc = &svc;
570 auto itr = m_svcmap.find( psvc );
571 if ( itr != m_svcmap.end() ) return itr->second;
572
573 warning() << "Service " << svc.name() << " not registered" << endmsg;
574 return nullptr;
575 }
std::map::end
T end(T...args)
CommonMessagingBase::warning
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
Definition: CommonMessaging.h:120
IService
General service interface definition.
Definition: IService.h:18
std::map::find
T find(T...args)
HistorySvc::m_svcmap
std::map< const IService *, ServiceHistory * > m_svcmap
Definition: HistorySvc.h:102
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244

void HistorySvc::getServiceHistory | ( | std::set< ServiceHistory * > & | svcs | ) | const
| override

Definition at line 578 of file HistorySvc.cpp.

578 { map_to_set( m_svcmap, svcs ); }
HistorySvc::m_svcmap
std::map< const IService *, ServiceHistory * > m_svcmap
Definition: HistorySvc.h:102

void HistorySvc::handle | ( | const Incident & | inc | ) |
| override

Definition at line 701 of file HistorySvc.cpp.

702 {
703
704 if ( incident.type() == IncidentType::BeginEvent ) {
705 if ( captureState().isFailure() ) {
706 warning() << "Error capturing state." << endl << "Will try again at next BeginEvent incident" << endmsg;
707 }
708 }
709 }
std::endl
T endl(T...args)
StatusCode::isFailure
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:84
CommonMessagingBase::warning
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
Definition: CommonMessaging.h:120
HistorySvc::captureState
virtual StatusCode captureState()
Definition: HistorySvc.cpp:169
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244

StatusCode HistorySvc::initialize | ( |  | ) |
| override

Definition at line 119 of file HistorySvc.cpp.

120 {
121
122 StatusCode status = Service::initialize();
123 if ( status.isFailure() ) {
124 ON_DEBUG
125 debug() << "Failed to initialize the base class (Service)" << endmsg;
126 return status;
127 }
128
129 ON_DEBUG
130 debug() << "Initializing HistorySvc" << endmsg;
131
132 if ( !m_activate ) return StatusCode::SUCCESS;
133
134 static const bool CREATEIF( true );
135
136 if ( service( "AlgContextSvc", p_algCtxSvc, CREATEIF ).isFailure() ) {
137 error() << "unable to get the AlgContextSvc" << endmsg;
138 return StatusCode::FAILURE;
139 }
140
141 if ( service( "IncidentSvc", m_incidentSvc, CREATEIF ).isFailure() ) {
142 error() << "unable to get the IncidentSvc" << endmsg;
143 return StatusCode::FAILURE;
144 }
145
146 // create a weak dependency on the ToolSvc, so that it doesn't get deleted
147 // before we're done with it in finalize
148 m_toolSvc = serviceLocator()->service( "ToolSvc" );
149 if ( !m_toolSvc ) {
150 error() << "could not retrieve the ToolSvc handle !" << endmsg;
151 return StatusCode::FAILURE;
152 }
153
154 // add listener to be triggered by first BeginEvent with low priority
155 // so it gets called first
156 const bool rethrow = false;
157 const bool oneShot = true; // make the listener called only once
158 m_incidentSvc->addListener( this, IncidentType::BeginEvent, std::numeric_limits<long>::min(), rethrow, oneShot );
159
160 m_outputFileTypeXML = ba::iends_with( m_outputFile.value(), ".xml" );
161 ON_DEBUG if ( m_outputFileTypeXML ) { debug() << "output format is XML" << endmsg; }
162
163 m_isInitialized = true;
164
165 return StatusCode::SUCCESS;
166 }
Service::initialize
StatusCode initialize() override
Definition: Service.cpp:64
StatusCode::SUCCESS
Definition: StatusCode.h:30
HistorySvc::m_toolSvc
SmartIF< IToolSvc > m_toolSvc
Definition: HistorySvc.h:121
StatusCode::FAILURE
Definition: StatusCode.h:29
StatusCode::isFailure
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:84
ISvcLocator::service
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:78
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:117
HistorySvc::m_isInitialized
bool m_isInitialized
Definition: HistorySvc.h:94
ON_DEBUG
#define ON_DEBUG
Definition: HistorySvc.cpp:40
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
HistorySvc::m_outputFileTypeXML
bool m_outputFileTypeXML
Definition: HistorySvc.h:123
HistorySvc::p_algCtxSvc
IAlgContextSvc * p_algCtxSvc
Definition: HistorySvc.h:96
HistorySvc::m_incidentSvc
IIncidentSvc * m_incidentSvc
Definition: HistorySvc.h:120
CommonMessagingBase::debug
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
Definition: CommonMessaging.h:126
IIncidentSvc::addListener
virtual void addListener(IIncidentListener *lis, const std::string &type="", long priority=0, bool rethrow=false, bool singleShot=false)=0
Add listener.
Service::service
StatusCode service(const std::string &name, const T *&psvc, bool createIf=true) const
Access a service by name, creating it if it doesn&#39;t already exist.
Definition: Service.h:85
HistorySvc::m_outputFile
Gaudi::Property< std::string > m_outputFile
Definition: HistorySvc.h:90
Service::serviceLocator
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition: Service.cpp:292
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
HistorySvc::m_activate
Gaudi::Property< bool > m_activate
Definition: HistorySvc.h:89
std::numeric_limits

StatusCode HistorySvc::listProperties | ( |  | ) | const
| override

Definition at line 370 of file HistorySvc.cpp.

371 {
372
373 auto& log = info();
374
375 log.setColor( MSG::CYAN );
376 log << "Dumping properties for all Algorithms (" << m_algmap.size() << ")" << endmsg;
377
378 for ( auto& alg : m_algmap ) {
379 listProperties( *alg.first ).ignore();
380 }
381
382 log << MSG::INFO;
383 log.setColor( MSG::CYAN );
384 log << "Dumping properties for all AlgTools (" << m_algtoolmap.size() << ")" << endmsg;
385
386 for ( auto& algtool : m_algtoolmap ) {
387 ON_DEBUG
388 debug() << " --> " << algtool.second->algtool_name() << endmsg;
389 listProperties( *algtool.first ).ignore();
390 }
391
392 log << MSG::INFO;
393 log.setColor( MSG::CYAN );
394 log << "Dumping properties for all Services (" << m_svcmap.size() << ")" << endmsg;
395
396 for ( auto& svc : m_svcmap ) {
397 listProperties( *svc.first ).ignore();
398 }
399
400 log << MSG::INFO;
401 log.setColor( MSG::CYAN );
402 log << "Dumping properties for Job";
403 log.resetColor();
404
405 log << std::endl << *m_jobHistory << endmsg;
406
407 return StatusCode( StatusCode::SUCCESS, true );
408 }
StatusCode::SUCCESS
Definition: StatusCode.h:30
CommonMessagingBase::info
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
Definition: CommonMessaging.h:123
MSG::CYAN
Definition: IMessageSvc.h:33
HistorySvc::listProperties
StatusCode listProperties() const override
Definition: HistorySvc.cpp:370
std::endl
T endl(T...args)
HistorySvc::m_algtoolmap
std::map< const AlgTool *, AlgToolHistory * > m_algtoolmap
Definition: HistorySvc.h:101
ON_DEBUG
#define ON_DEBUG
Definition: HistorySvc.cpp:40
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
std::map::size
T size(T...args)
CommonMessagingBase::debug
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
Definition: CommonMessaging.h:126
HistorySvc::m_algmap
std::map< const Algorithm *, AlgorithmHistory * > m_algmap
Definition: HistorySvc.h:98
StatusCode::ignore
void ignore() const
Definition: StatusCode.h:106
MSG::INFO
Definition: IMessageSvc.h:19
HistorySvc::m_svcmap
std::map< const IService *, ServiceHistory * > m_svcmap
Definition: HistorySvc.h:102
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
Gaudi.Configuration.log
log
Definition: Configuration.py:13
HistorySvc::m_jobHistory
std::unique_ptr< JobHistory > m_jobHistory
Definition: HistorySvc.h:106

StatusCode HistorySvc::listProperties | ( | const IService & | svc | ) | const
| override

Definition at line 582 of file HistorySvc.cpp.

583 {
584
585 info() << "Dumping properties for " << svc.name() << endl;
586
587 ServiceHistory* hist = getServiceHistory( svc );
588
589 if ( !hist ) return StatusCode::FAILURE;
590
591 info() << svc.name() << " --> " << endl << *hist << endmsg;
592
593 return StatusCode( StatusCode::SUCCESS, true );
594 }
StatusCode::SUCCESS
Definition: StatusCode.h:30
StatusCode::FAILURE
Definition: StatusCode.h:29
CommonMessagingBase::info
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
Definition: CommonMessaging.h:123
std::endl
T endl(T...args)
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
ServiceHistory
ServiceHistory class definition.
Definition: ServiceHistory.h:21
HistorySvc::getServiceHistory
ServiceHistory * getServiceHistory(const IService &) const override
Definition: HistorySvc.cpp:566
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244

StatusCode HistorySvc::listProperties | ( | const Algorithm & | alg | ) | const
| override

Definition at line 319 of file HistorySvc.cpp.

320 {
321
322 info() << "Dumping properties for " << alg.name() << endl;
323
324 AlgorithmHistory* hist = getAlgHistory( alg );
325
326 if ( !hist ) {
327 return StatusCode::FAILURE;
328 }
329
330 info() << alg.name() << " --> " << endl << *hist << endmsg;
331
332 return StatusCode( StatusCode::SUCCESS, true );
333 }
StatusCode::SUCCESS
Definition: StatusCode.h:30
Algorithm::name
const std::string & name() const override
The identifying name of the algorithm object.
Definition: Algorithm.cpp:715
StatusCode::FAILURE
Definition: StatusCode.h:29
CommonMessagingBase::info
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
Definition: CommonMessaging.h:123
AlgorithmHistory
AlgorithmHistory class definition.
Definition: AlgorithmHistory.h:26
std::endl
T endl(T...args)
HistorySvc::getAlgHistory
AlgorithmHistory * getAlgHistory(const Algorithm &) const override
Definition: HistorySvc.cpp:352
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244

StatusCode HistorySvc::listProperties | ( | const IAlgTool & | alg | ) | const
| override

Definition at line 654 of file HistorySvc.cpp.

655 {
656
657 info() << "Dumping properties for " << alg.name() << endl;
658
659 AlgToolHistory* hist = getAlgToolHistory( alg );
660
661 if ( !hist ) return StatusCode::FAILURE;
662
663 info() << alg.name() << " --> " << endl << *hist << endmsg;
664
665 return StatusCode::SUCCESS;
666 }
HistorySvc::getAlgToolHistory
AlgToolHistory * getAlgToolHistory(const IAlgTool &) const override
Definition: HistorySvc.cpp:683
StatusCode::SUCCESS
Definition: StatusCode.h:30
StatusCode::FAILURE
Definition: StatusCode.h:29
CommonMessagingBase::info
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
Definition: CommonMessaging.h:123
std::endl
T endl(T...args)
AlgToolHistory
AlgToolHistory class definition.
Definition: AlgToolHistory.h:21
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
INamedInterface::name
virtual const std::string & name() const =0
Retrieve the name of the instance.

StatusCode HistorySvc::registerAlg | ( | const Algorithm & | alg | ) |
| override

Definition at line 293 of file HistorySvc.cpp.

294 {
295
296 JobHistory* job = getJobHistory();
297 if ( m_algmap.find( &alg ) != m_algmap.end() ) {
298 warning() << "Algorithm " << alg.name() << " already registered with HistorySvc" << endmsg;
299 return StatusCode::SUCCESS;
300 }
301
302 ( const_cast<Algorithm*>( &alg ) )->addRef();
303
304 m_algmap[&alg] = new AlgorithmHistory( alg, job );
305
306 ON_DEBUG
307 {
308 auto& log = debug();
309 log << "Registering algorithm: ";
310 log.setColor( MSG::CYAN );
311 log << alg.name() << endmsg;
312 log.resetColor();
313 }
314
315 return StatusCode( StatusCode::SUCCESS, true );
316 }
StatusCode::SUCCESS
Definition: StatusCode.h:30
Algorithm::name
const std::string & name() const override
The identifying name of the algorithm object.
Definition: Algorithm.cpp:715
MSG::CYAN
Definition: IMessageSvc.h:33
AlgorithmHistory
AlgorithmHistory class definition.
Definition: AlgorithmHistory.h:26
std::map::end
T end(T...args)
JobHistory
JobHistory class definition.
Definition: JobHistory.h:22
CommonMessagingBase::warning
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
Definition: CommonMessaging.h:120
HistorySvc::getJobHistory
JobHistory * getJobHistory() const override
Definition: HistorySvc.cpp:430
ON_DEBUG
#define ON_DEBUG
Definition: HistorySvc.cpp:40
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
Algorithm
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:78
std::map::find
T find(T...args)
CommonMessagingBase::debug
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
Definition: CommonMessaging.h:126
HistorySvc::m_algmap
std::map< const Algorithm *, AlgorithmHistory * > m_algmap
Definition: HistorySvc.h:98
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
Gaudi.Configuration.log
log
Definition: Configuration.py:13

StatusCode HistorySvc::registerAlgTool | ( | const IAlgTool & | ialg | ) |
| override

Definition at line 612 of file HistorySvc.cpp.

613 {
614
615 if ( !m_isInitialized ) {
616 if ( !p_algCtxSvc ) {
617 if ( service( "AlgContextSvc", p_algCtxSvc, true ).isFailure() ) {
618 error() << "unable to get the AlgContextSvc" << endmsg;
619 return StatusCode::FAILURE;
620 }
621 }
622 m_ialgtools.insert( &ialg );
623 return StatusCode::SUCCESS;
624 }
625
626 const AlgTool* alg = dynamic_cast<const AlgTool*>( &ialg );
627 if ( !alg ) {
628 error() << "Could not dcast IAlgTool \"" << ialg.name() << "\" to an AlgTool" << endmsg;
629 return StatusCode::FAILURE;
630 }
631
632 if ( m_algtoolmap.find( alg ) != m_algtoolmap.end() ) {
633 warning() << "AlgTool " << ialg.name() << " already registered in HistorySvc" << endmsg;
634 return StatusCode::SUCCESS;
635 }
636
637 const JobHistory* job = getJobHistory();
638 m_algtoolmap[alg] = new AlgToolHistory( *alg, job );
639
640 ON_DEBUG
641 {
642 auto& log = debug();
643 log << "Registering algtool: ";
644 log.setColor( MSG::CYAN );
645 log << alg->name() << endmsg;
646 log.resetColor();
647 }
648
649 return StatusCode::SUCCESS;
650 }
StatusCode::SUCCESS
Definition: StatusCode.h:30
StatusCode::FAILURE
Definition: StatusCode.h:29
MSG::CYAN
Definition: IMessageSvc.h:33
std::map::end
T end(T...args)
HistorySvc::m_algtoolmap
std::map< const AlgTool *, AlgToolHistory * > m_algtoolmap
Definition: HistorySvc.h:101
JobHistory
JobHistory class definition.
Definition: JobHistory.h:22
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:117
CommonMessagingBase::warning
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
Definition: CommonMessaging.h:120
HistorySvc::m_isInitialized
bool m_isInitialized
Definition: HistorySvc.h:94
HistorySvc::getJobHistory
JobHistory * getJobHistory() const override
Definition: HistorySvc.cpp:430
ON_DEBUG
#define ON_DEBUG
Definition: HistorySvc.cpp:40
HistorySvc::p_algCtxSvc
IAlgContextSvc * p_algCtxSvc
Definition: HistorySvc.h:96
AlgToolHistory
AlgToolHistory class definition.
Definition: AlgToolHistory.h:21
std::set::insert
T insert(T...args)
std::map::find
T find(T...args)
AlgTool::name
const std::string & name() const override
Retrieve full identifying name of the concrete tool object.
Definition: AlgTool.cpp:63
CommonMessagingBase::debug
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
Definition: CommonMessaging.h:126
AlgTool
Base class from which all the concrete tool classes should be derived.
Definition: AlgTool.h:48
Service::service
StatusCode service(const std::string &name, const T *&psvc, bool createIf=true) const
Access a service by name, creating it if it doesn&#39;t already exist.
Definition: Service.h:85
HistorySvc::m_ialgtools
std::set< const IAlgTool * > m_ialgtools
Definition: HistorySvc.h:100
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
INamedInterface::name
virtual const std::string & name() const =0
Retrieve the name of the instance.
Gaudi.Configuration.log
log
Definition: Configuration.py:13

StatusCode HistorySvc::registerDataHistory | ( | const CLID & | id,
|  | const std::string & | key,
|  | const std::string & | store
| ) |  |
| virtual

Definition at line 471 of file HistorySvc.cpp.

472 {
473
474 DHH dhh( id, key );
475
476 auto boundaries = m_datMap.equal_range( dhh );
477 auto match = boundaries.second;
478
479 if ( boundaries.first != boundaries.second ) {
480 // there is something in the map, let's look for the specific entry
481
482 std::string algName;
483 IAlgorithm* ialg = getCurrentIAlg();
484 if ( ialg ) {
485 algName = ialg->name();
486 } else {
487 algName = "UNKNOWN";
488 }
489
490 match = std::find_if( boundaries.first, boundaries.second,
491 [&algName]( decltype( boundaries )::first_type::reference p ) -> bool {
492 return p.second->algorithmHistory()->algorithm_name() == algName;
493 } );
494 }
495
496 if ( match == boundaries.second ) { // not found, crete the entry
497 DataHistory* dh = createDataHistoryObj( id, key, storeName );
498 m_datMap.insert( pair<DHH, DataHistory*>( dhh, dh ) );
499 }
500
501 return StatusCode::SUCCESS;
502 }
StatusCode::SUCCESS
Definition: StatusCode.h:30
DHH
Definition: HistorySvc.cpp:62
HistorySvc::m_datMap
std::multimap< DHH, DataHistory * > m_datMap
Definition: HistorySvc.h:104
HistorySvc::getCurrentIAlg
IAlgorithm * getCurrentIAlg() const
Definition: HistorySvc.cpp:433
std::string
STL class.
DataHistory
DataHistory class definition.
Definition: DataHistory.h:23
IAlgorithm
The IAlgorithm is the interface implemented by the Algorithm base class.
Definition: IAlgorithm.h:27
std::pair
std::multimap::insert
T insert(T...args)
std::find_if
T find_if(T...args)
HistorySvc::createDataHistoryObj
DataHistory * createDataHistoryObj(const CLID &id, const std::string &key, const std::string &store) override
Definition: HistorySvc.cpp:443
Objects::reference
TO * reference(FROM *from)
Definition: KeyedObject.cpp:20
std::multimap::equal_range
T equal_range(T...args)

StatusCode HistorySvc::registerJob | ( |  | ) |
| override

Definition at line 367 of file HistorySvc.cpp.

367 { return StatusCode( StatusCode::SUCCESS, true ); }
StatusCode::SUCCESS
Definition: StatusCode.h:30
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26

StatusCode HistorySvc::registerSvc | ( | const IService & | svc | ) |
| override

Definition at line 535 of file HistorySvc.cpp.

536 {
537
538 if ( svc.name() == "HistoryStore" ) {
539 return StatusCode( StatusCode::SUCCESS, true );
540 }
541
542 JobHistory* job = getJobHistory();
543 const IService* psvc = &svc;
544 auto itr = m_svcmap.find( psvc );
545 if ( itr == m_svcmap.end() ) {
546
547 ON_DEBUG
548 {
549 auto& log = debug();
550 log << "Registering Service: ";
551 log.setColor( MSG::CYAN );
552 log << svc.name() << endmsg;
553 log.resetColor();
554 }
555
556 m_svcmap[psvc] = new ServiceHistory( &svc, job );
557
558 ( const_cast<IService*>( psvc ) )->addRef();
559 }
560
561 return StatusCode( StatusCode::SUCCESS, true );
562 }
StatusCode::SUCCESS
Definition: StatusCode.h:30
MSG::CYAN
Definition: IMessageSvc.h:33
std::map::end
T end(T...args)
JobHistory
JobHistory class definition.
Definition: JobHistory.h:22
HistorySvc::getJobHistory
JobHistory * getJobHistory() const override
Definition: HistorySvc.cpp:430
IService
General service interface definition.
Definition: IService.h:18
ON_DEBUG
#define ON_DEBUG
Definition: HistorySvc.cpp:40
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
std::map::find
T find(T...args)
CommonMessagingBase::debug
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
Definition: CommonMessaging.h:126
ServiceHistory
ServiceHistory class definition.
Definition: ServiceHistory.h:21
HistorySvc::m_svcmap
std::map< const IService *, ServiceHistory * > m_svcmap
Definition: HistorySvc.h:102
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
Gaudi.Configuration.log
log
Definition: Configuration.py:13

StatusCode HistorySvc::reinitialize | ( |  | ) |
| override

Definition at line 80 of file HistorySvc.cpp.

81 {
82
83 clearState();
84 m_state = Gaudi::StateMachine::OFFLINE;
85 return initialize();
86 }
Service::m_state
Gaudi::StateMachine::State m_state
Service state.
Definition: Service.h:191
HistorySvc::initialize
StatusCode initialize() override
Definition: HistorySvc.cpp:119
Gaudi::StateMachine::OFFLINE
Definition: StateMachine.h:13
HistorySvc::clearState
void clearState()
Definition: HistorySvc.cpp:107

StatusCode HistorySvc::stop | ( |  | ) |
| override

Definition at line 247 of file HistorySvc.cpp.

248 {
249
250 if ( !m_activate ) return StatusCode::SUCCESS;
251
252 if ( m_dump ) {
253 listProperties().ignore();
254 }
255
256 if ( !m_outputFile.empty() ) {
257 std::ofstream ofs( m_outputFile );
258 if ( !ofs ) {
259 error() << "Unable to open output file \"m_outputFile\"" << endmsg;
260 } else {
261 // dumpProperties(ofs);
262 dumpState( ofs );
263 }
264 }
265
266 clearState();
267
268 return StatusCode::SUCCESS;
269 }
StatusCode::SUCCESS
Definition: StatusCode.h:30
HistorySvc::listProperties
StatusCode listProperties() const override
Definition: HistorySvc.cpp:370
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:117
std::ofstream
STL class.
HistorySvc::m_dump
Gaudi::Property< bool > m_dump
Definition: HistorySvc.h:88
HistorySvc::dumpState
void dumpState(std::ofstream &) const
Definition: HistorySvc.cpp:731
HistorySvc::m_outputFile
Gaudi::Property< std::string > m_outputFile
Definition: HistorySvc.h:90
StatusCode::ignore
void ignore() const
Definition: StatusCode.h:106
HistorySvc::clearState
void clearState()
Definition: HistorySvc.cpp:107
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
HistorySvc::m_activate
Gaudi::Property< bool > m_activate
Definition: HistorySvc.h:89

## Member Data Documentation

Gaudi::Property<bool> HistorySvc::m_activate {this, "Activate", true}
| private

Definition at line 89 of file HistorySvc.h.

std::map<const Algorithm*, AlgorithmHistory*> HistorySvc::m_algmap
| private

Definition at line 98 of file HistorySvc.h.

std::map<const AlgTool*, AlgToolHistory*> HistorySvc::m_algtoolmap
| private

Definition at line 101 of file HistorySvc.h.

std::multimap<DHH, DataHistory*> HistorySvc::m_datMap
| private

Definition at line 104 of file HistorySvc.h.

Gaudi::Property<bool> HistorySvc::m_dump {this, "Dump", false}
| private

Definition at line 88 of file HistorySvc.h.

std::set<const IAlgTool*> HistorySvc::m_ialgtools
| private

Definition at line 100 of file HistorySvc.h.

IIncidentSvc* HistorySvc::m_incidentSvc = nullptr
| private

Definition at line 120 of file HistorySvc.h.

bool HistorySvc::m_isInitialized = false
| private

Definition at line 94 of file HistorySvc.h.

std::unique_ptr<JobHistory> HistorySvc::m_jobHistory
| private

Definition at line 106 of file HistorySvc.h.

Gaudi::Property<std::string> HistorySvc::m_outputFile {this, "OutputFile"}
| private

Definition at line 90 of file HistorySvc.h.

bool HistorySvc::m_outputFileTypeXML = false
| private

Definition at line 123 of file HistorySvc.h.

std::map<const IService*, ServiceHistory*> HistorySvc::m_svcmap
| private

Definition at line 102 of file HistorySvc.h.

SmartIF<IToolSvc> HistorySvc::m_toolSvc
| private

Definition at line 121 of file HistorySvc.h.

IAlgContextSvc* HistorySvc::p_algCtxSvc = nullptr
| private

Definition at line 96 of file HistorySvc.h.

The documentation for this class was generated from the following files:

- GaudiMonitor/src/HistorySvc.h
- GaudiMonitor/src/HistorySvc.cpp