ApplicationMgr Class Reference

The Application Manager class. More...

#include <src/ApplicationMgr/ApplicationMgr.h>

Inheritance diagram for ApplicationMgr:
Collaboration diagram for ApplicationMgr:

Public Types

typedef std::list< std::pair< IService *, int > > ListSvc
 
typedef std::vector< std::string > VectorName
 
- Public Types inherited from CommonMessaging< implements4< IAppMgrUI, IEventProcessor, IService, IStateful > >
using base_class = CommonMessaging
 
using base_class = CommonMessaging
 

Public Member Functions

 ApplicationMgr (IInterface *=nullptr)
 
 ~ApplicationMgr () override=default
 
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::string & name () 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
 
void SIGoHandler (Property &theProp)
 
void SIExitHandler (Property &theProp)
 
template<class I >
SmartIF< IComponentManager > & getManager ()
 
SmartIF< ISvcManager > & svcManager ()
 
SmartIF< IAlgManager > & algManager ()
 
SmartIF< ISvcLocator > & serviceLocator () const override
 Needed to locate the message service. More...
 
Property handlers
void evtLoopPropertyHandler (Property &theProp)
 
StatusCode decodeExtSvcNameList ()
 
StatusCode decodeCreateSvcNameList ()
 
void createSvcNameListHandler (Property &)
 
void extSvcNameListHandler (Property &theProp)
 
StatusCode decodeMultiThreadSvcNameList ()
 
void multiThreadSvcNameListHandler (Property &theProp)
 
StatusCode decodeDllNameList ()
 
void dllNameListHandler (Property &theProp)
 
void pluginDebugPropertyHandler (Property &theProp)
 
void initLoopCheckHndlr (Property &)
 
- Public Member Functions inherited from CommonMessaging< implements4< IAppMgrUI, IEventProcessor, IService, IStateful > >
 ~CommonMessaging () override=default
 Virtual destructor. More...
 
 ~CommonMessaging () override=default
 Virtual destructor. More...
 
SmartIF< IMessageSvc > & msgSvc () const
 The standard message service. More...
 
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...
 
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...
 
MsgStreamalways () const
 shortcut for the method msgStream(MSG::ALWAYS) More...
 
MsgStreamfatal () const
 shortcut for the method msgStream(MSG::FATAL) More...
 
MsgStreamfatal () const
 shortcut for the method msgStream(MSG::FATAL) More...
 
MsgStreamerr () const
 shortcut for the method msgStream(MSG::ERROR) More...
 
MsgStreamerr () const
 shortcut for the method msgStream(MSG::ERROR) More...
 
MsgStreamerror () 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...
 
MsgStreamwarning () const
 shortcut for the method msgStream(MSG::WARNING) More...
 
MsgStreaminfo () const
 shortcut for the method msgStream(MSG::INFO) More...
 
MsgStreaminfo () const
 shortcut for the method msgStream(MSG::INFO) More...
 
MsgStreamdebug () const
 shortcut for the method msgStream(MSG::DEBUG) More...
 
MsgStreamdebug () const
 shortcut for the method msgStream(MSG::DEBUG) More...
 
MsgStreamverbose () const
 shortcut for the method msgStream(MSG::VERBOSE) More...
 
MsgStreamverbose () const
 shortcut for the method msgStream(MSG::VERBOSE) More...
 
MsgStreammsg () const
 shortcut for the method msgStream(MSG::INFO) More...
 
MsgStreammsg () const
 shortcut for the method msgStream(MSG::INFO) More...
 
MSG::Level msgLevel () const
 get the output level from the embedded MsgStream More...
 
bool msgLevel (MSG::Level lvl) const
 get the output level from the embedded MsgStream More...
 
MSG::Level msgLevel () const
 get the output level from the embedded MsgStream More...
 
bool msgLevel (MSG::Level lvl) const
 get the output level from the embedded MsgStream 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

StatusCode declareMultiSvcType (const std::string &name, const std::string &type)
 declare one or more copies of svc type/name as determined by NoOfThreads More...
 
StatusCode addMultiSvc (const Gaudi::Utils::TypeNameString &typeName, int prio)
 add one or more copies of svc type/name as determined by NoOfThreads More...
 
void setServiceManager (ISvcManager *)
 
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 CommonMessaging< implements4< IAppMgrUI, IEventProcessor, IService, IStateful > >
void updateMsgStreamOutputLevel (int level)
 Update the output level of the cached MsgStream. 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...
 
StringArrayProperty 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...
 
SmartIF< PropertyMgrm_propertyMgr
 Reference to Property Manager. More...
 
IntegerProperty m_SIGo
 For SI's "Go" command via callback. More...
 
IntegerProperty m_SIExit
 For SI's "Exit" command via callback. More...
 
StringArrayProperty m_topAlgNameList
 List of top level algorithms names. More...
 
StringArrayProperty m_outStreamNameList
 List of output stream names. More...
 
StringProperty m_outStreamType
 Output stream type (obsolete?) More...
 
StringProperty m_messageSvcType
 MessageSvc type. More...
 
StringProperty m_jobOptionsSvcType
 JobOptionsSvc type. More...
 
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...
 
VectorName m_defServices
 Vector default services names. More...
 
VectorName m_svcMapping
 Default mapping of services. More...
 
VectorName m_svcOptMapping
 Default mapping of services. More...
 
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...
 
int m_evtMax
 Number of events to be processed. More...
 
StringArrayProperty m_extSvcNameList
 List of external services names. More...
 
BooleanProperty m_extSvcCreates
 LHCb or ATLAS defn of "ExtSvc". More...
 
StringArrayProperty m_multiThreadSvcNameList
 List of external services names for which we want a copy per evt thread. More...
 
int m_noOfEvtThreads
 no of multiThreadSvc copies More...
 
StringArrayProperty m_dllNameList
 List of DDL's names. More...
 
std::string m_jobOptionsType
 Source type (e.g. dbase, file...) More...
 
std::string m_jobOptionsPath
 The "file" to look for properties. More...
 
std::string m_runableType
 Runable type. More...
 
std::string m_eventLoopMgr
 Processing manager type. More...
 
std::string m_evtsel
 Event selection. More...
 
std::string m_histPersName
 CGL: Name of the Hist Pers Svc. More...
 
int m_outputLevel
 Message output level. More...
 
std::string m_appName
 The name of the application. More...
 
std::string m_appVersion
 The version of the application. More...
 
bool m_actHistory
 Activate HistorySvc. More...
 
bool m_codeCheck
 Activate StatusCode checking. More...
 
IntegerProperty m_pluginDebugLevel
 Debug level for the plugin system. More...
 
StringArrayProperty m_createSvcNameList
 
BooleanProperty m_auditTools
 Defaults for auditors. More...
 
BooleanProperty m_auditSvcs
 
BooleanProperty m_auditAlgs
 
std::map< std::string, std::string > m_environment
 Environment variables to set. More...
 
BooleanProperty m_loopCheck
 For ServiceMgr initialization loop checking. More...
 
BooleanProperty m_stopOnSignal
 Property to enable/disable the "stop on signal" service (enabled by default). More...
 
BooleanProperty m_stalledEventMonitoring
 Property to enable/disable the monitoring and reporting of stalled events (enabled by default). More...
 
bool m_propertiesPrint
 flag to activate the printout of properties More...
 
IntegerProperty m_returnCode
 Property to record the error conditions occurring during the running. More...
 
- Protected Attributes inherited from CommonMessaging< implements4< IAppMgrUI, IEventProcessor, IService, IStateful > >
SmartIF< IMessageSvcm_msgsvc
 Pointer to the message service;. More...
 
std::unique_ptr< MsgStreamm_msgStream
 The predefined message stream. More...
 
bool m_streamWithService
 Flag to create a new MsgStream if it was created without the message service. More...
 

Private Types

typedef CommonMessaging< implements4< IAppMgrUI, IEventProcessor, IService, IStateful > > base_class
 

Private Attributes

std::vector< std::string > m_okDlls
 names of successfully loaded dlls More...
 

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 46 of file ApplicationMgr.h.

Member Typedef Documentation

typedef std::list<std::pair<IService*,int> > ApplicationMgr::ListSvc

Definition at line 55 of file ApplicationMgr.h.

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 182 of file ApplicationMgr.h.

typedef std::vector<std::string> ApplicationMgr::VectorName

Definition at line 56 of file ApplicationMgr.h.

Constructor & Destructor Documentation

ApplicationMgr::ApplicationMgr ( IInterface = nullptr)

Definition at line 54 of file ApplicationMgr.cpp.

54  :
55  base_class()
56 {
57  // IInterface initialization
58  addRef(); // Initial count set to 1
59 
60  // Instantiate component managers
61  m_managers[IService::interfaceID().id()] = new ServiceManager(this);
62  AlgorithmManager *algMgr = new AlgorithmManager(this);
63  m_managers[IAlgorithm::interfaceID().id()] = algMgr;
64 
66 
67  // Instantiate internal services
68  // SvcLocator/Factory HAS to be already instantiated
69  m_classManager = new DLLClassManager(this);
70  m_propertyMgr = new PropertyMgr(this);
71 
73  m_propertyMgr->declareProperty("Exit", m_SIExit = 0 );
77  m_propertyMgr->declareProperty("ExtSvcCreates", m_extSvcCreates=true );
78 
80  m_propertyMgr->declareProperty("SvcOptMapping", m_svcOptMapping );
81 
84  m_propertyMgr->declareProperty("OutStreamType", m_outStreamType = "OutputStream" );
85  m_propertyMgr->declareProperty("MessageSvcType",m_messageSvcType= "MessageSvc" );
86  m_propertyMgr->declareProperty("JobOptionsSvcType",
87  m_jobOptionsSvcType = "JobOptionsSvc" );
88  m_propertyMgr->declareProperty( s_runable, m_runableType = "AppMgrRunable");
89  m_propertyMgr->declareProperty( s_eventloop, m_eventLoopMgr = "EventLoopMgr");
90 
91  m_propertyMgr->declareProperty("HistogramPersistency", m_histPersName="NONE");
92 
93  // Declare Job Options Service properties and set default
94  m_propertyMgr->declareProperty("JobOptionsType", m_jobOptionsType = "FILE");
95  m_propertyMgr->declareProperty("JobOptionsPath", m_jobOptionsPath = "");
96  m_propertyMgr->declareProperty("EvtMax", m_evtMax = -1);
99 
101  m_propertyMgr->declareProperty("NoOfThreads", m_noOfEvtThreads = 0);
102  m_propertyMgr->declareProperty("AppName", m_appName = "ApplicationMgr");
103  m_propertyMgr->declareProperty("AppVersion", m_appVersion = "");
104 
105  m_propertyMgr->declareProperty("AuditTools", m_auditTools = false);
106  m_propertyMgr->declareProperty("AuditServices", m_auditSvcs = false);
107  m_propertyMgr->declareProperty("AuditAlgorithms", m_auditAlgs = false);
108 
109  m_propertyMgr->declareProperty("ActivateHistory", m_actHistory = false);
110  m_propertyMgr->declareProperty("StatusCodeCheck", m_codeCheck = false);
111 
113 
114  // ServiceMgr Initialization loop checking
115  m_propertyMgr->declareProperty("InitializationLoopCheck", m_loopCheck = true)
118 
119  // Flag to activate the printout of properties
121  ( "PropertiesPrint",
122  m_propertiesPrint = false,
123  "Flag to activate the printout of properties" );
124 
125  m_propertyMgr->declareProperty("PluginDebugLevel", m_pluginDebugLevel = 0 );
126 
127  m_propertyMgr->declareProperty("StopOnSignal", m_stopOnSignal = false,
128  "Flag to enable/disable the signal handler that schedule a stop of the event loop");
129 
130  m_propertyMgr->declareProperty("StalledEventMonitoring", m_stalledEventMonitoring = false,
131  "Flag to enable/disable the monitoring and reporting of stalled events");
132 
134  "Return code of the application. Set internally in case of error conditions.");
135 
136  m_propertyMgr->declareProperty("AlgTypeAliases", algMgr->typeAliases(),
137  "Aliases of algorithm types, to replace an algorithm type for every instance");
138 
139  // Add action handlers to the appropriate properties
146 
148  { "EvtDataSvc/EventDataSvc",
149  "DetDataSvc/DetectorDataSvc",
150  "HistogramSvc/HistogramDataSvc",
151  "HbookCnv::PersSvc/HbookHistSvc",
152  "RootHistCnv::PersSvc/RootHistSvc",
153  "EvtPersistencySvc/EventPersistencySvc",
154  "DetPersistencySvc/DetectorPersistencySvc",
155  "HistogramPersistencySvc/HistogramPersistencySvc" } );
156 }
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.
std::string m_jobOptionsType
Source type (e.g. dbase, file...)
StringArrayProperty m_createSvcNameList
StringArrayProperty m_outStreamNameList
List of output stream names.
StringProperty m_messageSvcType
MessageSvc type.
int m_noOfEvtThreads
no of multiThreadSvc copies
ManagersMap m_managers
Map of known component managers.
std::string m_histPersName
CGL: Name of the Hist Pers Svc.
bool m_codeCheck
Activate StatusCode checking.
StringProperty m_outStreamType
Output stream type (obsolete?)
std::string m_appName
The name of the application.
IntegerProperty m_pluginDebugLevel
Debug level for the plugin system.
std::map< std::string, std::string > m_environment
Environment variables to set.
StringArrayProperty m_dllNameList
List of DDL's names.
AlgTypeAliasesMap & typeAliases()
Property manager helper class.
Definition: PropertyMgr.h:34
CommonMessaging< implements4< IAppMgrUI, IEventProcessor, IService, IStateful > > base_class
SmartIF< ISvcManager > & svcManager()
int m_outputLevel
Message output level.
int m_evtMax
Number of events to be processed.
IntegerProperty m_returnCode
Property to record the error conditions occurring during the running.
std::string m_jobOptionsPath
The "file" to look for properties.
Property * declareProperty(const std::string &name, TYPE &value, const std::string &doc="none")
Declare a property (templated)
Definition: PropertyMgr.h:177
BooleanProperty m_extSvcCreates
LHCb or ATLAS defn of "ExtSvc".
auto end(reverse_wrapper< T > &w)
Definition: reverse.h:47
VectorName m_svcMapping
Default mapping of services.
SmartIF< ISvcLocator > m_svcLocator
Reference to its own service locator (must be instantiated prior to any service!) ...
bool m_actHistory
Activate HistorySvc.
BooleanProperty m_loopCheck
For ServiceMgr initialization loop checking.
StringArrayProperty m_topAlgNameList
List of top level algorithms names.
std::string m_evtsel
Event selection.
StringArrayProperty m_multiThreadSvcNameList
List of external services names for which we want a copy per evt thread.
VectorName m_svcOptMapping
Default mapping of services.
std::string m_runableType
Runable type.
SmartIF< PropertyMgr > m_propertyMgr
Reference to Property Manager.
void initLoopCheckHndlr(Property &)
bool m_propertiesPrint
flag to activate the printout of properties
void SIGoHandler(Property &theProp)
SmartIF< DLLClassManager > m_classManager
Reference to the class manager.
StringArrayProperty m_extSvcNameList
List of external services names.
StringProperty m_jobOptionsSvcType
JobOptionsSvc type.
void evtLoopPropertyHandler(Property &theProp)
BooleanProperty m_stalledEventMonitoring
Property to enable/disable the monitoring and reporting of stalled events (enabled by default)...
std::string m_eventLoopMgr
Processing manager type.
void SIExitHandler(Property &theProp)
virtual void declareUpdateHandler(std::function< void(Property &)> fun)
set new callback for update
Definition: Property.cpp:71
IntegerProperty m_SIGo
For SI's "Go" command via callback.
BooleanProperty m_auditTools
Defaults for auditors.
BooleanProperty m_auditAlgs
virtual void setLoopCheckEnabled(bool en=true)=0
Set the value of the initialization loop check flag.
constexpr int Success
Definition: AppReturnCode.h:16
void pluginDebugPropertyHandler(Property &theProp)
BooleanProperty m_stopOnSignal
Property to enable/disable the "stop on signal" service (enabled by default).
std::string m_appVersion
The version of the application.
BooleanProperty m_auditSvcs
IntegerProperty m_SIExit
For SI's "Exit" command via callback.
ApplicationMgr::~ApplicationMgr ( )
overridedefault

Member Function Documentation

StatusCode ApplicationMgr::addMultiSvc ( const Gaudi::Utils::TypeNameString typeName,
int  prio 
)
protected

add one or more copies of svc type/name as determined by NoOfThreads

Definition at line 1148 of file ApplicationMgr.cpp.

1149  {
1153  if (0 == m_noOfEvtThreads) {
1154  result = svcManager()->addService(typeName, prio);
1155  // result = svcManager()->addService(name, type, prio); // CHECKME???
1156  if( result.isFailure() ) {
1157  log << MSG::ERROR << "addMultiSvc: Cannot add service "
1158  << typeName.type() << "/" << typeName.name() << endmsg;
1159  } else {
1160  ON_VERBOSE
1161  log << MSG::VERBOSE << "addMultiSvc: added service "
1162  << typeName.type() << "/" << typeName.name() << endmsg;
1163  }
1164  } else {
1165  for(int iCopy=0; iCopy<m_noOfEvtThreads; ++iCopy) {
1166  const std::string &type = typeName.type();
1167  std::string thrName(typeName.name() + getGaudiThreadIDfromID(iCopy));
1168  result = svcManager()->addService(TypeNameString(thrName, type), prio);
1169  if( result.isFailure() ) {
1170  log << MSG::ERROR << "addMultiSvc: Cannot add service "
1171  << type << "/" << thrName << endmsg;
1172  } else {
1173  ON_VERBOSE
1174  log << MSG::VERBOSE << "addMultiSvc: added service "
1175  << type << "/" << thrName << endmsg;
1176  }
1177  }
1178  }
1179  return result;
1180 }
virtual StatusCode addService(IService *svc, int prio=DEFAULT_SVC_PRIORITY)=0
Add a service to the "active" list of services of the factory.
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
int m_noOfEvtThreads
no of multiThreadSvc copies
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:86
SmartIF< ISvcManager > & svcManager()
Helper class to parse a string of format "type/name".
Definition: TypeNameString.h:9
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
GAUDI_API std::string getGaudiThreadIDfromID(int iCopy)
helper function to extract Gaudi Thread ID from thread copy number
Definition: ThreadGaudi.cpp:16
const std::string & type() const
std::string m_name
Name.
#define ON_VERBOSE
const std::string & name() const
SmartIF< IMessageSvc > m_messageSvc
Reference to the message service.
string type
Definition: gaudirun.py:151
SmartIF<IAlgManager>& ApplicationMgr::algManager ( )
inline

Definition at line 147 of file ApplicationMgr.h.

147  {
148  // Cache the casted pointer to IAlgManager
149  if (!m_algManager) {
150  m_algManager = getManager<IAlgorithm>();
151  }
152  return m_algManager;
153  }
SmartIF< IAlgManager > m_algManager
Cached pointer to the manager of algorithms.
StatusCode ApplicationMgr::configure ( )
override

Definition at line 292 of file ApplicationMgr.cpp.

292  {
293  // Check if the state is compatible with the transition
294  MsgStream tlog( m_messageSvc, name() );
296  tlog << MSG::INFO << "Already Configured" << endmsg;
297  return StatusCode::SUCCESS;
298  }
299  else if( Gaudi::StateMachine::OFFLINE != m_state ) {
300  tlog << MSG::FATAL
301  << "configure: Invalid state \"" << m_state << "\"" << endmsg;
302  return StatusCode::FAILURE;
303  }
305 
306  // Reset application return code.
308 
309  StatusCode sc;
310  sc = i_startup();
311  if ( !sc.isSuccess() ) {
312  return sc;
313  }
314 
316 
317  // Get my own options using the Job options service
318  if (log.level() <= MSG::DEBUG)
319  log << MSG::DEBUG << "Getting my own properties" << endmsg;
321  if( !sc.isSuccess() ) {
322  log << MSG::WARNING << "Problems getting my properties from JobOptionsSvc"
323  << endmsg;
324  return sc;
325  }
326 
327  // Check current outputLevel to eventually inform the MessageSvc
328  if( m_outputLevel != MSG::NIL && !m_appName.empty() ) {
329  assert(m_messageSvc);
331  // Print a welcome message
332  log << MSG::ALWAYS
333  << std::endl
334  << "=================================================================="
335  << "=================================================================="
336  << std::endl
337  << " "
338  << " Welcome to " << m_appName;
339 
340  if( "" != m_appVersion ) {
341  log << MSG::ALWAYS << " version " << m_appVersion;
342  }
343  else {
344  log << MSG::ALWAYS
345  << " (GaudiCoreSvc "
346  << "v" << GAUDICORESVC_MAJOR_VERSION
347  << "r" << GAUDICORESVC_MINOR_VERSION
348 #if GAUDICORESVC_PATCH_VERSION
349  << "p" << GAUDICORESVC_PATCH_VERSION
350 #endif
351  << ")";
352  }
353 
354  // Add the host name and current time to the message
355  log << MSG::ALWAYS
356  << std::endl
357  << " "
358  << " running on " << System::hostName()
359  << " on " << Gaudi::Time::current().format(true) << std::endl
360  << "=================================================================="
361  << "=================================================================="
362  << endmsg;
363  }
364 
365  // print all own properties if the options "PropertiesPrint" is set to true
366  if ( m_propertiesPrint )
367  {
368  const auto& properties = m_propertyMgr->getProperties() ;
369  log << MSG::ALWAYS
370  << "List of ALL properties of "
371  << System::typeinfoName ( typeid( *this ) ) << "/" << this->name()
372  << " #properties = " << properties.size() << endmsg ;
373  for ( const auto& property : properties )
374  { log << "Property ['Name': Value] = " << *property << endmsg ; }
375  }
376 
377  // Check if StatusCode need to be checked
378  if (m_codeCheck) {
380  sc = addMultiSvc("StatusCodeSvc", -9999);
381  if ( sc.isFailure() ) {
382  log << MSG::FATAL << "Error adding StatusCodeSvc for multiple threads" << endmsg;
383  return StatusCode::FAILURE;
384  }
385  } else {
387  }
388 
389  // set the requested environment variables
390  for ( auto& var : m_environment ) {
391  const std::string &name = var.first;
392  const std::string &value = var.second;
393  std::string old = System::getEnv(name.c_str());
394  const MSG::Level lvl = (!old.empty() && (old != "UNKNOWN" ))
395  ? MSG::WARNING
396  : MSG::DEBUG;
397  if (UNLIKELY(m_outputLevel <= lvl))
398  log << lvl << "Setting " << name << " = " << value << endmsg;
399  System::setEnv(name,value);
400  }
401 
402  //Declare Service Types
403  for(auto& j : m_svcMapping) {
405  if ( declareMultiSvcType(itm.name(), itm.type()).isFailure() ) {
406  log << MSG::ERROR << "configure: declaring svc type:'" << j << "' failed." << endmsg;
407  return StatusCode::FAILURE;
408  }
409  }
410  for(auto& j : m_svcOptMapping) {
412  if ( declareMultiSvcType(itm.name(), itm.type()).isFailure() ) {
413  log << MSG::ERROR << "configure: declaring svc type:'" << j << "' failed." << endmsg;
414  return StatusCode::FAILURE;
415  }
416  }
417 
418  //--------------------------------------------------------------------------
419  // Declare other Services and Algorithms by loading DLL's
420  sc = decodeDllNameList( );
421  if ( sc.isFailure( ) ) {
422  log << MSG::ERROR << "Failure loading declared DLL's" << endmsg;
423  return sc;
424  }
425 
426  //--------------------------------------------------------------------------
427  // Deal with the services explicitly declared by the user.
428  sc = decodeExtSvcNameList();
429  if ( sc.isFailure( ) ) {
430  log << MSG::ERROR << "Failure during external service association" << endmsg;
431  return sc;
432  }
433 
435  if ( sc.isFailure( ) ) {
436  log << MSG::ERROR << "Failure during multi thread service creation"
437  << endmsg;
438  return sc;
439  }
440 
442  if ( sc.isFailure( ) ) {
443  log << MSG::ERROR << "Failure during external service creation" << endmsg;
444  return sc;
445  }
446 
447 
448  //--------------------------------------------------------------------------
449  // Retrieve intrinsic services. If needed configure them.
450  //--------------------------------------------------------------------------
452  sc = addMultiSvc(evtloop_item, ServiceManager::DEFAULT_SVC_PRIORITY*10);
453  if( !sc.isSuccess() ) {
454  log << MSG::FATAL << "Error adding :" << m_eventLoopMgr << endmsg;
455  return sc;
456  }
457 
458  if (m_noOfEvtThreads == 0) {
460  if( !m_runable ) {
461  log << MSG::FATAL
462  << "Error retrieving Runable:" << m_runableType
463  << "\n Check option ApplicationMgr." << s_runable << endmsg;
464  return sc;
465  }
466  m_processingMgr = m_svcLocator->service(evtloop_item);
467  if( !m_processingMgr ) {
468  log << MSG::FATAL
469  << "Error retrieving Processing manager:" << m_eventLoopMgr
470  << "\n Check option ApplicationMgr." << s_eventloop
471  << "\n No events will be processed." << endmsg;
472  return sc;
473  }
474  }
475 
476  // Establish Update Handlers for ExtSvc and DLLs Properties
478  this);
480  this);
484  this );
485 
486  if (m_actHistory) {
487  // Create HistorySvc with a priority to ensure it's initialized last, finalized first
488  sc = svcManager()->addService("HistorySvc",std::numeric_limits<int>::max());
489  if ( sc.isFailure() ) {
490  log << MSG::FATAL << "Error adding HistorySvc" << endmsg;
491  return StatusCode::FAILURE;
492  }
493 
494  if (m_noOfEvtThreads > 0) {
495  sc = addMultiSvc("HistorySvc",std::numeric_limits<int>::max());
496  if ( sc.isFailure() ) {
497  log << MSG::FATAL << "Error adding HistorySvc for multiple threads"
498  << endmsg;
499  return StatusCode::FAILURE;
500  }
501  }
502  }
503 
504  log << MSG::INFO << "Application Manager Configured successfully" << endmsg;
506  return StatusCode::SUCCESS;
507 }
void dllNameListHandler(Property &theProp)
Gaudi::StateMachine::State m_targetState
Internal State.
StringArrayProperty m_createSvcNameList
void createSvcNameListHandler(Property &)
virtual StatusCode addService(IService *svc, int prio=DEFAULT_SVC_PRIORITY)=0
Add a service to the "active" list of services of the factory.
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
StatusCode decodeDllNameList()
SmartIF< IRunable > m_runable
Reference to the runable object.
tuple itm
Definition: ana.py:57
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
int m_noOfEvtThreads
no of multiThreadSvc copies
bool m_codeCheck
Activate StatusCode checking.
static Time current(void)
Returns the current time.
Definition: Time.cpp:113
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:299
std::string m_appName
The name of the application.
static GAUDI_API void enableChecking()
Definition: StatusCode.cpp:19
std::map< std::string, std::string > m_environment
Environment variables to set.
StringArrayProperty m_dllNameList
List of DDL's names.
SmartIF< IJobOptionsSvc > m_jobOptionsSvc
Reference to JobOption service.
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:86
SmartIF< IEventProcessor > m_processingMgr
Reference to processing manager object.
SmartIF< ISvcManager > & svcManager()
GAUDI_API int setEnv(const std::string &name, const std::string &value, int overwrite=1)
Set an environment variables.
Definition: System.cpp:747
int m_outputLevel
Message output level.
StatusCode addMultiSvc(const Gaudi::Utils::TypeNameString &typeName, int prio)
add one or more copies of svc type/name as determined by NoOfThreads
IntegerProperty m_returnCode
Property to record the error conditions occurring during the running.
void multiThreadSvcNameListHandler(Property &theProp)
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:78
Helper class to parse a string of format "type/name".
Definition: TypeNameString.h:9
VectorName m_svcMapping
Default mapping of services.
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:26
virtual StatusCode setMyProperties(const std::string &client, IProperty *me)=0
Override default properties of the calling client.
bool m_actHistory
Activate HistorySvc.
const std::vector< Property * > & getProperties() const override
get all properties
GAUDI_API std::string getEnv(const char *var)
get a particular environment variable (returning "UNKNOWN" if not set)
Definition: System.cpp:619
StringArrayProperty m_multiThreadSvcNameList
List of external services names for which we want a copy per evt thread.
VectorName m_svcOptMapping
Default mapping of services.
std::string m_runableType
Runable type.
StatusCode decodeExtSvcNameList()
SmartIF< PropertyMgr > m_propertyMgr
Reference to Property Manager.
bool m_propertiesPrint
flag to activate the printout of properties
StringArrayProperty m_extSvcNameList
List of external services names.
StatusCode decodeCreateSvcNameList()
GAUDI_API const std::string & hostName()
Host name.
Definition: System.cpp:440
std::string m_eventLoopMgr
Processing manager type.
StatusCode i_startup()
Internal startup routine.
virtual void declareUpdateHandler(std::function< void(Property &)> fun)
set new callback for update
Definition: Property.cpp:71
static GAUDI_API void disableChecking()
Definition: StatusCode.cpp:23
#define UNLIKELY(x)
Definition: Kernel.h:126
Gaudi::StateMachine::State m_state
Internal State.
constexpr int Success
Definition: AppReturnCode.h:16
StatusCode decodeMultiThreadSvcNameList()
void extSvcNameListHandler(Property &theProp)
const std::string & name() const override
std::string m_appVersion
The version of the application.
SmartIF< IMessageSvc > m_messageSvc
Reference to the message service.
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:279
StatusCode declareMultiSvcType(const std::string &name, const std::string &type)
declare one or more copies of svc type/name as determined by NoOfThreads
void ApplicationMgr::createSvcNameListHandler ( Property )

Definition at line 999 of file ApplicationMgr.cpp.

999  {
1000  if ( !(decodeCreateSvcNameList()).isSuccess() ) {
1001  throw GaudiException("Failed to create ext services",
1002  "MinimalEventLoopMgr::createSvcNameListHandler",
1004  }
1005 }
Define general base for Gaudi exception.
StatusCode decodeCreateSvcNameList()
StatusCode ApplicationMgr::declareMultiSvcType ( const std::string &  name,
const std::string &  type 
)
protected

declare one or more copies of svc type/name as determined by NoOfThreads

Definition at line 1115 of file ApplicationMgr.cpp.

1116  {
1119  if (0 == m_noOfEvtThreads) {
1120  result = svcManager()->declareSvcType(name, type);
1121  if( result.isFailure() ) {
1122  log << MSG::ERROR << "declareMultiSvcType: Cannot declare service "
1123  << type << "/" << name << endmsg;
1124  } else {
1125  ON_VERBOSE
1126  log << MSG::VERBOSE << "declareMultiSvcType: declared service "
1127  << type << "/" << name << endmsg;
1128  }
1129  } else {
1130  for(int iCopy=0; iCopy<m_noOfEvtThreads; ++iCopy) {
1131  std::string thrName(name + getGaudiThreadIDfromID(iCopy));
1132  result = svcManager()->declareSvcType(thrName, type);
1133  if( result.isFailure() ) {
1134  log << MSG::ERROR << "declareMultiSvcType: Cannot declare service "
1135  << type << "/" << thrName << endmsg;
1136  } else {
1137  ON_VERBOSE
1138  log << MSG::VERBOSE << "declareMultiSvcType: declared service "
1139  << type << "/" << thrName << endmsg;
1140  }
1141  }
1142  }
1143  return result;
1144 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
int m_noOfEvtThreads
no of multiThreadSvc copies
virtual StatusCode declareSvcType(const std::string &svcname, const std::string &svctype)=0
Declare the type of the service to be used when crating a given service name.
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:86
SmartIF< ISvcManager > & svcManager()
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
GAUDI_API std::string getGaudiThreadIDfromID(int iCopy)
helper function to extract Gaudi Thread ID from thread copy number
Definition: ThreadGaudi.cpp:16
std::string m_name
Name.
#define ON_VERBOSE
const std::string & name() const override
SmartIF< IMessageSvc > m_messageSvc
Reference to the message service.
string type
Definition: gaudirun.py:151
StatusCode ApplicationMgr::decodeCreateSvcNameList ( )

Definition at line 1009 of file ApplicationMgr.cpp.

1009  {
1011  const auto& theNames = m_createSvcNameList.value( );
1012  auto it = theNames.begin();
1013  auto et = theNames.end();
1014  while(result.isSuccess() && it != et) {
1016  if( (result = svcManager()->addService(item, ServiceManager::DEFAULT_SVC_PRIORITY) ).isFailure()) {
1018  log << MSG::ERROR << "decodeCreateSvcNameList: Cannot create service "
1019  << item.type() << "/" << item.name() << endmsg;
1020  } else {
1021  ON_DEBUG {
1023  log << MSG::DEBUG << "decodeCreateSvcNameList: Created service "
1024  << item.type() << "/" << item.name() << endmsg;
1025  }
1026  }
1027  }
1028  return result;
1029 }
StringArrayProperty m_createSvcNameList
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
SmartIF< ISvcManager > & svcManager()
Helper class to parse a string of format "type/name".
Definition: TypeNameString.h:9
#define ON_DEBUG
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
const TYPE & value() const
explicit conversion
Definition: Property.h:341
tuple item
print s1,s2
Definition: ana.py:146
std::string m_name
Name.
SmartIF< IMessageSvc > m_messageSvc
Reference to the message service.
StatusCode ApplicationMgr::decodeDllNameList ( )

Definition at line 1196 of file ApplicationMgr.cpp.

1196  {
1197 
1200 
1201  // Clean up multiple entries from DLL list
1202  // -------------------------------------------------------------------------
1203  std::vector<std::string> newList;
1204  std::map<std::string,unsigned int> dllInList, duplicateList;
1205  {for ( const auto it : m_dllNameList.value()) {
1206  if ( 0 == dllInList[it] ) {
1207  newList.push_back(it); // first instance of this module
1208  } else { ++duplicateList[it]; } // module listed multiple times
1209  ++dllInList[it]; // increment count for this module
1210  }}
1211  //m_dllNameList = newList; // update primary list to new, filtered list (do not use the
1212  // property itself otherwise we get called again infinitely)
1213  // List modules that were in there twice..
1214  ON_DEBUG if ( !duplicateList.empty() ) {
1215  log << MSG::DEBUG << "Removed duplicate entries for modules : ";
1216  for ( auto it = duplicateList.begin(); it != duplicateList.end(); ++it ) {
1217  log << it->first << "(" << 1+it->second << ")";
1218  if ( it != --duplicateList.end() ) log << ", ";
1219  }
1220  log << endmsg;
1221  }
1222  // -------------------------------------------------------------------------
1223 
1224  const std::vector<std::string>& theNames = newList;
1225 
1226  // only load the new dlls or previously failed dlls
1227  ON_DEBUG log << MSG::DEBUG << "Loading declared DLL's" << endmsg;
1228 
1229  std::vector<std::string> successNames, failNames;
1230  for (const auto& it : theNames) {
1231  if (std::find (m_okDlls.rbegin(), m_okDlls.rend(), it) == m_okDlls.rend()){
1232  // found a new module name
1233  StatusCode status = m_classManager->loadModule( it );
1234  if( status.isFailure() ) {
1235  failNames.push_back(it);
1236  result = StatusCode::FAILURE;
1237  }
1238  else {
1239  successNames.push_back(it);
1240  }
1241  }
1242  }
1243 
1244  // report back to the user and store the names of the succesfully loaded dlls
1245  if ( !successNames.empty() ) {
1246  log << MSG::INFO << "Successfully loaded modules : ";
1247  for (auto it = successNames.begin(); it != successNames.end(); it++) {
1248  log<< (*it);
1249  if( (it+1) != successNames.end()) log << ", ";
1250  // save name
1251  m_okDlls.push_back( *it );
1252  }
1253  log << endmsg;
1254  }
1255 
1256  if ( result == StatusCode::FAILURE ) {
1257  log << MSG::WARNING << "Failed to load modules: ";
1258  for (auto it = failNames.begin(); it != failNames.end(); it++) {
1259  log<< (*it);
1260  if( (it+1) != failNames.end()) log << ", ";
1261  }
1262  log << endmsg;
1263  }
1264  return result;
1265 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
StatusCode loadModule(const std::string &module, bool fireIncident=true) override
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
std::vector< std::string > m_okDlls
names of successfully loaded dlls
StringArrayProperty m_dllNameList
List of DDL's names.
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:86
#define ON_DEBUG
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
const TYPE & value() const
explicit conversion
Definition: Property.h:341
SmartIF< DLLClassManager > m_classManager
Reference to the class manager.
std::string m_name
Name.
SmartIF< IMessageSvc > m_messageSvc
Reference to the message service.
StatusCode ApplicationMgr::decodeExtSvcNameList ( )

Definition at line 1045 of file ApplicationMgr.cpp.

1045  {
1047 
1048  const auto& theNames = m_extSvcNameList.value( );
1049 
1050  auto it = theNames.begin();
1051  auto et = theNames.end();
1052  while(result.isSuccess() && it != et) {
1054  if (m_extSvcCreates) {
1055  if ( (result = svcManager()->addService(item, ServiceManager::DEFAULT_SVC_PRIORITY)).isFailure()) {
1057  log << MSG::ERROR << "decodeExtSvcNameList: Cannot create service "
1058  << item.type() << "/" << item.name() << endmsg;
1059  }
1060  } else {
1061  if( ( result = svcManager()->declareSvcType(item.name(),
1062  item.type()) ).isFailure()) {
1064  log << MSG::ERROR << "decodeExtSvcNameList: Cannot declare service "
1065  << item.type() << "/" << item.name() << endmsg;
1066  }
1067  }
1068  }
1069  return result;
1070 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
SmartIF< ISvcManager > & svcManager()
Helper class to parse a string of format "type/name".
Definition: TypeNameString.h:9
BooleanProperty m_extSvcCreates
LHCb or ATLAS defn of "ExtSvc".
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
const TYPE & value() const
explicit conversion
Definition: Property.h:341
StringArrayProperty m_extSvcNameList
List of external services names.
tuple item
print s1,s2
Definition: ana.py:146
std::string m_name
Name.
SmartIF< IMessageSvc > m_messageSvc
Reference to the message service.
StatusCode ApplicationMgr::decodeMultiThreadSvcNameList ( )

Definition at line 1087 of file ApplicationMgr.cpp.

1087  {
1089  const auto& theNames = m_multiThreadSvcNameList.value( );
1090  for(int iCopy=0; iCopy<m_noOfEvtThreads; ++iCopy) {
1091  for (const auto& it : theNames ) {
1093  result = addMultiSvc(item, ServiceManager::DEFAULT_SVC_PRIORITY);
1094  //FIXME SHOULD CLONE?
1095  if( result.isFailure() ) {
1097  log << MSG::ERROR
1098  << "decodeMultiThreadSvcNameList: Cannot create service "
1099  << item.type() << "/" << item.name() << endmsg;
1100  } else {
1101  ON_VERBOSE {
1103  log << MSG::VERBOSE
1104  << "decodeMultiThreadSvcNameList: created service "
1105  << item.type() << "/" << item.name() << endmsg;
1106  }
1107  }
1108  }
1109  }
1110  return result;
1111 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
int m_noOfEvtThreads
no of multiThreadSvc copies
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:86
StatusCode addMultiSvc(const Gaudi::Utils::TypeNameString &typeName, int prio)
add one or more copies of svc type/name as determined by NoOfThreads
Helper class to parse a string of format "type/name".
Definition: TypeNameString.h:9
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
const TYPE & value() const
explicit conversion
Definition: Property.h:341
StringArrayProperty m_multiThreadSvcNameList
List of external services names for which we want a copy per evt thread.
tuple item
print s1,s2
Definition: ana.py:146
std::string m_name
Name.
#define ON_VERBOSE
SmartIF< IMessageSvc > m_messageSvc
Reference to the message service.
void ApplicationMgr::dllNameListHandler ( Property theProp)

Definition at line 1185 of file ApplicationMgr.cpp.

1185  {
1186  if ( !(decodeDllNameList( )).isSuccess() ) {
1187  throw GaudiException("Failed to load DLLs.",
1188  "MinimalEventLoopMgr::dllNameListHandler",
1190  }
1191 }
Define general base for Gaudi exception.
StatusCode decodeDllNameList()
void ApplicationMgr::evtLoopPropertyHandler ( Property theProp)

Definition at line 989 of file ApplicationMgr.cpp.

989  {
990  if ( m_processingMgr ) {
991  auto props = m_processingMgr.as<IProperty>();
992  if ( props ) props->setProperty( p ).ignore();
993  }
994 }
SmartIF< IEventProcessor > m_processingMgr
Reference to processing manager object.
SmartIF< IFace > as() const
return a new SmartIF instance to another interface
Definition: SmartIF.h:110
virtual StatusCode setProperty(const Property &p)=0
Set the property by property.
void ignore() const
Definition: StatusCode.h:108
The IProperty is the basic interface for all components which have properties that can be set or get...
Definition: IProperty.h:21
StatusCode ApplicationMgr::executeEvent ( void *  par)
override

implementation of IEventProcessor::executeEvent(void*)

Definition at line 863 of file ApplicationMgr.cpp.

863  {
866  if ( m_processingMgr ) {
868  }
869  }
870  log << MSG::FATAL << "executeEvent: Invalid state \"" << FSMState() << "\""
871  <<endmsg;
872  return StatusCode::FAILURE;
873 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
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
const std::string & name() const override
SmartIF< IMessageSvc > m_messageSvc
Reference to the message service.
StatusCode ApplicationMgr::executeRun ( int  evtmax)
override

implementation of IEventProcessor::executeRun(int)

Definition at line 878 of file ApplicationMgr.cpp.

878  {
881  if ( m_processingMgr ) {
882  return m_processingMgr->executeRun(evtmax);
883  }
884  log << MSG::WARNING << "No EventLoop Manager specified " << endmsg;
885  return StatusCode::SUCCESS;
886  }
887  log << MSG::FATAL << "executeRun: Invalid state \"" << FSMState() << "\""
888  << endmsg;
889  return StatusCode::FAILURE;
890 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
SmartIF< IEventProcessor > m_processingMgr
Reference to processing manager object.
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 (beginRun() and endRun() called)
const std::string & name() const override
SmartIF< IMessageSvc > m_messageSvc
Reference to the message service.
void ApplicationMgr::extSvcNameListHandler ( Property theProp)

Definition at line 1034 of file ApplicationMgr.cpp.

1034  {
1035  if ( !(decodeExtSvcNameList( )).isSuccess() ) {
1036  throw GaudiException("Failed to declare ext services",
1037  "MinimalEventLoopMgr::extSvcNameListHandler",
1039  }
1040 }
Define general base for Gaudi exception.
StatusCode decodeExtSvcNameList()
StatusCode ApplicationMgr::finalize ( )
override

Definition at line 657 of file ApplicationMgr.cpp.

657  {
660  log << MSG::INFO << "Already Finalized" << endmsg;
661  return StatusCode::SUCCESS;
662  }
664  log << MSG::FATAL << "finalize: Invalid state \"" << m_state << "\""
665  << endmsg;
666  return StatusCode::FAILURE;
667  }
669 
670  // disable message suppression in finalize
671  m_svcLocator->service<IProperty>("MessageSvc")->setProperty(BooleanProperty("enableSuppression", false)).ignore();
672 
673  // Finalize independently managed Algorithms
675  if (sc.isFailure()) {
676  log << MSG::WARNING << "Failed to finalize an algorithm." << endmsg;
678  }
679 
680  // Finalize all Services
681  sc = svcManager()->finalize();
682  if (sc.isFailure()) {
683  log << MSG::WARNING << "Failed to finalize a service." << endmsg;
685  }
686 
687  //svcManager()->removeService( (IService*) m_processingMgr.get() );
688  //svcManager()->removeService( (IService*) m_runable.get() );
689 
690  if (m_codeCheck) {
692  }
693 
694  if (sc.isSuccess()) {
695  log << MSG::INFO << "Application Manager Finalized successfully" << endmsg;
696  } else {
697  log << MSG::ERROR << "Application Manager failed to finalize" << endmsg;
698  }
699 
701  return sc;
702 }
Gaudi::StateMachine::State m_targetState
Internal State.
constexpr int FinalizationFailure
Error codes for operation failures.
Definition: AppReturnCode.h:32
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
bool m_codeCheck
Activate StatusCode checking.
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:86
SmartIF< ISvcManager > & svcManager()
IntegerProperty m_returnCode
Property to record the error conditions occurring during the running.
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:78
SimpleProperty< bool > BooleanProperty
Definition: Property.h:702
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:26
bool PyHelper() setProperty(IInterface *p, char *name, char *value)
Definition: Bootstrap.cpp:255
virtual StatusCode finalize()=0
Finalize (from INITIALIZED to CONFIGURED).
static GAUDI_API void disableChecking()
Definition: StatusCode.cpp:23
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:21
SmartIF< IAlgManager > & algManager()
const std::string & name() const override
SmartIF< IMessageSvc > m_messageSvc
Reference to the message service.
Gaudi::StateMachine::State ApplicationMgr::FSMState ( ) const
override

Definition at line 914 of file ApplicationMgr.cpp.

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

Definition at line 135 of file ApplicationMgr.h.

135  {
136  return m_managers[I::interfaceID().id()];
137  }
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 766 of file ApplicationMgr.cpp.

766  {
768 
769  switch (state) {
770 
772  switch (m_state) {
774  case Gaudi::StateMachine::CONFIGURED : return terminate(); break;
775  default: // Gaudi::StateMachine::INITIALIZED or Gaudi::StateMachine::RUNNING
777  if (sc.isSuccess()) {
778  return terminate();
779  } break;
780  } break;
781 
783  switch (m_state) {
785  case Gaudi::StateMachine::OFFLINE : return configure(); break;
786  case Gaudi::StateMachine::INITIALIZED : return finalize(); break;
787  default: // Gaudi::StateMachine::RUNNING
789  if (sc.isSuccess()) {
790  return finalize();
791  } break;
792  } break;
793 
795  switch (m_state) {
797  case Gaudi::StateMachine::CONFIGURED : return initialize(); break;
798  case Gaudi::StateMachine::RUNNING : return stop(); break;
799  default: // Gaudi::StateMachine::OFFLINE
801  if (sc.isSuccess()) {
802  return initialize();
803  } break;
804  } break;
805 
807  switch (m_state) {
809  case Gaudi::StateMachine::INITIALIZED : return start(); break;
810  default: // Gaudi::StateMachine::OFFLINE or Gaudi::StateMachine::CONFIGURED
812  if (sc.isSuccess()) {
813  return start();
814  } break;
815  } break;
816 
817  }
818 
819  // If I get here, there has been a problem in the recursion
820 
821  if (ignoreFailures){
822  // force the new state
823  m_state = state;
824  return StatusCode::SUCCESS;
825  }
826 
827  return sc;
828 }
StatusCode initialize() override
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
StatusCode terminate() override
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
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
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 198 of file ApplicationMgr.cpp.

198  {
199  StatusCode sc;
200 
201  // declare factories in current module
203 
204  // Create the Message service
206  if( !msgsvc ) {
207  fatal() << "Error creating MessageSvc of type " << m_messageSvcType << endmsg;
208  return sc;
209  }
210  // Create the Job Options service
211  auto jobsvc = svcManager()->createService(Gaudi::Utils::TypeNameString("JobOptionsSvc", m_jobOptionsSvcType));
212  if( !jobsvc ) {
213  fatal() << "Error creating JobOptionsSvc" << endmsg;
214  return sc;
215  }
216 
217  auto jobOptsIProp = jobsvc.as<IProperty>();
218  if ( !jobOptsIProp ) {
219  fatal() << "Error locating JobOptionsSvc" << endmsg;
220  return sc;
221  }
222  sc = jobOptsIProp->setProperty( StringProperty("TYPE", m_jobOptionsType) );
223  if( !sc.isSuccess() ) {
224  fatal() << "Error setting TYPE option in JobOptionsSvc" << endmsg;
225  return sc;
226  }
227 
228  if ( !m_jobOptionsPath.empty() ) { // The command line takes precedence
229  sc = jobOptsIProp->setProperty( StringProperty("PATH", m_jobOptionsPath) );
230  if( !sc.isSuccess() ) {
231  fatal() << "Error setting PATH option in JobOptionsSvc" << endmsg;
232  return sc;
233  }
234  }
235  else if ( isEnvSet("JOBOPTPATH") ) {// Otherwise the Environment JOBOPTPATH
236  sc = jobOptsIProp->setProperty (StringProperty("PATH",
237  getEnv("JOBOPTPATH")));
238  if( !sc.isSuccess() ) {
239  fatal()
240  << "Error setting PATH option in JobOptionsSvc from env"
241  << endmsg;
242  return sc;
243  }
244  }
245  else { // Otherwise the default
246  sc = jobOptsIProp->setProperty (StringProperty("PATH",
247  "../options/job.opts"));
248  if( !sc.isSuccess() ) {
249  fatal()
250  << "Error setting PATH option in JobOptionsSvc to default"
251  << endmsg;
252  return sc;
253  }
254  }
255  jobOptsIProp.reset();
256 
257  // Sets my default the Output Level of the Message service to be
258  // the same as this
259  auto msgSvcIProp = msgsvc.as<IProperty>();
260  msgSvcIProp->setProperty( IntegerProperty("OutputLevel", m_outputLevel)).ignore();
261  msgSvcIProp.reset();
262 
263  sc = jobsvc->sysInitialize();
264  if( !sc.isSuccess() ) {
265  fatal() << "Error initializing JobOptionsSvc" << endmsg;
266  return sc;
267  }
268  sc = msgsvc->sysInitialize();
269  if( !sc.isSuccess() ) {
270  fatal() << "Error initializing MessageSvc" << endmsg;
271  return sc;
272  }
273 
274  // Get the useful interface from Message and JobOptions services
275  m_messageSvc = m_svcLocator->service("MessageSvc");
276  if( !m_messageSvc ) {
277  fatal() << "Error retrieving MessageSvc." << endmsg;
278  return sc;
279  }
280  m_jobOptionsSvc = m_svcLocator->service("JobOptionsSvc");
281  if( !m_jobOptionsSvc ) {
282  fatal() << "Error retrieving JobOptionsSvc." << endmsg;
283  return sc;
284  }
285 
286  return sc;
287 }
std::string m_jobOptionsType
Source type (e.g. dbase, file...)
StringProperty m_messageSvcType
MessageSvc type.
StatusCode loadModule(const std::string &module, bool fireIncident=true) override
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
SmartIF< IJobOptionsSvc > m_jobOptionsSvc
Reference to JobOption service.
SmartIF< ISvcManager > & svcManager()
int m_outputLevel
Message output level.
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:78
Helper class to parse a string of format "type/name".
Definition: TypeNameString.h:9
std::string m_jobOptionsPath
The "file" to look for properties.
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:26
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...
virtual StatusCode setProperty(const Property &p)=0
Set the property by property.
GAUDI_API bool isEnvSet(const char *var)
Check if an environment variable is set or not.
Definition: System.cpp:639
GAUDI_API std::string getEnv(const char *var)
get a particular environment variable (returning "UNKNOWN" if not set)
Definition: System.cpp:619
SimpleProperty< std::string > StringProperty
Definition: Property.h:718
SimpleProperty< int > IntegerProperty
Definition: Property.h:708
SmartIF< DLLClassManager > m_classManager
Reference to the class manager.
StringProperty m_jobOptionsSvcType
JobOptionsSvc type.
MsgStream & fatal() const
shortcut for the method msgStream(MSG::FATAL)
void ignore() const
Definition: StatusCode.h:108
The IProperty is the basic interface for all components which have properties that can be set or get...
Definition: IProperty.h:21
SmartIF< IMessageSvc > m_messageSvc
Reference to the message service.
StatusCode ApplicationMgr::initialize ( )
override

Definition at line 512 of file ApplicationMgr.cpp.

512  {
513 
515  StatusCode sc;
516 
517  // I cannot add these services in configure() because they are coming from GaudiUtils
518  // and it messes up genconf when rebuilding it.
519  if (m_stopOnSignal) {
520  // Instantiate the service that schedules a stop when a signal is received
521  std::string svcname("Gaudi::Utils::StopSignalHandler");
522  sc = svcManager()->addService(svcname);
523  if ( sc.isFailure() ) {
524  log << MSG::INFO << "Cannot instantiate " << svcname << "signals will be ignored" << endmsg;
525  }
526  }
527 
529  // Instantiate the service that schedules a stop when a signal is received
530  std::string svcname("StalledEventMonitor");
531  sc = svcManager()->addService(svcname);
532  if ( sc.isFailure() ) {
533  log << MSG::INFO << "Cannot instantiate " << svcname << "signals will be ignored" << endmsg;
534  }
535  }
536 
538  log << MSG::INFO << "Already Initialized!" << endmsg;
539  return StatusCode::SUCCESS;
540  }
542  log << MSG::FATAL
543  << "initialize: Invalid state \"" << m_state << "\"" << endmsg;
544  return StatusCode::FAILURE;
545  }
547 
548  //--------------------------------------------------------------------------
549  // Initialize the list of top Services
550  //--------------------------------------------------------------------------
551  sc = svcManager()->initialize();
552  if( !sc.isSuccess() ) return sc;
553 
554  //--------------------------------------------------------------------------
555  // Final steps: Inform user and change internal state
556  //--------------------------------------------------------------------------
557  log << MSG::INFO << "Application Manager Initialized successfully" << endmsg;
559 
560  return sc;
561 }
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.
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:86
SmartIF< ISvcManager > & svcManager()
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
virtual StatusCode initialize()=0
Initialization (from CONFIGURED to INITIALIZED).
BooleanProperty m_stalledEventMonitoring
Property to enable/disable the monitoring and reporting of stalled events (enabled by default)...
Gaudi::StateMachine::State m_state
Internal State.
BooleanProperty m_stopOnSignal
Property to enable/disable the "stop on signal" service (enabled by default).
const std::string & name() const override
SmartIF< IMessageSvc > m_messageSvc
Reference to the message service.
void ApplicationMgr::initLoopCheckHndlr ( Property )

Definition at line 1284 of file ApplicationMgr.cpp.

1284  {
1286 }
SmartIF< ISvcManager > & svcManager()
BooleanProperty m_loopCheck
For ServiceMgr initialization loop checking.
virtual void setLoopCheckEnabled(bool en=true)=0
Set the value of the initialization loop check flag.
void ApplicationMgr::multiThreadSvcNameListHandler ( Property theProp)

Definition at line 1075 of file ApplicationMgr.cpp.

1075  {
1076  if ( !(decodeMultiThreadSvcNameList( )).isSuccess() ) {
1077  throw GaudiException("Failed to create copies of mt services",
1078  "MinimalEventLoopMgr::multiThreadSvcNameListHandler",
1080  }
1081 
1082 }
Define general base for Gaudi exception.
StatusCode decodeMultiThreadSvcNameList()
const std::string & ApplicationMgr::name ( ) const
override

Definition at line 909 of file ApplicationMgr.cpp.

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

Definition at line 600 of file ApplicationMgr.cpp.

600  {
603  log << MSG::FATAL << "nextEvent: Invalid state \"" << m_state << "\""
604  << endmsg;
605  return StatusCode::FAILURE;
606  }
607  if (!m_processingMgr) {
609  log << MSG::FATAL << "No event processing manager specified. Check option:"
610  << s_eventloop << endmsg;
611  return StatusCode::FAILURE;
612  }
613  return m_processingMgr->nextEvent(maxevt);
614 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
SmartIF< IEventProcessor > m_processingMgr
Reference to processing manager object.
virtual StatusCode nextEvent(int maxevt)=0
Process the next maxevt events.
Gaudi::StateMachine::State m_state
Internal State.
const std::string & name() const override
SmartIF< IMessageSvc > m_messageSvc
Reference to the message service.
void ApplicationMgr::pluginDebugPropertyHandler ( Property theProp)

Definition at line 1270 of file ApplicationMgr.cpp.

1271 {
1272  // Setup debug level for the plugin system
1274  log << MSG::INFO
1275  << "Updating Gaudi::PluginService::SetDebug(level) to level="
1276  << (int)m_pluginDebugLevel
1277  << endmsg;
1279 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
IntegerProperty m_pluginDebugLevel
Debug level for the plugin system.
GAUDIPS_API void SetDebug(int debugLevel)
Backward compatibility with Reflex.
const std::string & name() const override
SmartIF< IMessageSvc > m_messageSvc
Reference to the message service.
StatusCode ApplicationMgr::queryInterface ( const InterfaceID iid,
void **  pinterface 
)
override

Definition at line 163 of file ApplicationMgr.cpp.

165 {
166  if ( !ppvi ) { return StatusCode::FAILURE ; }
167 
168  // try to find own/direct interfaces:
169  StatusCode sc = base_class::queryInterface(iid,ppvi);
170  if (sc.isSuccess()) return sc;
171 
172  // find indirect interfaces :
173  if ( ISvcLocator ::interfaceID() . versionMatch ( iid ) )
174  { return serviceLocator()-> queryInterface ( iid , ppvi ) ; }
175  else if ( ISvcManager ::interfaceID() . versionMatch ( iid ) )
176  { return svcManager() -> queryInterface ( iid , ppvi ) ; }
177  else if ( IAlgManager ::interfaceID() . versionMatch ( iid ) )
178  { return algManager() -> queryInterface ( iid , ppvi ) ; }
179  else if ( IClassManager ::interfaceID() . versionMatch ( iid ) )
180  { return m_classManager -> queryInterface ( iid , ppvi ) ; }
181  else if ( IProperty ::interfaceID() . versionMatch ( iid ) )
182  { return m_propertyMgr -> queryInterface ( iid , ppvi ) ; }
183  else if ( IMessageSvc ::interfaceID() . versionMatch ( iid ) )
184  {
185  *ppvi = reinterpret_cast<void*>(m_messageSvc.get());
187  // Note that 0 can be a valid IMessageSvc pointer value (when used for
188  // MsgStream).
189  return StatusCode::SUCCESS;
190  }
191  *ppvi = nullptr;
192  return StatusCode::FAILURE;
193 }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
SmartIF< ISvcManager > & svcManager()
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:76
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
SmartIF< ISvcLocator > & serviceLocator() const override
Needed to locate the message service.
StatusCode queryInterface(const InterfaceID &iid, void **pinterface) override
SmartIF< PropertyMgr > m_propertyMgr
Reference to Property Manager.
SmartIF< DLLClassManager > m_classManager
Reference to the class manager.
virtual unsigned long addRef()=0
Increment the reference count of Interface instance.
SmartIF< IAlgManager > & algManager()
static const InterfaceID & interfaceID()
Return an instance of InterfaceID identifying the interface.
Definition: IInterface.h:243
SmartIF< IMessageSvc > m_messageSvc
Reference to the message service.
StatusCode ApplicationMgr::reinitialize ( )
override

Definition at line 926 of file ApplicationMgr.cpp.

926  {
928  StatusCode sc;
930  throw GaudiException("Cannot reinitialize application if not INITIALIZED or RUNNING",
931  "ApplicationMgr::reinitialize", StatusCode::FAILURE);
932  }
935  }
936  sc = svcManager()->reinitialize();
937  if (sc.isFailure()) retval = sc;
938  sc = algManager()->reinitialize();
939  if (sc.isFailure()) retval = sc;
940  return retval;
941 }
Define general base for Gaudi exception.
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:86
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:26
StatusCode GoToState(Gaudi::StateMachine::State state, bool ignoreFailures=false)
Reach a state from current state (whichever it is) going through the correct transitions.
Gaudi::StateMachine::State m_state
Internal State.
SmartIF< IAlgManager > & algManager()
StatusCode ApplicationMgr::restart ( )
override

Definition at line 946 of file ApplicationMgr.cpp.

946  {
948  StatusCode sc;
950  throw GaudiException("Cannot restart application if not RUNNING",
951  "ApplicationMgr::restart", StatusCode::FAILURE);
952  }
953  sc = svcManager()->restart();
954  if (sc.isFailure()) retval = sc;
955  sc = algManager()->restart();
956  if (sc.isFailure()) retval = sc;
957  return retval;
958 }
Define general base for Gaudi exception.
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:86
SmartIF< ISvcManager > & svcManager()
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
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 833 of file ApplicationMgr.cpp.

833  {
835 
837  if ( sc.isSuccess() ) {
839  if ( m_runable != 0 ) { // loop over the events
840  sc = m_runable->run();
841  if ( !sc.isSuccess() ) {
842  log << MSG::FATAL << "Application execution failed. Ending the job."
843  << endmsg;
844  }
845  } else {
846  log << MSG::FATAL << "Application has no runable object. Check option:"
847  << s_runable << endmsg;
848  }
849  }
850  if (sc.isSuccess()) { // try to close cleanly
852  }
853  // either the runable failed of the stut-down
854  if (sc.isFailure()) { // try to close anyway (but keep the StatusCode unchanged)
856  }
857  return sc;
858 }
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.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:86
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
StatusCode GoToState(Gaudi::StateMachine::State state, bool ignoreFailures=false)
Reach a state from current state (whichever it is) going through the correct transitions.
void ignore() const
Definition: StatusCode.h:108
const std::string & name() const override
SmartIF< IMessageSvc > m_messageSvc
Reference to the message service.
SmartIF<ISvcLocator>& ApplicationMgr::serviceLocator ( ) const
inlineoverride

Needed to locate the message service.

Definition at line 156 of file ApplicationMgr.h.

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

Definition at line 169 of file ApplicationMgr.h.

169 {}
void ApplicationMgr::SIExitHandler ( Property theProp)

Definition at line 979 of file ApplicationMgr.cpp.

979  {
980  StatusCode status;
981  status = finalize();
982  status = terminate();
983  ::exit( 0 );
984 }
StatusCode terminate() override
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
StatusCode finalize() override
void ApplicationMgr::SIGoHandler ( Property theProp)

Definition at line 963 of file ApplicationMgr.cpp.

963  {
964 
966  StatusCode sc;
967 
968  // Re-initialize everything
969  sc = reinitialize();
970  // Execute a number of events
972 
973  return;
974 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
int m_evtMax
Number of events to be processed.
StatusCode executeRun(int evtmax) override
implementation of IEventProcessor::executeRun(int)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
StatusCode reinitialize() override
const std::string & name() const override
SmartIF< IMessageSvc > m_messageSvc
Reference to the message service.
StatusCode ApplicationMgr::start ( )
override

Definition at line 566 of file ApplicationMgr.cpp.

566  {
567 
569  StatusCode sc;
570 
572  log << MSG::INFO << "Already Initialized!" << endmsg;
573  return StatusCode::SUCCESS;
574  }
576  log << MSG::FATAL
577  << "start: Invalid state \"" << m_state << "\"" << endmsg;
578  return StatusCode::FAILURE;
579  }
581 
582  //--------------------------------------------------------------------------
583  // Initialize the list of top Services
584  //--------------------------------------------------------------------------
585  sc = svcManager()->start();
586  if( !sc.isSuccess() ) return sc;
587 
588  //--------------------------------------------------------------------------
589  // Final steps: Inform user and change internal state
590  //--------------------------------------------------------------------------
591  log << MSG::INFO << "Application Manager Started successfully" << endmsg;
593 
594  return sc;
595 }
Gaudi::StateMachine::State m_targetState
Internal State.
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
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:26
Gaudi::StateMachine::State m_state
Internal State.
const std::string & name() const override
SmartIF< IMessageSvc > m_messageSvc
Reference to the message service.
StatusCode ApplicationMgr::stop ( )
override

Definition at line 619 of file ApplicationMgr.cpp.

619  {
620 
622  StatusCode sc;
623 
625  log << MSG::INFO << "Already Initialized!" << endmsg;
626  return StatusCode::SUCCESS;
627  }
628  else if( m_state != Gaudi::StateMachine::RUNNING ) {
629  log << MSG::FATAL
630  << "stop: Invalid state \"" << m_state << "\"" << endmsg;
631  return StatusCode::FAILURE;
632  }
634 
635  // Stop independently managed Algorithms
636  sc = algManager()->stop();
637  if( !sc.isSuccess() ) return sc;
638 
639  //--------------------------------------------------------------------------
640  // Stop the list of top Services
641  //--------------------------------------------------------------------------
642  sc = svcManager()->stop();
643  if( !sc.isSuccess() ) return sc;
644 
645  //--------------------------------------------------------------------------
646  // Final steps: Inform user and change internal state
647  //--------------------------------------------------------------------------
648  log << MSG::INFO << "Application Manager Stopped successfully" << endmsg;
650 
651  return sc;
652 }
Gaudi::StateMachine::State m_targetState
Internal State.
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
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:26
Gaudi::StateMachine::State m_state
Internal State.
SmartIF< IAlgManager > & algManager()
const std::string & name() const override
SmartIF< IMessageSvc > m_messageSvc
Reference to the message service.
StatusCode ApplicationMgr::stopRun ( )
override

implementation of IEventProcessor::stopRun()

Definition at line 895 of file ApplicationMgr.cpp.

895  {
898  if ( m_processingMgr ) {
899  return m_processingMgr->stopRun();
900  }
901  log << MSG::WARNING << "No EventLoop Manager specified " << endmsg;
902  return StatusCode::SUCCESS;
903  }
904  log << MSG::FATAL << "stopRun: Invalid state \"" << FSMState() << "\""
905  << endmsg;
906  return StatusCode::FAILURE;
907 }
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.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
SmartIF< IEventProcessor > m_processingMgr
Reference to processing manager object.
Gaudi::StateMachine::State m_state
Internal State.
Gaudi::StateMachine::State FSMState() const override
const std::string & name() const override
SmartIF< IMessageSvc > m_messageSvc
Reference to the message service.
SmartIF<ISvcManager>& ApplicationMgr::svcManager ( )
inline

Definition at line 139 of file ApplicationMgr.h.

139  {
140  // Cache the casted pointer to ISvcManager
141  if (!m_svcManager) {
142  m_svcManager = getManager<IService>();
143  }
144  return m_svcManager;
145  }
SmartIF< ISvcManager > m_svcManager
Cached pointer to the manager of services.
StatusCode ApplicationMgr::sysFinalize ( )
inlineoverride

Definition at line 108 of file ApplicationMgr.h.

StatusCode ApplicationMgr::sysInitialize ( )
inlineoverride

Definition at line 102 of file ApplicationMgr.h.

StatusCode ApplicationMgr::sysReinitialize ( )
inlineoverride

Definition at line 110 of file ApplicationMgr.h.

StatusCode ApplicationMgr::sysRestart ( )
inlineoverride

Definition at line 112 of file ApplicationMgr.h.

StatusCode ApplicationMgr::sysStart ( )
inlineoverride

Definition at line 104 of file ApplicationMgr.h.

StatusCode ApplicationMgr::sysStop ( )
inlineoverride

Definition at line 106 of file ApplicationMgr.h.

Gaudi::StateMachine::State ApplicationMgr::targetFSMState ( ) const
override

Definition at line 918 of file ApplicationMgr.cpp.

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

Definition at line 707 of file ApplicationMgr.cpp.

707  {
709 
711  log << MSG::INFO << "Already Offline" << endmsg;
712  return StatusCode::SUCCESS;
713  }
715  log << MSG::FATAL << "terminate: Invalid state \"" << m_state << "\""
716  << endmsg;
717  return StatusCode::FAILURE;
718  }
719  // release all Services
721 
723  log << MSG::INFO << "Application Manager Terminated successfully" << endmsg;
725  log << MSG::INFO << "Application Manager Terminated successfully with a user requested ScheduledStop" << endmsg;
726  } else {
727  log << MSG::ERROR << "Application Manager Terminated with error code " << m_returnCode.value() << endmsg;
728  }
729 
730  { // Force a disable the auditing of finalize for MessageSvc
731  auto prop = m_messageSvc.as<IProperty>();
732  if (prop) {
733  prop->setProperty(BooleanProperty("AuditFinalize", false)).ignore();
734  }
735  }
736  { // Force a disable the auditing of finalize for JobOptionsSvc
737  auto prop = m_jobOptionsSvc.as<IProperty>();
738  if (prop) {
739  prop->setProperty(BooleanProperty("AuditFinalize", false)).ignore();
740  }
741  }
742 
743  // finalize MessageSvc
744  auto svc = m_messageSvc.as<IService>();
745  if ( !svc ) {
746  log << MSG::ERROR << "Could not get the IService interface of the MessageSvc" << endmsg;
747  } else {
748  svc->sysFinalize().ignore();
749  }
750 
751  // finalize JobOptionsSvc
752  svc = m_jobOptionsSvc.as<IService>();
753  if ( !svc ) {
754  log << MSG::ERROR << "Could not get the IService interface of the JobOptionsSvc" << endmsg;
755  } else {
756  svc->sysFinalize().ignore();
757  }
758 
760  return StatusCode::SUCCESS;
761 }
Gaudi::StateMachine::State m_targetState
Internal State.
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
SmartIF< IJobOptionsSvc > m_jobOptionsSvc
Reference to JobOption service.
constexpr int ScheduledStop
Definition: AppReturnCode.h:25
IntegerProperty m_returnCode
Property to record the error conditions occurring during the running.
SimpleProperty< bool > BooleanProperty
Definition: Property.h:702
SmartIF< IFace > as() const
return a new SmartIF instance to another interface
Definition: SmartIF.h:110
General service interface definition.
Definition: IService.h:18
virtual StatusCode setProperty(const Property &p)=0
Set the property by property.
const TYPE & value() const
explicit conversion
Definition: Property.h:341
Gaudi::StateMachine::State m_state
Internal State.
void ignore() const
Definition: StatusCode.h:108
constexpr int Success
Definition: AppReturnCode.h:16
The IProperty is the basic interface for all components which have properties that can be set or get...
Definition: IProperty.h:21
const std::string & name() const override
SmartIF< IMessageSvc > m_messageSvc
Reference to the message service.

Member Data Documentation

bool ApplicationMgr::m_actHistory
protected

Activate HistorySvc.

Definition at line 245 of file ApplicationMgr.h.

SmartIF<IAlgManager> ApplicationMgr::m_algManager
protected

Cached pointer to the manager of algorithms.

Definition at line 194 of file ApplicationMgr.h.

std::string ApplicationMgr::m_appName
protected

The name of the application.

Definition at line 243 of file ApplicationMgr.h.

std::string ApplicationMgr::m_appVersion
protected

The version of the application.

Definition at line 244 of file ApplicationMgr.h.

BooleanProperty ApplicationMgr::m_auditAlgs
protected

Definition at line 254 of file ApplicationMgr.h.

BooleanProperty ApplicationMgr::m_auditSvcs
protected

Definition at line 253 of file ApplicationMgr.h.

BooleanProperty ApplicationMgr::m_auditTools
protected

Defaults for auditors.

Definition at line 252 of file ApplicationMgr.h.

SmartIF<DLLClassManager> ApplicationMgr::m_classManager
protected

Reference to the class manager.

Definition at line 199 of file ApplicationMgr.h.

bool ApplicationMgr::m_codeCheck
protected

Activate StatusCode checking.

Definition at line 246 of file ApplicationMgr.h.

StringArrayProperty ApplicationMgr::m_createSvcNameList
protected

Definition at line 249 of file ApplicationMgr.h.

StringArrayProperty ApplicationMgr::m_declaredManagers
protected

Property to declare the list of known managers.

Definition at line 188 of file ApplicationMgr.h.

VectorName ApplicationMgr::m_defServices
protected

Vector default services names.

Definition at line 214 of file ApplicationMgr.h.

StringArrayProperty ApplicationMgr::m_dllNameList
protected

List of DDL's names.

Definition at line 235 of file ApplicationMgr.h.

std::map<std::string,std::string> ApplicationMgr::m_environment
protected

Environment variables to set.

Definition at line 256 of file ApplicationMgr.h.

std::string ApplicationMgr::m_eventLoopMgr
protected

Processing manager type.

Definition at line 239 of file ApplicationMgr.h.

int ApplicationMgr::m_evtMax
protected

Number of events to be processed.

Definition at line 227 of file ApplicationMgr.h.

std::string ApplicationMgr::m_evtsel
protected

Event selection.

Definition at line 240 of file ApplicationMgr.h.

BooleanProperty ApplicationMgr::m_extSvcCreates
protected

LHCb or ATLAS defn of "ExtSvc".

Definition at line 229 of file ApplicationMgr.h.

StringArrayProperty ApplicationMgr::m_extSvcNameList
protected

List of external services names.

Definition at line 228 of file ApplicationMgr.h.

std::string ApplicationMgr::m_histPersName
protected

CGL: Name of the Hist Pers Svc.

Definition at line 241 of file ApplicationMgr.h.

std::string ApplicationMgr::m_jobOptionsPath
protected

The "file" to look for properties.

Definition at line 237 of file ApplicationMgr.h.

SmartIF<IJobOptionsSvc> ApplicationMgr::m_jobOptionsSvc
protected

Reference to JobOption service.

Definition at line 221 of file ApplicationMgr.h.

StringProperty ApplicationMgr::m_jobOptionsSvcType
protected

JobOptionsSvc type.

Definition at line 208 of file ApplicationMgr.h.

std::string ApplicationMgr::m_jobOptionsType
protected

Source type (e.g. dbase, file...)

Definition at line 236 of file ApplicationMgr.h.

BooleanProperty ApplicationMgr::m_loopCheck
protected

For ServiceMgr initialization loop checking.

Definition at line 259 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 186 of file ApplicationMgr.h.

SmartIF<IMessageSvc> ApplicationMgr::m_messageSvc
protected

Reference to the message service.

Definition at line 218 of file ApplicationMgr.h.

StringProperty ApplicationMgr::m_messageSvcType
protected

MessageSvc type.

Definition at line 207 of file ApplicationMgr.h.

StringArrayProperty ApplicationMgr::m_multiThreadSvcNameList
protected

List of external services names for which we want a copy per evt thread.

Definition at line 232 of file ApplicationMgr.h.

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

Name.

Definition at line 210 of file ApplicationMgr.h.

int ApplicationMgr::m_noOfEvtThreads
protected

no of multiThreadSvc copies

Definition at line 233 of file ApplicationMgr.h.

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

names of successfully loaded dlls

Definition at line 276 of file ApplicationMgr.h.

int ApplicationMgr::m_outputLevel
protected

Message output level.

Definition at line 242 of file ApplicationMgr.h.

StringArrayProperty ApplicationMgr::m_outStreamNameList
protected

List of output stream names.

Definition at line 205 of file ApplicationMgr.h.

StringProperty ApplicationMgr::m_outStreamType
protected

Output stream type (obsolete?)

Definition at line 206 of file ApplicationMgr.h.

IntegerProperty ApplicationMgr::m_pluginDebugLevel
protected

Debug level for the plugin system.

Definition at line 247 of file ApplicationMgr.h.

SmartIF<IEventProcessor> ApplicationMgr::m_processingMgr
protected

Reference to processing manager object.

Definition at line 220 of file ApplicationMgr.h.

bool ApplicationMgr::m_propertiesPrint
protected

flag to activate the printout of properties

Definition at line 270 of file ApplicationMgr.h.

SmartIF<PropertyMgr> ApplicationMgr::m_propertyMgr
protected

Reference to Property Manager.

Definition at line 200 of file ApplicationMgr.h.

IntegerProperty ApplicationMgr::m_returnCode
protected

Property to record the error conditions occurring during the running.

Definition at line 273 of file ApplicationMgr.h.

SmartIF<IRunable> ApplicationMgr::m_runable
protected

Reference to the runable object.

Definition at line 219 of file ApplicationMgr.h.

std::string ApplicationMgr::m_runableType
protected

Runable type.

Definition at line 238 of file ApplicationMgr.h.

IntegerProperty ApplicationMgr::m_SIExit
protected

For SI's "Exit" command via callback.

Definition at line 203 of file ApplicationMgr.h.

IntegerProperty ApplicationMgr::m_SIGo
protected

For SI's "Go" command via callback.

Definition at line 202 of file ApplicationMgr.h.

BooleanProperty ApplicationMgr::m_stalledEventMonitoring
protected

Property to enable/disable the monitoring and reporting of stalled events (enabled by default).

See also
StalledEventMonitor

Definition at line 267 of file ApplicationMgr.h.

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

Internal State.

Definition at line 211 of file ApplicationMgr.h.

BooleanProperty ApplicationMgr::m_stopOnSignal
protected

Property to enable/disable the "stop on signal" service (enabled by default).

See also
Gaudi::Utils::StopSignalHandler

Definition at line 263 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 198 of file ApplicationMgr.h.

SmartIF<ISvcManager> ApplicationMgr::m_svcManager
protected

Cached pointer to the manager of services.

Definition at line 191 of file ApplicationMgr.h.

VectorName ApplicationMgr::m_svcMapping
protected

Default mapping of services.

Definition at line 215 of file ApplicationMgr.h.

VectorName ApplicationMgr::m_svcOptMapping
protected

Default mapping of services.

Definition at line 216 of file ApplicationMgr.h.

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

Internal State.

Definition at line 212 of file ApplicationMgr.h.

StringArrayProperty ApplicationMgr::m_topAlgNameList
protected

List of top level algorithms names.

Definition at line 204 of file ApplicationMgr.h.


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