The Gaudi Framework  v30r4 (9b837755)
ApplicationMgr Class Reference

The Application Manager class. More...

#include <src/ApplicationMgr/ApplicationMgr.h>

Inheritance diagram for ApplicationMgr:
Collaboration diagram for ApplicationMgr:

Public Member Functions

 ApplicationMgr (IInterface *=nullptr)
 
StatusCode queryInterface (const InterfaceID &iid, void **pinterface) override
 
StatusCode run () override
 
StatusCode configure () override
 
StatusCode terminate () override
 
StatusCode initialize () override
 
StatusCode start () override
 
StatusCode stop () override
 
StatusCode finalize () override
 
StatusCode nextEvent (int maxevt) override
 
const std::stringname () const override
 
StatusCode executeEvent (void *par) override
 implementation of IEventProcessor::executeEvent(void*) More...
 
StatusCode executeRun (int evtmax) override
 implementation of IEventProcessor::executeRun(int) More...
 
StatusCode stopRun () override
 implementation of IEventProcessor::stopRun() More...
 
Gaudi::StateMachine::State FSMState () const override
 
Gaudi::StateMachine::State targetFSMState () const override
 
StatusCode reinitialize () override
 
StatusCode restart () override
 
StatusCode sysInitialize () override
 
StatusCode sysStart () override
 
StatusCode sysStop () override
 
StatusCode sysFinalize () override
 
StatusCode sysReinitialize () override
 
StatusCode sysRestart () override
 
template<class I >
SmartIF< IComponentManager > & getManager ()
 
SmartIF< ISvcManager > & svcManager ()
 
SmartIF< IAlgManager > & algManager ()
 
SmartIF< ISvcLocator > & serviceLocator () const override
 Needed to locate the message service. More...
 
void outputLevelUpdate () override
 Function to call to update the outputLevel of the components (after a change in MessageSvc). More...
 
Gaudi::Details::PropertyBase handlers
void evtLoopPropertyHandler (Gaudi::Details::PropertyBase &theProp)
 
StatusCode decodeExtSvcNameList ()
 
StatusCode decodeCreateSvcNameList ()
 
void createSvcNameListHandler (Gaudi::Details::PropertyBase &)
 
void extSvcNameListHandler (Gaudi::Details::PropertyBase &theProp)
 
StatusCode decodeDllNameList ()
 
void dllNameListHandler (Gaudi::Details::PropertyBase &theProp)
 
void pluginDebugPropertyHandler (Gaudi::Details::PropertyBase &theProp)
 
- Public Member Functions inherited from PropertyHolder< CommonMessaging< implements< IAppMgrUI, IEventProcessor, IService, IStateful, INamedInterface, IProperty > > >
 PropertyHolder ()=default
 
Gaudi::Details::PropertyBasedeclareProperty (Gaudi::Details::PropertyBase &prop)
 Declare a property. More...
 
Gaudi::Details::PropertyBasedeclareProperty (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::PropertyBasedeclareProperty (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::PropertyBasedeclareRemoteProperty (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::PropertyBasegetProperty (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
 
PropertyHolderoperator= (const PropertyHolder &)=delete
 
- Public Member Functions inherited from CommonMessaging< implements< IAppMgrUI, IEventProcessor, IService, IStateful, INamedInterface, IProperty > >
MSG::Level msgLevel () const
 get the cached level (originally extracted from the embedded MsgStream) More...
 
bool msgLevel (MSG::Level lvl) const
 get the output level from the embedded MsgStream More...
 
MSG::Level outputLevel () const
 Backward compatibility function for getting the output level. More...
 
- Public Member Functions inherited from CommonMessagingBase
virtual ~CommonMessagingBase ()=default
 Virtual destructor. More...
 
const SmartIF< IMessageSvc > & msgSvc () const
 The standard message service. More...
 
MsgStreammsgStream () const
 Return an uninitialized MsgStream. More...
 
MsgStreammsgStream (const MSG::Level level) const
 Predefined configurable message stream for the efficient printouts. More...
 
MsgStreamalways () const
 shortcut for the method msgStream(MSG::ALWAYS) More...
 
MsgStreamfatal () const
 shortcut for the method msgStream(MSG::FATAL) More...
 
MsgStreamerr () const
 shortcut for the method msgStream(MSG::ERROR) More...
 
MsgStreamerror () const
 shortcut for the method msgStream(MSG::ERROR) More...
 
MsgStreamwarning () const
 shortcut for the method msgStream(MSG::WARNING) More...
 
MsgStreaminfo () const
 shortcut for the method msgStream(MSG::INFO) More...
 
MsgStreamdebug () const
 shortcut for the method msgStream(MSG::DEBUG) More...
 
MsgStreamverbose () const
 shortcut for the method msgStream(MSG::VERBOSE) More...
 
MsgStreammsg () const
 shortcut for the method msgStream(MSG::INFO) More...
 

Protected Types

typedef std::map< unsigned long, SmartIF< IComponentManager > > ManagersMap
 Typedef for the map of component managers, the key is the "id" field of the basic InterfaceID of the managed components. More...
 

Protected Member Functions

void setServiceManager (ISvcManager *) override
 
StatusCode i_startup ()
 Internal startup routine. More...
 
StatusCode GoToState (Gaudi::StateMachine::State state, bool ignoreFailures=false)
 Reach a state from current state (whichever it is) going through the correct transitions. More...
 
- Protected Member Functions inherited from PropertyHolder< CommonMessaging< implements< IAppMgrUI, IEventProcessor, IService, IStateful, INamedInterface, IProperty > > >
Gaudi::Details::PropertyBaseproperty (const std::string &name) const
 
- Protected Member Functions inherited from CommonMessaging< implements< IAppMgrUI, IEventProcessor, IService, IStateful, INamedInterface, IProperty > >
MSG::Level setUpMessaging () const
 Set up local caches. More...
 
MSG::Level resetMessaging ()
 Reinitialize internal states. More...
 
void updateMsgStreamOutputLevel (int level)
 Update the output level of the cached MsgStream. More...
 

Protected Attributes

ManagersMap m_managers
 Map of known component managers. More...
 
Gaudi::Property< std::vector< std::string > > m_declaredManagers
 Property to declare the list of known managers. More...
 
SmartIF< ISvcManagerm_svcManager
 Cached pointer to the manager of services. More...
 
SmartIF< IAlgManagerm_algManager
 Cached pointer to the manager of algorithms. More...
 
SmartIF< ISvcLocatorm_svcLocator
 Reference to its own service locator (must be instantiated prior to any service!) More...
 
SmartIF< DLLClassManagerm_classManager
 Reference to the class manager. More...
 
Gaudi::Property< int > m_SIGo
 
Gaudi::Property< int > m_SIExit
 
Gaudi::Property< std::vector< std::string > > m_topAlgNameList
 
Gaudi::Property< std::vector< std::string > > m_outStreamNameList
 
Gaudi::Property< std::stringm_outStreamType
 
Gaudi::Property< std::stringm_messageSvcType {this, "MessageSvcType", "MessageSvc", "MessageSvc type"}
 
Gaudi::Property< std::stringm_jobOptionsSvcType {this, "JobOptionsSvcType", "JobOptionsSvc", "JobOptionsSvc type"}
 
std::string m_name = "ApplicationMgr"
 Name. More...
 
Gaudi::StateMachine::State m_state = Gaudi::StateMachine::OFFLINE
 Internal State. More...
 
Gaudi::StateMachine::State m_targetState = Gaudi::StateMachine::OFFLINE
 Internal State. More...
 
Gaudi::Property< std::vector< std::string > > m_svcMapping {this, "SvcMapping", {}, "Default mapping of services"}
 
Gaudi::Property< std::vector< std::string > > m_svcOptMapping
 
SmartIF< IMessageSvcm_messageSvc
 Reference to the message service. More...
 
SmartIF< IRunablem_runable
 Reference to the runable object. More...
 
SmartIF< IEventProcessorm_processingMgr
 Reference to processing manager object. More...
 
SmartIF< IJobOptionsSvcm_jobOptionsSvc
 Reference to JobOption service. More...
 
Gaudi::Property< int > m_evtMax {this, "EvtMax", -1, "Number of events to be processed (-1 means all events)"}
 
Gaudi::Property< std::vector< std::string > > m_extSvcNameList {this, "ExtSvc", {}, "List of external services names"}
 
Gaudi::Property< bool > m_extSvcCreates
 
Gaudi::Property< std::vector< std::string > > m_dllNameList {this, "Dlls", {}, "List of DDL's names"}
 
Gaudi::Property< std::stringm_jobOptionsType {this, "JobOptionsType", "FILE", "Source type (e.g. dbase, file...)"}
 
Gaudi::Property< std::stringm_jobOptionsPath {this, "JobOptionsPath", {}, "The \"file\" to look for properties"}
 
Gaudi::Property< std::stringm_jobOptionsPreAction
 
Gaudi::Property< std::stringm_jobOptionsPostAction
 
Gaudi::Property< std::stringm_runableType {this, "Runable", "AppMgrRunable", "Runable type"}
 
Gaudi::Property< std::stringm_eventLoopMgr {this, "EventLoop", "EventLoopMgr", "Processing manager type"}
 
Gaudi::Property< std::stringm_evtsel {this, "EvtSel", {}, "Event selection"}
 
Gaudi::Property< std::stringm_histPersName {this, "HistogramPersistency", "NONE", "Name of the Hist Pers Svc"}
 
Gaudi::Property< int > m_outputLevel {this, "OutputLevel", MSG::INFO, "Message output level"}
 
Gaudi::Property< std::stringm_appName {this, "AppName", "ApplicationMgr", "The name of the application"}
 
Gaudi::Property< std::stringm_appVersion {this, "AppVersion", {}, "The version of the application"}
 
Gaudi::Property< bool > m_actHistory {this, "ActivateHistory", false, "Activate HistorySvc"}
 
Gaudi::Property< bool > m_codeCheck {this, "StatusCodeCheck", false, "Activate StatusCode checking"}
 
Gaudi::Property< int > m_pluginDebugLevel
 
Gaudi::Property< std::vector< std::string > > m_createSvcNameList
 
Gaudi::Property< bool > m_auditTools {this, "AuditTools", false}
 Defaults for auditors. More...
 
Gaudi::Property< bool > m_auditSvcs {this, "AuditServices", false}
 
Gaudi::Property< bool > m_auditAlgs {this, "AuditAlgorithms", false}
 
Gaudi::Property< std::map< std::string, std::string > > m_environment
 
Gaudi::Property< bool > m_loopCheck
 
Gaudi::Property< bool > m_stopOnSignal
 Property to enable/disable the "stop on signal" service. More...
 
Gaudi::Property< bool > m_stalledEventMonitoring
 Property to enable/disable the monitoring and reporting of stalled events. More...
 
Gaudi::Property< bool > m_propertiesPrint
 
Gaudi::Property< int > m_returnCode
 Property to record the error conditions occurring during the running. More...
 
bool m_useHiveAlgorithmManager
 

Private Attributes

std::vector< std::stringm_okDlls
 names of successfully loaded dlls More...
 

Additional Inherited Members

- Public Types inherited from PropertyHolder< CommonMessaging< implements< IAppMgrUI, IEventProcessor, IService, IStateful, INamedInterface, IProperty > > >
using PropertyHolderImpl = PropertyHolder< CommonMessaging< implements< IAppMgrUI, IEventProcessor, IService, IStateful, INamedInterface, IProperty > > >
 Typedef used to refer to this class from derived classes, as in. More...
 
- Public Types inherited from CommonMessaging< implements< IAppMgrUI, IEventProcessor, IService, IStateful, INamedInterface, IProperty > >
using base_class = CommonMessaging
 

Detailed Description

The Application Manager class.

The main purpose of the Application Manager is to steer any data processing application. This includes all data processing applications for LHCb data in all stages: simulation, reconstruction, analysis, high level triggers, etc. Specific implementations of the ApplicationMgr will be developed to cope with the different environments (on-line, off-line, interactive, batch, etc.).

Author
Pere Mato

Definition at line 47 of file ApplicationMgr.h.

Member Typedef Documentation

typedef std::map<unsigned long, SmartIF<IComponentManager> > ApplicationMgr::ManagersMap
protected

Typedef for the map of component managers, the key is the "id" field of the basic InterfaceID of the managed components.

Definition at line 161 of file ApplicationMgr.h.

Constructor & Destructor Documentation

ApplicationMgr::ApplicationMgr ( IInterface = nullptr)

Definition at line 47 of file ApplicationMgr.cpp.

48 {
49  // IInterface initialization
50  addRef(); // Initial count set to 1
51 
52  // Instantiate component managers
53  m_managers[IService::interfaceID().id()] = new ServiceManager( this );
54 
56 
57  // Instantiate internal services
58  // SvcLocator/Factory HAS to be already instantiated
59  m_classManager = new DLLClassManager( this );
60 
61  AlgorithmManager* algMgr = new AlgorithmManager( this );
62  m_managers[IAlgorithm::interfaceID().id()] = algMgr;
63  // m_managers[IAlgorithm::interfaceID().id()] = new HiveAlgorithmManager(this);
64 
65  // This property is not hosted in the ApplicationMgr instance
66  declareProperty( "AlgTypeAliases", algMgr->typeAliases(),
67  "Aliases of algorithm types, to replace an algorithm type for every instance" );
68 
69  // ServiceMgr Initialization loop checking
71 
72  m_svcMapping = {"EvtDataSvc/EventDataSvc",
73  "DetDataSvc/DetectorDataSvc",
74  "HistogramSvc/HistogramDataSvc",
75  "HbookCnv::PersSvc/HbookHistSvc",
76  "RootHistCnv::PersSvc/RootHistSvc",
77  "EvtPersistencySvc/EventPersistencySvc",
78  "DetPersistencySvc/DetectorPersistencySvc",
79  "HistogramPersistencySvc/HistogramPersistencySvc"};
80 }
The ServiceManager class is in charge of the creation of concrete instances of Services.
The AlgorithmManager class is in charge of the creation of concrete instances of Algorithms.
ManagersMap m_managers
Map of known component managers.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Details::PropertyBase &prop)
Declare a property.
AlgTypeAliasesMap & typeAliases()
SmartIF< ISvcManager > & svcManager()
SmartIF< ISvcLocator > m_svcLocator
Reference to its own service locator (must be instantiated prior to any service!) ...
Gaudi::Property< std::vector< std::string > > m_svcMapping
SmartIF< DLLClassManager > m_classManager
Reference to the class manager.
virtual void setLoopCheckEnabled(bool en=true)=0
Set the value of the initialization loop check flag.
Gaudi::Property< bool > m_loopCheck

Member Function Documentation

SmartIF<IAlgManager>& ApplicationMgr::algManager ( )
inline

Definition at line 131 of file ApplicationMgr.h.

132  {
133  // Cache the casted pointer to IAlgManager
134  if ( !m_algManager ) {
135  m_algManager = getManager<IAlgorithm>();
136  }
137  return m_algManager;
138  }
SmartIF< IAlgManager > m_algManager
Cached pointer to the manager of algorithms.
StatusCode ApplicationMgr::configure ( )
override

Definition at line 233 of file ApplicationMgr.cpp.

234 {
235 
236  // Check if the state is compatible with the transition
237  MsgStream tlog( m_messageSvc, name() );
239  tlog << MSG::INFO << "Already Configured" << endmsg;
240  return StatusCode::SUCCESS;
241  }
243  tlog << MSG::FATAL << "configure: Invalid state \"" << m_state << "\"" << endmsg;
244  return StatusCode::FAILURE;
245  }
247 
248  // Reset application return code.
250 
251  StatusCode sc;
252  sc = i_startup();
253  if ( !sc.isSuccess() ) {
254  return sc;
255  }
256 
257  {
259  // Get my own options using the Job options service
260  if ( log.level() <= MSG::DEBUG ) log << MSG::DEBUG << "Getting my own properties" << endmsg;
261  sc = m_jobOptionsSvc->setMyProperties( name(), this );
262  if ( !sc.isSuccess() ) {
263  log << MSG::WARNING << "Problems getting my properties from JobOptionsSvc" << endmsg;
264  return sc;
265  }
266  }
267 
268  // Make sure that the OutputLevel is in sync
271 
272  // Check current outputLevel to eventually inform the MessageSvc
273  if ( m_outputLevel != MSG::NIL && !m_appName.empty() ) {
274  // Print a welcome message
276  << "=================================================================="
277  << "==================================================================" << std::endl
278  << " "
279  << " Welcome to " << m_appName.value();
280 
281  if ( !m_appVersion.empty() ) {
282  log << MSG::ALWAYS << " version " << m_appVersion.value();
283  } else {
284  log << MSG::ALWAYS << " (GaudiCoreSvc "
285  << "v" << GAUDICORESVC_MAJOR_VERSION << "r" << GAUDICORESVC_MINOR_VERSION
286 #if GAUDICORESVC_PATCH_VERSION
287  << "p" << GAUDICORESVC_PATCH_VERSION
288 #endif
289  << ")";
290  }
291 
292  // Add the host name and current time to the message
294  << " "
295  << " running on " << System::hostName() << " on " << Gaudi::Time::current().format( true ) << std::endl
296  << "=================================================================="
297  << "==================================================================" << endmsg;
298  }
299 
300  // print all own properties if the options "PropertiesPrint" is set to true
301  if ( m_propertiesPrint ) {
302  const auto& properties = getProperties();
303  log << MSG::ALWAYS << "List of ALL properties of " << System::typeinfoName( typeid( *this ) ) << "/" << this->name()
304  << " #properties = " << properties.size() << endmsg;
305  for ( const auto& property : properties ) {
306  log << "Property ['Name': Value] = " << *property << endmsg;
307  }
308  }
309 
310  // Check if StatusCode need to be checked
311  if ( m_codeCheck ) {
313  sc = svcManager()->addService( "StatusCodeSvc", -9999 );
314  if ( sc.isFailure() ) {
315  log << MSG::FATAL << "Error adding StatusCodeSvc" << endmsg;
316  return StatusCode::FAILURE;
317  } else {
318  ON_VERBOSE
319  log << MSG::VERBOSE << "added service StatusCodeSvc" << endmsg;
320  }
321  } else {
323  }
324 
325  // set the requested environment variables
326  for ( auto& var : m_environment ) {
327  const std::string& name = var.first;
328  const std::string& value = var.second;
329  std::string old = System::getEnv( name.c_str() );
330  const MSG::Level lvl = ( !old.empty() && ( old != "UNKNOWN" ) ) ? MSG::WARNING : MSG::DEBUG;
331  if ( UNLIKELY( m_outputLevel <= lvl ) ) log << lvl << "Setting " << name << " = " << value << endmsg;
332  System::setEnv( name, value );
333  }
334 
335  // Declare Service Types
336  for ( auto& j : m_svcMapping ) {
338  if ( svcManager()->declareSvcType( itm.name(), itm.type() ).isFailure() ) {
339  log << MSG::ERROR << "configure: declaring svc type:'" << j << "' failed." << endmsg;
340  return StatusCode::FAILURE;
341  } else {
342  ON_VERBOSE
343  log << MSG::VERBOSE << "declared service " << j << endmsg;
344  }
345  }
346  for ( auto& j : m_svcOptMapping ) {
348  if ( svcManager()->declareSvcType( itm.name(), itm.type() ).isFailure() ) {
349  log << MSG::ERROR << "declaring svc type:'" << j << "' failed." << endmsg;
350  return StatusCode::FAILURE;
351  }
352  }
353 
354  //--------------------------------------------------------------------------
355  // Declare other Services and Algorithms by loading DLL's
356  sc = decodeDllNameList();
357  if ( sc.isFailure() ) {
358  log << MSG::ERROR << "Failure loading declared DLL's" << endmsg;
359  return sc;
360  }
361 
362  //--------------------------------------------------------------------------
363  // Deal with the services explicitly declared by the user.
364  sc = decodeExtSvcNameList();
365  if ( sc.isFailure() ) {
366  log << MSG::ERROR << "Failure during external service association" << endmsg;
367  return sc;
368  }
369 
371  if ( sc.isFailure() ) {
372  log << MSG::ERROR << "Failure during external service creation" << endmsg;
373  return sc;
374  }
375 
376  //--------------------------------------------------------------------------
377  // Retrieve intrinsic services. If needed configure them.
378  //--------------------------------------------------------------------------
379  const Gaudi::Utils::TypeNameString evtloop_item( m_eventLoopMgr );
380  sc = svcManager()->addService( evtloop_item, ServiceManager::DEFAULT_SVC_PRIORITY * 10 );
381  if ( !sc.isSuccess() ) {
382  log << MSG::FATAL << "Error adding :" << m_eventLoopMgr << endmsg;
383  return sc;
384  } else {
385  ON_VERBOSE
386  log << MSG::VERBOSE << "added service " << evtloop_item << endmsg;
387  }
388 
390  if ( !m_runable ) {
391  log << MSG::FATAL << "Error retrieving Runable: " << m_runableType.value() << "\n Check option ApplicationMgr."
392  << m_runableType.name() << endmsg;
393  return sc;
394  }
395  m_processingMgr = m_svcLocator->service( evtloop_item );
396  if ( !m_processingMgr ) {
397  log << MSG::FATAL << "Error retrieving Processing manager: " << m_eventLoopMgr.value()
398  << "\n Check option ApplicationMgr." << m_eventLoopMgr.name() << "\n No events will be processed." << endmsg;
399  return sc;
400  }
401 
402  // Establish Update Handlers for ExtSvc and DLLs Properties
403  m_extSvcNameList.declareUpdateHandler( &ApplicationMgr::extSvcNameListHandler, this );
404  m_createSvcNameList.declareUpdateHandler( &ApplicationMgr::createSvcNameListHandler, this );
405  m_dllNameList.declareUpdateHandler( &ApplicationMgr::dllNameListHandler, this );
406 
407  if ( m_actHistory ) {
408  // Create HistorySvc with a priority to ensure it's initialized last, finalized first
409  sc = svcManager()->addService( "HistorySvc", std::numeric_limits<int>::max() );
410  if ( sc.isFailure() ) {
411  log << MSG::FATAL << "Error adding HistorySvc" << endmsg;
412  return StatusCode::FAILURE;
413  }
414  }
415 
416  log << MSG::INFO << "Application Manager Configured successfully" << endmsg;
418  return StatusCode::SUCCESS;
419 }
Gaudi::StateMachine::State m_targetState
Internal State.
GAUDI_API std::string getEnv(const char *var)
get a particular environment variable (returning "UNKNOWN" if not set)
Definition: System.cpp:411
#define UNLIKELY(x)
Definition: Kernel.h:89
virtual StatusCode addService(IService *svc, int prio=DEFAULT_SVC_PRIORITY)=0
Add a service to the "active" list of services of the factory.
constexpr static const auto FAILURE
Definition: StatusCode.h:88
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
Gaudi::Property< bool > m_propertiesPrint
T empty(T...args)
StatusCode decodeDllNameList()
Gaudi::Property< int > m_returnCode
Property to record the error conditions occurring during the running.
GAUDI_API int setEnv(const std::string &name, const std::string &value, int overwrite=1)
Set an environment variables.
Definition: System.cpp:534
Gaudi::Property< bool > m_codeCheck
SmartIF< IRunable > m_runable
Reference to the runable object.
const std::vector< Gaudi::Details::PropertyBase * > & getProperties() const override
get all properties
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:332
bool isSuccess() const
Definition: StatusCode.h:287
const std::string & name() const override
T endl(T...args)
static Time current()
Returns the current time.
Definition: Time.cpp:112
Gaudi::Property< std::map< std::string, std::string > > m_environment
Gaudi::Property< std::string > m_appVersion
static GAUDI_API void enableChecking()
Definition: StatusCode.cpp:40
SmartIF< IJobOptionsSvc > m_jobOptionsSvc
Reference to JobOption service.
void createSvcNameListHandler(Gaudi::Details::PropertyBase &)
bool isFailure() const
Definition: StatusCode.h:139
SmartIF< IEventProcessor > m_processingMgr
Reference to processing manager object.
SmartIF< ISvcManager > & svcManager()
Gaudi::Property< std::string > m_eventLoopMgr
STL class.
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:79
Gaudi::Property< int > m_outputLevel
Helper class to parse a string of format "type/name".
void extSvcNameListHandler(Gaudi::Details::PropertyBase &theProp)
SmartIF< ISvcLocator > m_svcLocator
Reference to its own service locator (must be instantiated prior to any service!) ...
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
virtual StatusCode setMyProperties(const std::string &client, IProperty *me)=0
Override default properties of the calling client.
Gaudi::Property< std::vector< std::string > > m_extSvcNameList
void dllNameListHandler(Gaudi::Details::PropertyBase &theProp)
Gaudi::Property< std::string > m_runableType
Gaudi::Property< std::vector< std::string > > m_svcOptMapping
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
Gaudi::Property< std::vector< std::string > > m_svcMapping
Gaudi::Property< std::vector< std::string > > m_dllNameList
Gaudi::Property< bool > m_actHistory
StatusCode decodeExtSvcNameList()
GAUDI_API const std::string & hostName()
Host name.
Definition: System.cpp:337
Gaudi::Property< std::vector< std::string > > m_createSvcNameList
StatusCode decodeCreateSvcNameList()
T c_str(T...args)
StatusCode i_startup()
Internal startup routine.
static GAUDI_API void disableChecking()
Definition: StatusCode.cpp:42
#define ON_VERBOSE
Gaudi::StateMachine::State m_state
Internal State.
Gaudi::Property< std::string > m_appName
constexpr int Success
Definition: AppReturnCode.h:18
SmartIF< IMessageSvc > m_messageSvc
Reference to the message service.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
virtual void setOutputLevel(int new_level)=0
Set new global output level threshold.
std::string format(bool local, std::string spec="%c") const
Format the time using strftime.
Definition: Time.cpp:260
void ApplicationMgr::createSvcNameListHandler ( Gaudi::Details::PropertyBase )

Definition at line 911 of file ApplicationMgr.cpp.

912 {
913  if ( !( decodeCreateSvcNameList() ).isSuccess() ) {
914  throw GaudiException( "Failed to create ext services", "MinimalEventLoopMgr::createSvcNameListHandler",
916  }
917 }
constexpr static const auto FAILURE
Definition: StatusCode.h:88
Define general base for Gaudi exception.
StatusCode decodeCreateSvcNameList()
StatusCode ApplicationMgr::decodeCreateSvcNameList ( )

Definition at line 921 of file ApplicationMgr.cpp.

922 {
924  const auto& theNames = m_createSvcNameList.value();
925  auto it = theNames.begin();
926  auto et = theNames.end();
927  while ( result.isSuccess() && it != et ) {
928  Gaudi::Utils::TypeNameString item( *it++ );
929  if ( ( result = svcManager()->addService( item, ServiceManager::DEFAULT_SVC_PRIORITY ) ).isFailure() ) {
931  log << MSG::ERROR << "decodeCreateSvcNameList: Cannot create service " << item.type() << "/" << item.name()
932  << endmsg;
933  } else {
934  ON_DEBUG
935  {
937  log << MSG::DEBUG << "decodeCreateSvcNameList: Created service " << item.type() << "/" << item.name() << endmsg;
938  }
939  }
940  }
941  return result;
942 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
bool isSuccess() const
Definition: StatusCode.h:287
SmartIF< ISvcManager > & svcManager()
Helper class to parse a string of format "type/name".
#define ON_DEBUG
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
Gaudi::Property< std::vector< std::string > > m_createSvcNameList
std::string m_name
Name.
SmartIF< IMessageSvc > m_messageSvc
Reference to the message service.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
StatusCode ApplicationMgr::decodeDllNameList ( )

Definition at line 998 of file ApplicationMgr.cpp.

999 {
1000 
1003 
1004  // Clean up multiple entries from DLL list
1005  // -------------------------------------------------------------------------
1006  std::vector<std::string> newList;
1007  std::map<std::string, unsigned int> dllInList, duplicateList;
1008  {
1009  for ( const auto it : m_dllNameList ) {
1010  if ( 0 == dllInList[it] ) {
1011  newList.push_back( it ); // first instance of this module
1012  } else {
1013  ++duplicateList[it];
1014  } // module listed multiple times
1015  ++dllInList[it]; // increment count for this module
1016  }
1017  }
1018  // m_dllNameList = newList; // update primary list to new, filtered list (do not use the
1019  // property itself otherwise we get called again infinitely)
1020  // List modules that were in there twice..
1021  ON_DEBUG if ( !duplicateList.empty() )
1022  {
1023  log << MSG::DEBUG << "Removed duplicate entries for modules : ";
1024  for ( auto it = duplicateList.begin(); it != duplicateList.end(); ++it ) {
1025  log << it->first << "(" << 1 + it->second << ")";
1026  if ( it != --duplicateList.end() ) log << ", ";
1027  }
1028  log << endmsg;
1029  }
1030  // -------------------------------------------------------------------------
1031 
1032  const std::vector<std::string>& theNames = newList;
1033 
1034  // only load the new dlls or previously failed dlls
1035  ON_DEBUG log << MSG::DEBUG << "Loading declared DLL's" << endmsg;
1036 
1037  std::vector<std::string> successNames, failNames;
1038  for ( const auto& it : theNames ) {
1039  if ( std::find( m_okDlls.rbegin(), m_okDlls.rend(), it ) == m_okDlls.rend() ) {
1040  // found a new module name
1041  StatusCode status = m_classManager->loadModule( it );
1042  if ( status.isFailure() ) {
1043  failNames.push_back( it );
1044  result = StatusCode::FAILURE;
1045  } else {
1046  successNames.push_back( it );
1047  }
1048  }
1049  }
1050 
1051  // report back to the user and store the names of the succesfully loaded dlls
1052  if ( !successNames.empty() ) {
1053  log << MSG::INFO << "Successfully loaded modules : ";
1054  for ( auto it = successNames.begin(); it != successNames.end(); it++ ) {
1055  log << ( *it );
1056  if ( ( it + 1 ) != successNames.end() ) log << ", ";
1057  // save name
1058  m_okDlls.push_back( *it );
1059  }
1060  log << endmsg;
1061  }
1062 
1063  if ( result == StatusCode::FAILURE ) {
1064  log << MSG::WARNING << "Failed to load modules: ";
1065  for ( auto it = failNames.begin(); it != failNames.end(); it++ ) {
1066  log << ( *it );
1067  if ( ( it + 1 ) != failNames.end() ) log << ", ";
1068  }
1069  log << endmsg;
1070  }
1071  return result;
1072 }
constexpr static const auto FAILURE
Definition: StatusCode.h:88
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
T empty(T...args)
StatusCode loadModule(const std::string &module, bool fireIncident=true) override
T rend(T...args)
T end(T...args)
std::vector< std::string > m_okDlls
names of successfully loaded dlls
bool isFailure() const
Definition: StatusCode.h:139
T push_back(T...args)
#define ON_DEBUG
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
Gaudi::Property< std::vector< std::string > > m_dllNameList
T find(T...args)
SmartIF< DLLClassManager > m_classManager
Reference to the class manager.
T begin(T...args)
std::string m_name
Name.
SmartIF< IMessageSvc > m_messageSvc
Reference to the message service.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
T rbegin(T...args)
StatusCode ApplicationMgr::decodeExtSvcNameList ( )

Definition at line 958 of file ApplicationMgr.cpp.

959 {
961 
962  const auto& theNames = m_extSvcNameList.value();
963 
964  auto it = theNames.begin();
965  auto et = theNames.end();
966  while ( result.isSuccess() && it != et ) {
967  Gaudi::Utils::TypeNameString item( *it++ );
968  if ( m_extSvcCreates ) {
969  if ( ( result = svcManager()->addService( item, ServiceManager::DEFAULT_SVC_PRIORITY ) ).isFailure() ) {
971  log << MSG::ERROR << "decodeExtSvcNameList: Cannot create service " << item.type() << "/" << item.name()
972  << endmsg;
973  }
974  } else {
975  if ( ( result = svcManager()->declareSvcType( item.name(), item.type() ) ).isFailure() ) {
977  log << MSG::ERROR << "decodeExtSvcNameList: Cannot declare service " << item.type() << "/" << item.name()
978  << endmsg;
979  }
980  }
981  }
982  return result;
983 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
bool isSuccess() const
Definition: StatusCode.h:287
SmartIF< ISvcManager > & svcManager()
Helper class to parse a string of format "type/name".
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
Gaudi::Property< std::vector< std::string > > m_extSvcNameList
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
Gaudi::Property< bool > m_extSvcCreates
std::string m_name
Name.
SmartIF< IMessageSvc > m_messageSvc
Reference to the message service.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
void ApplicationMgr::dllNameListHandler ( Gaudi::Details::PropertyBase theProp)

Definition at line 988 of file ApplicationMgr.cpp.

989 {
990  if ( !( decodeDllNameList() ).isSuccess() ) {
991  throw GaudiException( "Failed to load DLLs.", "MinimalEventLoopMgr::dllNameListHandler", StatusCode::FAILURE );
992  }
993 }
constexpr static const auto FAILURE
Definition: StatusCode.h:88
Define general base for Gaudi exception.
StatusCode decodeDllNameList()
void ApplicationMgr::evtLoopPropertyHandler ( Gaudi::Details::PropertyBase theProp)

Definition at line 900 of file ApplicationMgr.cpp.

901 {
902  if ( m_processingMgr ) {
903  auto props = m_processingMgr.as<IProperty>();
904  if ( props ) props->setProperty( p ).ignore();
905  }
906 }
SmartIF< IEventProcessor > m_processingMgr
Reference to processing manager object.
virtual StatusCode setProperty(const Gaudi::Details::PropertyBase &p)=0
Set the property by property.
SmartIF< IFace > as() const
return a new SmartIF instance to another interface
Definition: SmartIF.h:115
const StatusCode & ignore() const
Ignore/check StatusCode.
Definition: StatusCode.h:165
The IProperty is the basic interface for all components which have properties that can be set or get...
Definition: IProperty.h:20
StatusCode ApplicationMgr::executeEvent ( void *  par)
override

implementation of IEventProcessor::executeEvent(void*)

Definition at line 806 of file ApplicationMgr.cpp.

807 {
810  if ( m_processingMgr ) {
811  return m_processingMgr->executeEvent( par );
812  }
813  }
814  log << MSG::FATAL << "executeEvent: Invalid state \"" << FSMState() << "\"" << endmsg;
815  return StatusCode::FAILURE;
816 }
constexpr static const auto FAILURE
Definition: StatusCode.h:88
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
const std::string & name() const override
virtual StatusCode executeEvent(void *par=0)=0
Process single event.
SmartIF< IEventProcessor > m_processingMgr
Reference to processing manager object.
Gaudi::StateMachine::State m_state
Internal State.
Gaudi::StateMachine::State FSMState() const override
SmartIF< IMessageSvc > m_messageSvc
Reference to the message service.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
StatusCode ApplicationMgr::executeRun ( int  evtmax)
override

implementation of IEventProcessor::executeRun(int)

Definition at line 821 of file ApplicationMgr.cpp.

822 {
825  if ( m_processingMgr ) {
826  return m_processingMgr->executeRun( evtmax );
827  }
828  log << MSG::WARNING << "No EventLoop Manager specified " << endmsg;
829  return StatusCode::SUCCESS;
830  }
831  log << MSG::FATAL << "executeRun: Invalid state \"" << FSMState() << "\"" << endmsg;
832  return StatusCode::FAILURE;
833 }
constexpr static const auto FAILURE
Definition: StatusCode.h:88
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
const std::string & name() const override
SmartIF< IEventProcessor > m_processingMgr
Reference to processing manager object.
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
Gaudi::StateMachine::State m_state
Internal State.
Gaudi::StateMachine::State FSMState() const override
virtual StatusCode executeRun(int maxevt)=0
Process the maxevt events as a Run.
SmartIF< IMessageSvc > m_messageSvc
Reference to the message service.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
void ApplicationMgr::extSvcNameListHandler ( Gaudi::Details::PropertyBase theProp)

Definition at line 947 of file ApplicationMgr.cpp.

948 {
949  if ( !( decodeExtSvcNameList() ).isSuccess() ) {
950  throw GaudiException( "Failed to declare ext services", "MinimalEventLoopMgr::extSvcNameListHandler",
952  }
953 }
constexpr static const auto FAILURE
Definition: StatusCode.h:88
Define general base for Gaudi exception.
StatusCode decodeExtSvcNameList()
StatusCode ApplicationMgr::finalize ( )
override

Definition at line 571 of file ApplicationMgr.cpp.

572 {
575  log << MSG::INFO << "Already Finalized" << endmsg;
576  return StatusCode::SUCCESS;
577  }
579  log << MSG::FATAL << "finalize: Invalid state \"" << m_state << "\"" << endmsg;
580  return StatusCode::FAILURE;
581  }
583 
584  // disable message suppression in finalize
585  m_svcLocator->service<IProperty>( "MessageSvc" )
586  ->setProperty( Gaudi::Property<bool>( "enableSuppression", false ) )
587  .ignore();
588 
589  // Finalize independently managed Algorithms
590  StatusCode sc = algManager()->finalize();
591  if ( sc.isFailure() ) {
592  log << MSG::WARNING << "Failed to finalize an algorithm." << endmsg;
594  }
595 
596  // Finalize all Services
597  sc = svcManager()->finalize();
598  if ( sc.isFailure() ) {
599  log << MSG::WARNING << "Failed to finalize a service." << endmsg;
601  }
602 
603  // svcManager()->removeService( (IService*) m_processingMgr.get() );
604  // svcManager()->removeService( (IService*) m_runable.get() );
605 
606  if ( m_codeCheck ) {
608  }
609 
610  if ( sc.isSuccess() ) {
611  log << MSG::INFO << "Application Manager Finalized successfully" << endmsg;
612  } else {
613  log << MSG::ERROR << "Application Manager failed to finalize" << endmsg;
614  }
615 
617  return sc;
618 }
Gaudi::StateMachine::State m_targetState
Internal State.
constexpr int FinalizationFailure
Error codes for operation failures.
Definition: AppReturnCode.h:34
constexpr static const auto FAILURE
Definition: StatusCode.h:88
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
Gaudi::Property< int > m_returnCode
Property to record the error conditions occurring during the running.
Gaudi::Property< bool > m_codeCheck
Implementation of property with value of concrete type.
Definition: Property.h:383
StatusCode setProperty(const Gaudi::Details::PropertyBase &p) override
set the property form another property
bool isSuccess() const
Definition: StatusCode.h:287
const std::string & name() const override
bool isFailure() const
Definition: StatusCode.h:139
SmartIF< ISvcManager > & svcManager()
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:79
SmartIF< ISvcLocator > m_svcLocator
Reference to its own service locator (must be instantiated prior to any service!) ...
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
virtual StatusCode finalize()=0
Finalize (from INITIALIZED to CONFIGURED).
static GAUDI_API void disableChecking()
Definition: StatusCode.cpp:42
Gaudi::StateMachine::State m_state
Internal State.
The IProperty is the basic interface for all components which have properties that can be set or get...
Definition: IProperty.h:20
SmartIF< IAlgManager > & algManager()
SmartIF< IMessageSvc > m_messageSvc
Reference to the message service.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
Gaudi::StateMachine::State ApplicationMgr::FSMState ( ) const
override

Definition at line 855 of file ApplicationMgr.cpp.

855 { return m_state; }
Gaudi::StateMachine::State m_state
Internal State.
template<class I >
SmartIF<IComponentManager>& ApplicationMgr::getManager ( )
inline

Definition at line 117 of file ApplicationMgr.h.

118  {
119  return m_managers[I::interfaceID().id()];
120  }
ManagersMap m_managers
Map of known component managers.
StatusCode ApplicationMgr::GoToState ( Gaudi::StateMachine::State  state,
bool  ignoreFailures = false 
)
protected

Reach a state from current state (whichever it is) going through the correct transitions.

By default, if a transition fails, the chain is interrupted, but the behavior can be changed with the parameter "gnoreFailures"

Definition at line 682 of file ApplicationMgr.cpp.

683 {
685 
686  switch ( state ) {
687 
689  switch ( m_state ) {
691  return StatusCode::SUCCESS;
692  break;
694  return terminate();
695  break;
696  default: // Gaudi::StateMachine::INITIALIZED or Gaudi::StateMachine::RUNNING
698  if ( sc.isSuccess() ) {
699  return terminate();
700  }
701  break;
702  }
703  break;
704 
706  switch ( m_state ) {
708  return StatusCode::SUCCESS;
709  break;
711  return configure();
712  break;
714  return finalize();
715  break;
716  default: // Gaudi::StateMachine::RUNNING
718  if ( sc.isSuccess() ) {
719  return finalize();
720  }
721  break;
722  }
723  break;
724 
726  switch ( m_state ) {
728  return StatusCode::SUCCESS;
729  break;
731  return initialize();
732  break;
734  return stop();
735  break;
736  default: // Gaudi::StateMachine::OFFLINE
738  if ( sc.isSuccess() ) {
739  return initialize();
740  }
741  break;
742  }
743  break;
744 
746  switch ( m_state ) {
748  return StatusCode::SUCCESS;
749  break;
751  return start();
752  break;
753  default: // Gaudi::StateMachine::OFFLINE or Gaudi::StateMachine::CONFIGURED
755  if ( sc.isSuccess() ) {
756  return start();
757  }
758  break;
759  }
760  break;
761  }
762 
763  // If I get here, there has been a problem in the recursion
764 
765  if ( ignoreFailures ) {
766  // force the new state
767  m_state = state;
768  return StatusCode::SUCCESS;
769  }
770 
771  return sc;
772 }
StatusCode initialize() override
bool isSuccess() const
Definition: StatusCode.h:287
StatusCode terminate() override
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
StatusCode GoToState(Gaudi::StateMachine::State state, bool ignoreFailures=false)
Reach a state from current state (whichever it is) going through the correct transitions.
StatusCode finalize() override
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
StatusCode start() override
StatusCode configure() override
StatusCode stop() override
Gaudi::StateMachine::State m_state
Internal State.
StatusCode ApplicationMgr::i_startup ( )
protected

Internal startup routine.

Definition at line 122 of file ApplicationMgr.cpp.

123 {
124 
125  StatusCode sc;
126 
127  // declare factories in current module
129 
130  // Note: we cannot use CommonMessaging methods here because MessageSvc is not there yet
131  MsgStream log( nullptr, name() );
132 
133  // Create the Message service
134  auto msgsvc = svcManager()->createService( Gaudi::Utils::TypeNameString( "MessageSvc", m_messageSvcType ) );
135  if ( !msgsvc ) {
136  log << MSG::FATAL << "Error creating MessageSvc of type " << m_messageSvcType << endmsg;
137  return StatusCode::FAILURE;
138  }
139  // Get the useful interface from Message services
140  m_messageSvc = m_svcLocator->service( "MessageSvc" );
141  if ( !m_messageSvc ) {
142  log << MSG::FATAL << "Error retrieving MessageSvc." << endmsg;
143  return StatusCode::FAILURE;
144  }
145 
146  auto jobsvc = svcManager()->createService( Gaudi::Utils::TypeNameString( "JobOptionsSvc", m_jobOptionsSvcType ) );
147  // Create the Job Options service
148  if ( !jobsvc ) {
149  log << MSG::FATAL << "Error creating JobOptionsSvc" << endmsg;
150  return StatusCode::FAILURE;
151  }
152  // Get the useful interface from Message services
153  m_jobOptionsSvc = m_svcLocator->service( "JobOptionsSvc" );
154  if ( !m_jobOptionsSvc ) {
155  log << MSG::FATAL << "Error retrieving JobOptionsSvc." << endmsg;
156  return StatusCode::FAILURE;
157  }
158 
159  auto jobOptsIProp = jobsvc.as<IProperty>();
160  if ( !jobOptsIProp ) {
161  log << MSG::FATAL << "Error locating JobOptionsSvc" << endmsg;
162  return StatusCode::FAILURE;
163  }
164  sc = jobOptsIProp->setProperty( Gaudi::Property<std::string>( "TYPE", m_jobOptionsType ) );
165  if ( !sc.isSuccess() ) {
166  log << MSG::FATAL << "Error setting TYPE option in JobOptionsSvc" << endmsg;
167  return sc;
168  }
169 
170  if ( !m_jobOptionsPreAction.empty() ) {
171  sc = jobOptsIProp->setProperty( Gaudi::Property<std::string>( "PYTHONPARAMS", m_jobOptionsPreAction ) );
172  if ( !sc.isSuccess() ) {
173  log << MSG::FATAL << "Error setting JobOptionsPreAction option in JobOptionsSvc" << endmsg;
174  return sc;
175  }
176  }
177 
178  if ( !m_jobOptionsPostAction.empty() ) {
179  sc = jobOptsIProp->setProperty( Gaudi::Property<std::string>( "PYTHONACTION", m_jobOptionsPostAction ) );
180  if ( !sc.isSuccess() ) {
181  log << MSG::FATAL << "Error setting JobOptionsPostAction option in JobOptionsSvc" << endmsg;
182  return sc;
183  }
184  }
185 
186  if ( !m_jobOptionsPath.empty() ) { // The command line takes precedence
187  sc = jobOptsIProp->setProperty( Gaudi::Property<std::string>( "PATH", m_jobOptionsPath ) );
188  if ( !sc.isSuccess() ) {
189  log << MSG::FATAL << "Error setting PATH option in JobOptionsSvc" << endmsg;
190  return sc;
191  }
192  } else if ( isEnvSet( "JOBOPTPATH" ) ) { // Otherwise the Environment JOBOPTPATH
193  sc = jobOptsIProp->setProperty( Gaudi::Property<std::string>( "PATH", getEnv( "JOBOPTPATH" ) ) );
194  if ( !sc.isSuccess() ) {
195  log << MSG::FATAL << "Error setting PATH option in JobOptionsSvc from env" << endmsg;
196  return sc;
197  }
198  } else { // Otherwise the default
199  sc = jobOptsIProp->setProperty( Gaudi::Property<std::string>( "PATH", "../options/job.opts" ) );
200  if ( !sc.isSuccess() ) {
201  log << MSG::FATAL << "Error setting PATH option in JobOptionsSvc to default" << endmsg;
202  return sc;
203  }
204  }
205  jobOptsIProp.reset();
206 
207  // Sets my default the Output Level of the Message service to be
208  // the same as this
209  auto msgSvcIProp = msgsvc.as<IProperty>();
210  msgSvcIProp->setProperty( Gaudi::Property<int>( "OutputLevel", m_outputLevel ) ).ignore();
211  msgSvcIProp.reset();
212 
213  sc = jobsvc->sysInitialize();
214  if ( !sc.isSuccess() ) {
215  log << MSG::FATAL << "Error initializing JobOptionsSvc" << endmsg;
216  return sc;
217  }
218  sc = msgsvc->sysInitialize();
219  if ( !sc.isSuccess() ) {
220  log << MSG::FATAL << "Error initializing MessageSvc" << endmsg;
221  return sc;
222  }
223 
224  // Make sure output level caches are up to date.
226 
227  return sc;
228 }
GAUDI_API std::string getEnv(const char *var)
get a particular environment variable (returning "UNKNOWN" if not set)
Definition: System.cpp:411
constexpr static const auto FAILURE
Definition: StatusCode.h:88
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
StatusCode loadModule(const std::string &module, bool fireIncident=true) override
Implementation of property with value of concrete type.
Definition: Property.h:383
Gaudi::Property< std::string > m_jobOptionsType
bool isSuccess() const
Definition: StatusCode.h:287
const std::string & name() const override
void outputLevelUpdate() override
Function to call to update the outputLevel of the components (after a change in MessageSvc).
SmartIF< IJobOptionsSvc > m_jobOptionsSvc
Reference to JobOption service.
SmartIF< ISvcManager > & svcManager()
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:79
virtual StatusCode setProperty(const Gaudi::Details::PropertyBase &p)=0
Set the property by property.
Gaudi::Property< int > m_outputLevel
Helper class to parse a string of format "type/name".
SmartIF< ISvcLocator > m_svcLocator
Reference to its own service locator (must be instantiated prior to any service!) ...
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
virtual SmartIF< IService > & createService(const Gaudi::Utils::TypeNameString &nametype)=0
Creates and instance of a service type that has been declared beforehand and assigns it a name...
Gaudi::Property< std::string > m_jobOptionsPreAction
GAUDI_API bool isEnvSet(const char *var)
Check if an environment variable is set or not.
Definition: System.cpp:433
SmartIF< DLLClassManager > m_classManager
Reference to the class manager.
Gaudi::Property< std::string > m_jobOptionsSvcType
const StatusCode & ignore() const
Ignore/check StatusCode.
Definition: StatusCode.h:165
Gaudi::Property< std::string > m_jobOptionsPostAction
Gaudi::Property< std::string > m_messageSvcType
The IProperty is the basic interface for all components which have properties that can be set or get...
Definition: IProperty.h:20
SmartIF< IMessageSvc > m_messageSvc
Reference to the message service.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
Gaudi::Property< std::string > m_jobOptionsPath
StatusCode ApplicationMgr::initialize ( )
override

Definition at line 424 of file ApplicationMgr.cpp.

425 {
426  StatusCode sc;
427 
429 
430  // Make sure output level caches are up to date.
432 
433  // I cannot add these services in configure() because they are coming from GaudiUtils
434  // and it messes up genconf when rebuilding it.
435  if ( m_stopOnSignal ) {
436  // Instantiate the service that schedules a stop when a signal is received
437  std::string svcname( "Gaudi::Utils::StopSignalHandler" );
438  sc = svcManager()->addService( svcname );
439  if ( sc.isFailure() ) {
440  log << MSG::INFO << "Cannot instantiate " << svcname << "signals will be ignored" << endmsg;
441  }
442  }
443 
444  if ( m_stalledEventMonitoring ) {
445  // Instantiate the service that schedules a stop when a signal is received
446  std::string svcname( "StalledEventMonitor" );
447  sc = svcManager()->addService( svcname );
448  if ( sc.isFailure() ) {
449  log << MSG::INFO << "Cannot instantiate " << svcname << "signals will be ignored" << endmsg;
450  }
451  }
452 
454  log << MSG::INFO << "Already Initialized!" << endmsg;
455  return StatusCode::SUCCESS;
456  }
458  log << MSG::FATAL << "initialize: Invalid state \"" << m_state << "\"" << endmsg;
459  return StatusCode::FAILURE;
460  }
462 
463  //--------------------------------------------------------------------------
464  // Initialize the list of top Services
465  //--------------------------------------------------------------------------
466  sc = svcManager()->initialize();
467  if ( !sc.isSuccess() ) return sc;
468 
469  //--------------------------------------------------------------------------
470  // Final steps: Inform user and change internal state
471  //--------------------------------------------------------------------------
472  log << MSG::INFO << "Application Manager Initialized successfully" << endmsg;
474 
475  return sc;
476 }
Gaudi::StateMachine::State m_targetState
Internal State.
virtual StatusCode addService(IService *svc, int prio=DEFAULT_SVC_PRIORITY)=0
Add a service to the "active" list of services of the factory.
constexpr static const auto FAILURE
Definition: StatusCode.h:88
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
Gaudi::Property< bool > m_stopOnSignal
Property to enable/disable the "stop on signal" service.
bool isSuccess() const
Definition: StatusCode.h:287
const std::string & name() const override
void outputLevelUpdate() override
Function to call to update the outputLevel of the components (after a change in MessageSvc).
bool isFailure() const
Definition: StatusCode.h:139
SmartIF< ISvcManager > & svcManager()
STL class.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
Gaudi::Property< bool > m_stalledEventMonitoring
Property to enable/disable the monitoring and reporting of stalled events.
virtual StatusCode initialize()=0
Initialization (from CONFIGURED to INITIALIZED).
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
Gaudi::StateMachine::State m_state
Internal State.
SmartIF< IMessageSvc > m_messageSvc
Reference to the message service.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
const std::string & ApplicationMgr::name ( ) const
override

Definition at line 852 of file ApplicationMgr.cpp.

852 { return m_name; }
std::string m_name
Name.
StatusCode ApplicationMgr::nextEvent ( int  maxevt)
override

Definition at line 515 of file ApplicationMgr.cpp.

516 {
519  log << MSG::FATAL << "nextEvent: Invalid state \"" << m_state << "\"" << endmsg;
520  return StatusCode::FAILURE;
521  }
522  if ( !m_processingMgr ) {
524  log << MSG::FATAL << "No event processing manager specified. Check option: " << m_eventLoopMgr.name() << endmsg;
525  return StatusCode::FAILURE;
526  }
527  return m_processingMgr->nextEvent( maxevt );
528 }
constexpr static const auto FAILURE
Definition: StatusCode.h:88
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
const std::string & name() const override
SmartIF< IEventProcessor > m_processingMgr
Reference to processing manager object.
Gaudi::Property< std::string > m_eventLoopMgr
virtual StatusCode nextEvent(int maxevt)=0
Process the next maxevt events.
Gaudi::StateMachine::State m_state
Internal State.
int maxevt
Definition: Bootstrap.cpp:276
SmartIF< IMessageSvc > m_messageSvc
Reference to the message service.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
void ApplicationMgr::outputLevelUpdate ( )
override

Function to call to update the outputLevel of the components (after a change in MessageSvc).

Definition at line 1074 of file ApplicationMgr.cpp.

1075 {
1076  resetMessaging();
1077  for ( auto& mgrItem : m_managers ) {
1078  mgrItem.second->outputLevelUpdate();
1079  }
1080 }
ManagersMap m_managers
Map of known component managers.
void ApplicationMgr::pluginDebugPropertyHandler ( Gaudi::Details::PropertyBase theProp)
StatusCode ApplicationMgr::queryInterface ( const InterfaceID iid,
void **  pinterface 
)
override

Definition at line 85 of file ApplicationMgr.cpp.

86 {
87  if ( !ppvi ) {
88  return StatusCode::FAILURE;
89  }
90 
91  // try to find own/direct interfaces:
92  StatusCode sc = base_class::queryInterface( iid, ppvi );
93  if ( sc.isSuccess() ) return sc;
94 
95  // find indirect interfaces :
96  if ( ISvcLocator::interfaceID().versionMatch( iid ) ) {
97  return serviceLocator()->queryInterface( iid, ppvi );
98  }
99  if ( ISvcManager::interfaceID().versionMatch( iid ) ) {
100  return svcManager()->queryInterface( iid, ppvi );
101  }
102  if ( IAlgManager::interfaceID().versionMatch( iid ) ) {
103  return algManager()->queryInterface( iid, ppvi );
104  }
105  if ( IClassManager::interfaceID().versionMatch( iid ) ) {
106  return m_classManager->queryInterface( iid, ppvi );
107  }
108  if ( IMessageSvc::interfaceID().versionMatch( iid ) ) {
109  *ppvi = m_messageSvc.get();
110  if ( m_messageSvc ) m_messageSvc->addRef();
111  // Note that 0 can be a valid IMessageSvc pointer value (when used for
112  // MsgStream).
113  return StatusCode::SUCCESS;
114  }
115  *ppvi = nullptr;
116  return StatusCode::FAILURE;
117 }
constexpr static const auto FAILURE
Definition: StatusCode.h:88
bool isSuccess() const
Definition: StatusCode.h:287
SmartIF< ISvcManager > & svcManager()
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:82
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
StatusCode queryInterface(const InterfaceID &iid, void **pinterface) override
implementation of IInterface::queryInterface
constexpr bool versionMatch(const InterfaceID &iid) const
check compatibility.
Definition: IInterface.h:62
SmartIF< DLLClassManager > m_classManager
Reference to the class manager.
virtual unsigned long addRef()=0
Increment the reference count of Interface instance.
SmartIF< ISvcLocator > & serviceLocator() const override
Needed to locate the message service.
StatusCode queryInterface(const InterfaceID &iid, void **pinterface) override
SmartIF< IAlgManager > & algManager()
static const InterfaceID & interfaceID()
Return an instance of InterfaceID identifying the interface.
Definition: IInterface.h:287
SmartIF< IMessageSvc > m_messageSvc
Reference to the message service.
virtual StatusCode queryInterface(const InterfaceID &ti, void **pp)=0
Set the void** to the pointer to the requested interface of the instance.
StatusCode ApplicationMgr::reinitialize ( )
override

Definition at line 862 of file ApplicationMgr.cpp.

863 {
865  StatusCode sc;
867  throw GaudiException( "Cannot reinitialize application if not INITIALIZED or RUNNING",
868  "ApplicationMgr::reinitialize", StatusCode::FAILURE );
869  }
872  }
873  sc = svcManager()->reinitialize();
874  if ( sc.isFailure() ) retval = sc;
875  sc = algManager()->reinitialize();
876  if ( sc.isFailure() ) retval = sc;
877  return retval;
878 }
constexpr static const auto FAILURE
Definition: StatusCode.h:88
Define general base for Gaudi exception.
bool isFailure() const
Definition: StatusCode.h:139
SmartIF< ISvcManager > & svcManager()
virtual StatusCode reinitialize()=0
Initialization (from INITIALIZED or RUNNING to INITIALIZED, via CONFIGURED).
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
StatusCode GoToState(Gaudi::StateMachine::State state, bool ignoreFailures=false)
Reach a state from current state (whichever it is) going through the correct transitions.
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
Gaudi::StateMachine::State m_state
Internal State.
SmartIF< IAlgManager > & algManager()
StatusCode ApplicationMgr::restart ( )
override

Definition at line 883 of file ApplicationMgr.cpp.

884 {
886  StatusCode sc;
888  throw GaudiException( "Cannot restart application if not RUNNING", "ApplicationMgr::restart", StatusCode::FAILURE );
889  }
890  sc = svcManager()->restart();
891  if ( sc.isFailure() ) retval = sc;
892  sc = algManager()->restart();
893  if ( sc.isFailure() ) retval = sc;
894  return retval;
895 }
constexpr static const auto FAILURE
Definition: StatusCode.h:88
Define general base for Gaudi exception.
bool isFailure() const
Definition: StatusCode.h:139
SmartIF< ISvcManager > & svcManager()
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
virtual StatusCode restart()=0
Initialization (from RUNNING to RUNNING, via INITIALIZED).
Gaudi::StateMachine::State m_state
Internal State.
SmartIF< IAlgManager > & algManager()
StatusCode ApplicationMgr::run ( )
override

Definition at line 777 of file ApplicationMgr.cpp.

778 {
780 
782  if ( sc.isSuccess() ) {
784  if ( m_runable != 0 ) { // loop over the events
785  sc = m_runable->run();
786  if ( !sc.isSuccess() ) {
787  log << MSG::FATAL << "Application execution failed. Ending the job." << endmsg;
788  }
789  } else {
790  log << MSG::FATAL << "Application has no runable object. Check option:" << m_runableType.name() << endmsg;
791  }
792  }
793  if ( sc.isSuccess() ) { // try to close cleanly
795  }
796  // either the runable failed of the stut-down
797  if ( sc.isFailure() ) { // try to close anyway (but keep the StatusCode unchanged)
799  }
800  return sc;
801 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
virtual StatusCode run()=0
Run the class implementation.
SmartIF< IRunable > m_runable
Reference to the runable object.
bool isSuccess() const
Definition: StatusCode.h:287
const std::string & name() const override
bool isFailure() const
Definition: StatusCode.h:139
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
Gaudi::Property< std::string > m_runableType
StatusCode GoToState(Gaudi::StateMachine::State state, bool ignoreFailures=false)
Reach a state from current state (whichever it is) going through the correct transitions.
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
const StatusCode & ignore() const
Ignore/check StatusCode.
Definition: StatusCode.h:165
SmartIF< IMessageSvc > m_messageSvc
Reference to the message service.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
SmartIF<ISvcLocator>& ApplicationMgr::serviceLocator ( ) const
inlineoverride

Needed to locate the message service.

Definition at line 141 of file ApplicationMgr.h.

141 { return m_svcLocator; }
SmartIF< ISvcLocator > m_svcLocator
Reference to its own service locator (must be instantiated prior to any service!) ...
void ApplicationMgr::setServiceManager ( ISvcManager )
inlineoverrideprotected

Definition at line 148 of file ApplicationMgr.h.

148 {}
StatusCode ApplicationMgr::start ( )
override

Definition at line 481 of file ApplicationMgr.cpp.

482 {
483 
485  StatusCode sc;
486 
488  log << MSG::INFO << "Already Initialized!" << endmsg;
489  return StatusCode::SUCCESS;
490  }
492  log << MSG::FATAL << "start: Invalid state \"" << m_state << "\"" << endmsg;
493  return StatusCode::FAILURE;
494  }
496 
497  //--------------------------------------------------------------------------
498  // Initialize the list of top Services
499  //--------------------------------------------------------------------------
500  sc = svcManager()->start();
501  if ( !sc.isSuccess() ) return sc;
502 
503  //--------------------------------------------------------------------------
504  // Final steps: Inform user and change internal state
505  //--------------------------------------------------------------------------
506  log << MSG::INFO << "Application Manager Started successfully" << endmsg;
508 
509  return sc;
510 }
Gaudi::StateMachine::State m_targetState
Internal State.
constexpr static const auto FAILURE
Definition: StatusCode.h:88
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
bool isSuccess() const
Definition: StatusCode.h:287
const std::string & name() const override
SmartIF< ISvcManager > & svcManager()
virtual StatusCode start()=0
Start (from INITIALIZED to RUNNING).
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
Gaudi::StateMachine::State m_state
Internal State.
SmartIF< IMessageSvc > m_messageSvc
Reference to the message service.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
StatusCode ApplicationMgr::stop ( )
override

Definition at line 533 of file ApplicationMgr.cpp.

534 {
535 
537  StatusCode sc;
538 
540  log << MSG::INFO << "Already Initialized!" << endmsg;
541  return StatusCode::SUCCESS;
542  }
544  log << MSG::FATAL << "stop: Invalid state \"" << m_state << "\"" << endmsg;
545  return StatusCode::FAILURE;
546  }
548 
549  // Stop independently managed Algorithms
550  sc = algManager()->stop();
551  if ( !sc.isSuccess() ) return sc;
552 
553  //--------------------------------------------------------------------------
554  // Stop the list of top Services
555  //--------------------------------------------------------------------------
556  sc = svcManager()->stop();
557  if ( !sc.isSuccess() ) return sc;
558 
559  //--------------------------------------------------------------------------
560  // Final steps: Inform user and change internal state
561  //--------------------------------------------------------------------------
562  log << MSG::INFO << "Application Manager Stopped successfully" << endmsg;
564 
565  return sc;
566 }
Gaudi::StateMachine::State m_targetState
Internal State.
constexpr static const auto FAILURE
Definition: StatusCode.h:88
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
bool isSuccess() const
Definition: StatusCode.h:287
const std::string & name() const override
SmartIF< ISvcManager > & svcManager()
virtual StatusCode stop()=0
Stop (from RUNNING to INITIALIZED).
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
Gaudi::StateMachine::State m_state
Internal State.
SmartIF< IAlgManager > & algManager()
SmartIF< IMessageSvc > m_messageSvc
Reference to the message service.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
StatusCode ApplicationMgr::stopRun ( )
override

implementation of IEventProcessor::stopRun()

Definition at line 838 of file ApplicationMgr.cpp.

839 {
842  if ( m_processingMgr ) {
843  return m_processingMgr->stopRun();
844  }
845  log << MSG::WARNING << "No EventLoop Manager specified " << endmsg;
846  return StatusCode::SUCCESS;
847  }
848  log << MSG::FATAL << "stopRun: Invalid state \"" << FSMState() << "\"" << endmsg;
849  return StatusCode::FAILURE;
850 }
constexpr static const auto FAILURE
Definition: StatusCode.h:88
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
virtual StatusCode stopRun()=0
Schedule a stop of the current event processing.
const std::string & name() const override
SmartIF< IEventProcessor > m_processingMgr
Reference to processing manager object.
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
Gaudi::StateMachine::State m_state
Internal State.
Gaudi::StateMachine::State FSMState() const override
SmartIF< IMessageSvc > m_messageSvc
Reference to the message service.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
SmartIF<ISvcManager>& ApplicationMgr::svcManager ( )
inline

Definition at line 122 of file ApplicationMgr.h.

123  {
124  // Cache the casted pointer to ISvcManager
125  if ( !m_svcManager ) {
126  m_svcManager = getManager<IService>();
127  }
128  return m_svcManager;
129  }
SmartIF< ISvcManager > m_svcManager
Cached pointer to the manager of services.
StatusCode ApplicationMgr::sysFinalize ( )
inlineoverride

Definition at line 98 of file ApplicationMgr.h.

98 { return StatusCode::SUCCESS; }
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
StatusCode ApplicationMgr::sysInitialize ( )
inlineoverride

Definition at line 92 of file ApplicationMgr.h.

92 { return StatusCode::SUCCESS; }
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
StatusCode ApplicationMgr::sysReinitialize ( )
inlineoverride

Definition at line 100 of file ApplicationMgr.h.

100 { return StatusCode::SUCCESS; }
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
StatusCode ApplicationMgr::sysRestart ( )
inlineoverride

Definition at line 102 of file ApplicationMgr.h.

102 { return StatusCode::SUCCESS; }
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
StatusCode ApplicationMgr::sysStart ( )
inlineoverride

Definition at line 94 of file ApplicationMgr.h.

94 { return StatusCode::SUCCESS; }
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
StatusCode ApplicationMgr::sysStop ( )
inlineoverride

Definition at line 96 of file ApplicationMgr.h.

96 { return StatusCode::SUCCESS; }
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
Gaudi::StateMachine::State ApplicationMgr::targetFSMState ( ) const
override

Definition at line 857 of file ApplicationMgr.cpp.

857 { return m_targetState; }
Gaudi::StateMachine::State m_targetState
Internal State.
StatusCode ApplicationMgr::terminate ( )
override

Definition at line 623 of file ApplicationMgr.cpp.

624 {
626 
628  log << MSG::INFO << "Already Offline" << endmsg;
629  return StatusCode::SUCCESS;
630  }
632  log << MSG::FATAL << "terminate: Invalid state \"" << m_state << "\"" << endmsg;
633  return StatusCode::FAILURE;
634  }
635  // release all Services
637 
638  if ( m_returnCode.value() == Gaudi::ReturnCode::Success ) {
639  log << MSG::INFO << "Application Manager Terminated successfully" << endmsg;
640  } else if ( m_returnCode.value() == Gaudi::ReturnCode::ScheduledStop ) {
641  log << MSG::INFO << "Application Manager Terminated successfully with a user requested ScheduledStop" << endmsg;
642  } else {
643  log << MSG::ERROR << "Application Manager Terminated with error code " << m_returnCode.value() << endmsg;
644  }
645 
646  { // Force a disable the auditing of finalize for MessageSvc
647  auto prop = m_messageSvc.as<IProperty>();
648  if ( prop ) {
649  prop->setProperty( Gaudi::Property<bool>( "AuditFinalize", false ) ).ignore();
650  }
651  }
652  { // Force a disable the auditing of finalize for JobOptionsSvc
653  auto prop = m_jobOptionsSvc.as<IProperty>();
654  if ( prop ) {
655  prop->setProperty( Gaudi::Property<bool>( "AuditFinalize", false ) ).ignore();
656  }
657  }
658 
659  // finalize MessageSvc
660  auto svc = m_messageSvc.as<IService>();
661  if ( !svc ) {
662  log << MSG::ERROR << "Could not get the IService interface of the MessageSvc" << endmsg;
663  } else {
664  svc->sysFinalize().ignore();
665  }
666 
667  // finalize JobOptionsSvc
668  svc = m_jobOptionsSvc.as<IService>();
669  if ( !svc ) {
670  log << MSG::ERROR << "Could not get the IService interface of the JobOptionsSvc" << endmsg;
671  } else {
672  svc->sysFinalize().ignore();
673  }
674 
676  return StatusCode::SUCCESS;
677 }
Gaudi::StateMachine::State m_targetState
Internal State.
constexpr static const auto FAILURE
Definition: StatusCode.h:88
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
Gaudi::Property< int > m_returnCode
Property to record the error conditions occurring during the running.
Implementation of property with value of concrete type.
Definition: Property.h:383
const std::string & name() const override
SmartIF< IJobOptionsSvc > m_jobOptionsSvc
Reference to JobOption service.
constexpr int ScheduledStop
Definition: AppReturnCode.h:27
virtual StatusCode setProperty(const Gaudi::Details::PropertyBase &p)=0
Set the property by property.
SmartIF< IFace > as() const
return a new SmartIF instance to another interface
Definition: SmartIF.h:115
General service interface definition.
Definition: IService.h:18
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
const StatusCode & ignore() const
Ignore/check StatusCode.
Definition: StatusCode.h:165
Gaudi::StateMachine::State m_state
Internal State.
constexpr int Success
Definition: AppReturnCode.h:18
The IProperty is the basic interface for all components which have properties that can be set or get...
Definition: IProperty.h:20
SmartIF< IMessageSvc > m_messageSvc
Reference to the message service.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209

Member Data Documentation

Gaudi::Property<bool> ApplicationMgr::m_actHistory {this, "ActivateHistory", false, "Activate HistorySvc"}
protected

Definition at line 241 of file ApplicationMgr.h.

SmartIF<IAlgManager> ApplicationMgr::m_algManager
protected

Cached pointer to the manager of algorithms.

Definition at line 173 of file ApplicationMgr.h.

Gaudi::Property<std::string> ApplicationMgr::m_appName {this, "AppName", "ApplicationMgr", "The name of the application"}
protected

Definition at line 239 of file ApplicationMgr.h.

Gaudi::Property<std::string> ApplicationMgr::m_appVersion {this, "AppVersion", {}, "The version of the application"}
protected

Definition at line 240 of file ApplicationMgr.h.

Gaudi::Property<bool> ApplicationMgr::m_auditAlgs {this, "AuditAlgorithms", false}
protected

Definition at line 259 of file ApplicationMgr.h.

Gaudi::Property<bool> ApplicationMgr::m_auditSvcs {this, "AuditServices", false}
protected

Definition at line 258 of file ApplicationMgr.h.

Gaudi::Property<bool> ApplicationMgr::m_auditTools {this, "AuditTools", false}
protected

Defaults for auditors.

Definition at line 257 of file ApplicationMgr.h.

SmartIF<DLLClassManager> ApplicationMgr::m_classManager
protected

Reference to the class manager.

Definition at line 178 of file ApplicationMgr.h.

Gaudi::Property<bool> ApplicationMgr::m_codeCheck {this, "StatusCodeCheck", false, "Activate StatusCode checking"}
protected

Definition at line 242 of file ApplicationMgr.h.

Gaudi::Property<std::vector<std::string> > ApplicationMgr::m_createSvcNameList
protected
Initial value:
{
this, "CreateSvc", {}, "List of extra services to be created"}

Definition at line 253 of file ApplicationMgr.h.

Gaudi::Property<std::vector<std::string> > ApplicationMgr::m_declaredManagers
protected

Property to declare the list of known managers.

Definition at line 167 of file ApplicationMgr.h.

Gaudi::Property<std::vector<std::string> > ApplicationMgr::m_dllNameList {this, "Dlls", {}, "List of DDL's names"}
protected

Definition at line 227 of file ApplicationMgr.h.

Gaudi::Property<std::map<std::string, std::string> > ApplicationMgr::m_environment
protected
Initial value:
{
this, "Environment", {}, "Environment variables to set"}

Definition at line 261 of file ApplicationMgr.h.

Gaudi::Property<std::string> ApplicationMgr::m_eventLoopMgr {this, "EventLoop", "EventLoopMgr", "Processing manager type"}
protected

Definition at line 235 of file ApplicationMgr.h.

Gaudi::Property<int> ApplicationMgr::m_evtMax {this, "EvtMax", -1, "Number of events to be processed (-1 means all events)"}
protected

Definition at line 222 of file ApplicationMgr.h.

Gaudi::Property<std::string> ApplicationMgr::m_evtsel {this, "EvtSel", {}, "Event selection"}
protected

Definition at line 236 of file ApplicationMgr.h.

Gaudi::Property<bool> ApplicationMgr::m_extSvcCreates
protected
Initial value:
{this, "ExtSvcCreates", true,
"LHCb (default) or ATLAS definition of \"ExtSvc\""}

Definition at line 224 of file ApplicationMgr.h.

Gaudi::Property<std::vector<std::string> > ApplicationMgr::m_extSvcNameList {this, "ExtSvc", {}, "List of external services names"}
protected

Definition at line 223 of file ApplicationMgr.h.

Gaudi::Property<std::string> ApplicationMgr::m_histPersName {this, "HistogramPersistency", "NONE", "Name of the Hist Pers Svc"}
protected

Definition at line 237 of file ApplicationMgr.h.

Gaudi::Property<std::string> ApplicationMgr::m_jobOptionsPath {this, "JobOptionsPath", {}, "The \"file\" to look for properties"}
protected

Definition at line 229 of file ApplicationMgr.h.

Gaudi::Property<std::string> ApplicationMgr::m_jobOptionsPostAction
protected
Initial value:
{
this, "JobOptionsPreAction", {}, "additional command to run on config"}

Definition at line 232 of file ApplicationMgr.h.

Gaudi::Property<std::string> ApplicationMgr::m_jobOptionsPreAction
protected
Initial value:
{
this, "JobOptionsPostAction", {}, "additional command to run on config"}

Definition at line 230 of file ApplicationMgr.h.

SmartIF<IJobOptionsSvc> ApplicationMgr::m_jobOptionsSvc
protected

Reference to JobOption service.

Definition at line 216 of file ApplicationMgr.h.

Gaudi::Property<std::string> ApplicationMgr::m_jobOptionsSvcType {this, "JobOptionsSvcType", "JobOptionsSvc", "JobOptionsSvc type"}
protected

Definition at line 203 of file ApplicationMgr.h.

Gaudi::Property<std::string> ApplicationMgr::m_jobOptionsType {this, "JobOptionsType", "FILE", "Source type (e.g. dbase, file...)"}
protected

Definition at line 228 of file ApplicationMgr.h.

Gaudi::Property<bool> ApplicationMgr::m_loopCheck
protected
Initial value:
{this, "InitializationLoopCheck", true,
[this]( auto& ) { this->svcManager()->setLoopCheckEnabled( m_loopCheck ); },
"For ServiceMgr initialization loop checking"}

Definition at line 264 of file ApplicationMgr.h.

ManagersMap ApplicationMgr::m_managers
protected

Map of known component managers.

It contains (at least) the managers for IService and IAlgorithm. IAlgTool and IAuditor are not mandatory (but a missing manager for IAlgTool will probably not allow any job to run).

Definition at line 165 of file ApplicationMgr.h.

SmartIF<IMessageSvc> ApplicationMgr::m_messageSvc
protected

Reference to the message service.

Definition at line 213 of file ApplicationMgr.h.

Gaudi::Property<std::string> ApplicationMgr::m_messageSvcType {this, "MessageSvcType", "MessageSvc", "MessageSvc type"}
protected

Definition at line 202 of file ApplicationMgr.h.

std::string ApplicationMgr::m_name = "ApplicationMgr"
protected

Name.

Definition at line 205 of file ApplicationMgr.h.

std::vector<std::string> ApplicationMgr::m_okDlls
private

names of successfully loaded dlls

Definition at line 289 of file ApplicationMgr.h.

Gaudi::Property<int> ApplicationMgr::m_outputLevel {this, "OutputLevel", MSG::INFO, "Message output level"}
protected

Definition at line 238 of file ApplicationMgr.h.

Gaudi::Property<std::vector<std::string> > ApplicationMgr::m_outStreamNameList
protected
Initial value:
{
this, "OutStream", {}, &ApplicationMgr::evtLoopPropertyHandler, "List of output stream names"}

Definition at line 197 of file ApplicationMgr.h.

Gaudi::Property<std::string> ApplicationMgr::m_outStreamType
protected
Initial value:
{this, "OutStreamType", "OutputStream",
"[[deprecated]] Output stream type"}

Definition at line 199 of file ApplicationMgr.h.

Gaudi::Property<int> ApplicationMgr::m_pluginDebugLevel
protected
Initial value:
{
this, "PluginDebugLevel", 0,
[this]( auto& ) {
log << MSG::INFO << "Updating Gaudi::PluginService::SetDebug(level) to level=" << m_pluginDebugLevel << endmsg;
},
"Debug level for the plugin system"}

Definition at line 243 of file ApplicationMgr.h.

SmartIF<IEventProcessor> ApplicationMgr::m_processingMgr
protected

Reference to processing manager object.

Definition at line 215 of file ApplicationMgr.h.

Gaudi::Property<bool> ApplicationMgr::m_propertiesPrint
protected
Initial value:
{this, "PropertiesPrint", false,
"Flag to activate the printout of properties"}

Definition at line 278 of file ApplicationMgr.h.

Gaudi::Property<int> ApplicationMgr::m_returnCode
protected
Initial value:
{this, "ReturnCode", Gaudi::ReturnCode::Success,
"Return code of the application. Set internally in case of error conditions."}

Property to record the error conditions occurring during the running.

Definition at line 282 of file ApplicationMgr.h.

SmartIF<IRunable> ApplicationMgr::m_runable
protected

Reference to the runable object.

Definition at line 214 of file ApplicationMgr.h.

Gaudi::Property<std::string> ApplicationMgr::m_runableType {this, "Runable", "AppMgrRunable", "Runable type"}
protected

Definition at line 234 of file ApplicationMgr.h.

Gaudi::Property<int> ApplicationMgr::m_SIExit
protected
Initial value:
{this, "Exit", 0,
[this]( auto& ) {
::exit( 0 );
},
"For SI's \"Exit\" command via callback"}

Definition at line 188 of file ApplicationMgr.h.

Gaudi::Property<int> ApplicationMgr::m_SIGo
protected
Initial value:
{this, "Go", 0,
[this]( auto& ) {
this->reinitialize().ignore();
},
"For SI's \"Go\" command via callback"}

Definition at line 180 of file ApplicationMgr.h.

Gaudi::Property<bool> ApplicationMgr::m_stalledEventMonitoring
protected
Initial value:
{
this, "StalledEventMonitoring", false, "Flag to enable/disable the monitoring and reporting of stalled events"}

Property to enable/disable the monitoring and reporting of stalled events.

See also
StalledEventMonitor

Definition at line 275 of file ApplicationMgr.h.

Gaudi::StateMachine::State ApplicationMgr::m_state = Gaudi::StateMachine::OFFLINE
protected

Internal State.

Definition at line 206 of file ApplicationMgr.h.

Gaudi::Property<bool> ApplicationMgr::m_stopOnSignal
protected
Initial value:
{
this, "StopOnSignal", false, "Flag to enable/disable the signal handler that schedule a stop of the event loop"}

Property to enable/disable the "stop on signal" service.

See also
Gaudi::Utils::StopSignalHandler

Definition at line 270 of file ApplicationMgr.h.

SmartIF<ISvcLocator> ApplicationMgr::m_svcLocator
mutableprotected

Reference to its own service locator (must be instantiated prior to any service!)

Definition at line 176 of file ApplicationMgr.h.

SmartIF<ISvcManager> ApplicationMgr::m_svcManager
protected

Cached pointer to the manager of services.

Definition at line 170 of file ApplicationMgr.h.

Gaudi::Property<std::vector<std::string> > ApplicationMgr::m_svcMapping {this, "SvcMapping", {}, "Default mapping of services"}
protected

Definition at line 209 of file ApplicationMgr.h.

Gaudi::Property<std::vector<std::string> > ApplicationMgr::m_svcOptMapping
protected
Initial value:
{
this, "SvcOptMapping", {}, "Default mapping of optional services"}

Definition at line 210 of file ApplicationMgr.h.

Gaudi::StateMachine::State ApplicationMgr::m_targetState = Gaudi::StateMachine::OFFLINE
protected

Internal State.

Definition at line 207 of file ApplicationMgr.h.

Gaudi::Property<std::vector<std::string> > ApplicationMgr::m_topAlgNameList
protected
Initial value:
{
this, "TopAlg", {}, &ApplicationMgr::evtLoopPropertyHandler, "List of top level algorithms names"}

Definition at line 195 of file ApplicationMgr.h.

bool ApplicationMgr::m_useHiveAlgorithmManager
protected

Definition at line 286 of file ApplicationMgr.h.


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