72 :
public PropertyHolder<CommonMessaging<implements<IAppMgrUI, Gaudi::Interfaces::IQueueingEventProcessor, IService,
73 IStateful, INamedInterface, IProperty>>> {
98 const std::string&
name()
const override;
131 bool empty()
const override;
132 std::optional<Gaudi::Interfaces::IQueueingEventProcessor::ResultType>
pop()
override;
212 this->reinitialize().
ignore();
216 "For SI's \"Go\" command via callback" };
223 "For SI's \"Exit\" command via callback" };
228 "List of top level algorithms names",
229 "vector<Algorithm>" };
233 "Service:IMessageSvc" };
235 "Service:Gaudi::Interfaces::IOptionsSvc" };
243 this,
"SvcOptMapping", {},
"Default mapping of optional services" };
259 this,
"ExtSvc", {},
"List of external services names",
"vector<Service>" };
261 "LHCb (default) or ATLAS definition of \"ExtSvc\"" };
267 this,
"JobOptionsPostAction", {},
"additional command to run on config" };
269 this,
"JobOptionsPreAction", {},
"additional command to run on config" };
272 "Service:IEventProcessor" };
285 <<
"Updating Gaudi::PluginService::SetDebug(level) to level="
290 "Debug level for the plugin system" };
293 this,
"CreateSvc", {},
"List of extra services to be created" };
301 this,
"Environment", {},
"Environment variables to set" };
305 "For ServiceMgr initialization loop checking" };
310 this,
"StopOnSignal",
false,
"Flag to enable/disable the signal handler that schedule a stop of the event loop" };
313 "Flag to activate the printout of properties" };
317 "Return code of the application. Set internally in case of error conditions." };
320 "Print the sequence of algorithms that have been loaded." };
323 "Replace ROOT error handler with MessageSvc." };
326 "Enable ROOT thread safety at startup." };
335 template <
typename SELF,
typename PIMPL,
typename METHOD,
typename... ARGS>
336 static auto i_delegateToEvtProc( SELF* self, PIMPL& member, std::string_view method_name, METHOD&& method,
339 if (
bool( member ) ) {
343 s << method_name <<
": event processor is not a \""
349 s << method_name <<
": Invalid state \"" << self->FSMState() <<
'"';
357#define ON_DEBUG if ( m_outputLevel <= MSG::DEBUG )
358#define ON_VERBOSE if ( m_outputLevel <= MSG::VERBOSE )
364 static IMessageSvc* s_messageSvcInstance{
nullptr };
366 static ErrorHandlerFunc_t s_originalRootErrorHandler{
nullptr };
369 void ROOTErrorHandlerAdapter(
int level, Bool_t abort,
const char* location,
const char* msg ) {
370 if ( s_messageSvcInstance ) {
372 if ( level >= gErrorIgnoreLevel ) {
378 if ( msgLevel >= s_messageSvcInstance->
outputLevel( location ) ) {
384 if ( s_originalRootErrorHandler ) {
386 s_originalRootErrorHandler( level, abort, location, msg );
389 ROOT::Internal::MinimalErrorHandler( level, abort, location, msg );
420 "Aliases of algorithm types, to replace an algorithm type for every instance" );
426 "DetDataSvc/DetectorDataSvc",
427 "HistogramSvc/HistogramDataSvc",
428 "HbookCnv::PersSvc/HbookHistSvc",
429 "RootHistCnv::PersSvc/RootHistSvc",
430 "EvtPersistencySvc/EventPersistencySvc",
431 "DetPersistencySvc/DetectorPersistencySvc",
432 "HistogramPersistencySvc/HistogramPersistencySvc" };
437 if (
auto output = base_class::i_cast( iid ) ) {
return output; }
468 ROOT::EnableThreadSafety();
471 <<
"ROOT not yet initialized, we cannot enable thread safety "
472 "(EnableROOTThreadSafety==True)"
498 s_originalRootErrorHandler = SetErrorHandler( ROOTErrorHandlerAdapter );
501 <<
"ROOT not yet initialized, we cannot override the error handler are requested "
502 "(UseMessageSvcForROOTMessages==true)"
515 if ( !jobOptsIProp ) {
528 log <<
MSG::FATAL <<
"Error setting JobOptionsPreAction option in JobOptionsSvc" <<
endmsg;
536 log <<
MSG::FATAL <<
"Error setting JobOptionsPostAction option in JobOptionsSvc" <<
endmsg;
547 }
else if (
isEnvSet(
"JOBOPTPATH" ) ) {
560 jobOptsIProp.reset();
564 auto msgSvcIProp = msgsvc.as<
IProperty>();
568 sc = jobsvc->sysInitialize();
573 sc = msgsvc->sysInitialize();
621 <<
"=================================================================="
622 <<
"==================================================================" <<
std::endl
631#if GAUDI_PATCH_VERSION
641 <<
"=================================================================="
642 <<
"==================================================================" <<
endmsg;
649 <<
" #properties = " << properties.size() <<
endmsg;
650 for (
const auto&
property : properties ) {
log <<
"Property ['Name': Value] = " << *
property <<
endmsg; }
655 const std::string&
name = var.first;
656 const std::string& value = var.second;
763 std::string svcname(
"Gaudi::Utils::StopSignalHandler" );
766 log <<
MSG::INFO <<
"Cannot instantiate " << svcname <<
"signals will be ignored" <<
endmsg;
941 log <<
MSG::INFO <<
"Application Manager Terminated successfully with a user requested ScheduledStop" <<
endmsg;
949 opts.set(
"MessageSvc.AuditFinalize",
"false" );
951 opts.set(
"JobOptionsSvc.AuditFinalize",
"false" );
955 if ( s_originalRootErrorHandler ) {
956 SetErrorHandler( s_originalRootErrorHandler );
957 s_originalRootErrorHandler =
nullptr;
960 s_messageSvcInstance =
nullptr;
966 svc->sysFinalize().ignore();
973 log <<
MSG::ERROR <<
"Could not get the IService interface of the JobOptionsSvc" <<
endmsg;
975 svc->sysFinalize().ignore();
1057 if ( ignoreFailures ) {
1115 std::stringstream ss;
1116 ss <<
"createEventContext: Invalid state \"" <<
FSMState() <<
'"';
1151 throw GaudiException(
"Cannot reinitialize application if not INITIALIZED or RUNNING",
1193 if ( props ) props->setProperty( p ).ignore();
1199 throw GaudiException(
"Failed to create ext services",
"MinimalEventLoopMgr::createSvcNameListHandler",
1206 auto it = theNames.begin();
1207 auto et = theNames.end();
1208 while ( result.
isSuccess() && it != et ) {
1210 if ( ( result =
svcManager()->addService( item, ServiceManager::DEFAULT_SVC_PRIORITY ) ).isFailure() ) {
1212 log <<
MSG::ERROR <<
"decodeCreateSvcNameList: Cannot create service " << item.
type() <<
"/" << item.
name()
1226 throw GaudiException(
"Failed to declare ext services",
"MinimalEventLoopMgr::extSvcNameListHandler",
1236 auto it = theNames.begin();
1237 auto et = theNames.end();
1238 while ( result.
isSuccess() && it != et ) {
1241 if ( ( result =
svcManager()->addService( item, ServiceManager::DEFAULT_SVC_PRIORITY ) ).isFailure() ) {
1243 log <<
MSG::ERROR <<
"decodeExtSvcNameList: Cannot create service " << item.
type() <<
"/" << item.
name()
1247 if ( ( result =
svcManager()->declareSvcType( item.
name(), item.
type() ) ).isFailure() ) {
1249 log <<
MSG::ERROR <<
"decodeExtSvcNameList: Cannot declare service " << item.
type() <<
"/" << item.
name()
1273 if ( 0 == dllInList[it] ) {
1276 ++duplicateList[it];
1285 log <<
MSG::DEBUG <<
"Removed duplicate entries for modules : ";
1286 for (
auto it = duplicateList.
begin(); it != duplicateList.
end(); ++it ) {
1287 log << it->first <<
"(" << 1 + it->second <<
")";
1288 if ( it != --duplicateList.
end() )
log <<
", ";
1299 for (
const auto& it : theNames ) {
1313 if ( !successNames.
empty() ) {
1315 for (
auto it = successNames.
begin(); it != successNames.
end(); it++ ) {
1317 if ( ( it + 1 ) != successNames.
end() )
log <<
", ";
1326 for (
auto it = failNames.
begin(); it != failNames.
end(); it++ ) {
1328 if ( ( it + 1 ) != failNames.
end() )
log <<
", ";
1337 for (
auto& mgrItem :
m_managers ) { mgrItem.second->outputLevelUpdate(); }
1346 for (
int i = 0; i < indent; ++i )
log <<
" ";
1348 auto prop = algmgr->algorithm<
IProperty>( algname, false );
1352 if ( prop->getProperty( &p ).isSuccess() ) {
1353 for (
auto& subalgname : p.value() ) { printAlgsSequencesHelper( algmgr, subalgname,
log, indent + 1 ); }
1363 log <<
MSG::ALWAYS <<
"****************************** Algorithm Sequence ****************************" <<
endmsg;
1365 log <<
MSG::ALWAYS <<
"******************************************************************************" <<
endmsg;
GAUDI_API bool isEnvSet(const char *var)
Check if an environment variable is set or not.
GAUDI_API std::string getEnv(const char *var)
get a particular environment variable (returning "UNKNOWN" if not set)
Version of Gaudi, to be used as.
#define GAUDI_MAJOR_VERSION
Major version of Gaudi (the 41 of v41r0).
#define GAUDI_MINOR_VERSION
Minor version of Gaudi (the 0 of v41r0).
#define GAUDI_PATCH_VERSION
Patch version of Gaudi (the 0 of v41r0p0), 0 if the version has no patch number.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
#define DECLARE_OBJECT_FACTORY(x)
complex< _Tp > log(const complex< _Tp > &)
constexpr _Tp && forward(typename std::remove_reference< _Tp >::type &&__t) noexcept
constexpr _OI move(_II __first, _II __last, _OI __result)
constexpr _InputIterator find(_InputIterator __first, _InputIterator __last, const _Tp &__val)
constexpr const _Tp & min(const _Tp &__a, const _Tp &__b)
basic_ostream< _CharT, _Traits > & endl(basic_ostream< _CharT, _Traits > &__os)
constexpr auto empty(const _Container &__cont) noexcept(noexcept(__cont.empty())) -> decltype(__cont.empty())
__string_type str() const
static constexpr _Tp max() noexcept
bool empty() const noexcept
bool empty() const noexcept
const_iterator end() const noexcept
const_iterator begin() const noexcept
constexpr void push_back(const value_type &__x)
constexpr const_reverse_iterator rend() const noexcept
constexpr const_iterator begin() const noexcept
constexpr bool empty() const noexcept
constexpr const_reverse_iterator rbegin() const noexcept
constexpr const_iterator end() const noexcept
The AlgorithmManager class is in charge of the creation of concrete instances of Algorithms.
AlgorithmManager(IInterface *iface)
default creator
AlgTypeAliasesMap & typeAliases()
The Application Manager class.
SmartIF< ISvcManager > m_svcManager
Cached pointer to the manager of services.
std::map< unsigned long, SmartIF< IComponentManager > > ManagersMap
Using for the map of component managers, the key is the "id" field of the basic InterfaceID of the ma...
Gaudi::Property< std::string > m_jobOptionsType
SmartIF< IRunable > m_runable
Reference to the runable object.
Gaudi::Property< bool > m_printAlgsSequence
SmartIF< IQueueingEventProcessor > m_queueingProcessor
Reference to a queueing processing manager object.
Gaudi::Property< int > m_returnCode
Property to record the error conditions occurring during the running.
SmartIF< IComponentManager > & getManager()
Gaudi::Property< std::vector< std::string > > m_svcMapping
Gaudi::Property< bool > m_useMessageSvcForROOTMessages
std::optional< Gaudi::Interfaces::IQueueingEventProcessor::ResultType > pop() override
Gaudi::Property< std::vector< std::string > > m_dllNameList
Gaudi::StateMachine::State m_targetState
Internal State.
Gaudi::Property< std::string > m_runableType
Gaudi::Property< bool > m_actHistory
void createSvcNameListHandler(Gaudi::Details::PropertyBase &)
std::vector< std::string > m_okDlls
names of successfully loaded dlls
StatusCode GoToState(Gaudi::StateMachine::State state, bool ignoreFailures=false)
Reach a state from current state (whichever it is) going through the correct transitions.
Gaudi::Property< bool > m_propertiesPrint
SmartIF< ISvcLocator > m_svcLocator
Reference to its own service locator (must be instantiated prior to any service!).
StatusCode run() override
ApplicationMgr(IInterface *=nullptr)
StatusCode finalize() override
Gaudi::Property< std::vector< std::string > > m_outStreamNameList
Gaudi::Property< std::vector< std::string > > m_extSvcNameList
StatusCode nextEvent(int maxevt) override
Gaudi::Property< std::string > m_jobOptionsPath
Gaudi::Property< std::vector< std::string > > m_declaredManagers
Property to declare the list of known managers.
SmartIF< DLLClassManager > m_classManager
Reference to the class manager.
StatusCode terminate() override
StatusCode initialize() override
StatusCode stopRun() override
implementation of IEventProcessor::stopRun()
Gaudi::Property< int > m_SIExit
SmartIF< ISvcLocator > & serviceLocator() const override
Needed to locate the message service.
StatusCode sysStop() override
SmartIF< IMessageSvc > m_messageSvc
Reference to the message service.
Gaudi::Property< std::vector< std::string > > m_svcOptMapping
Gaudi::Property< bool > m_enableROOTThreadSafety
bool m_useHiveAlgorithmManager
SmartIF< IAlgManager > & algManager()
StatusCode executeEvent(EventContext &&ctx) override
implementation of IEventProcessor::executeEvent(void*)
void const * i_cast(const InterfaceID &iid) const override
void evtLoopPropertyHandler(Gaudi::Details::PropertyBase &theProp)
Gaudi::Property< bool > m_auditTools
Defaults for auditors.
Gaudi::Monitoring::Hub m_monitoringHub
SmartIF< IAlgManager > m_algManager
Cached pointer to the manager of algorithms.
Gaudi::Property< std::string > m_evtsel
Gaudi::Property< std::string > m_eventLoopMgr
const std::string & name() const override
Gaudi::Property< int > m_evtMax
StatusCode sysRestart() override
Gaudi::Property< std::string > m_appVersion
StatusCode sysReinitialize() override
StatusCode decodeDllNameList()
Gaudi::Property< std::vector< std::string > > m_topAlgNameList
Gaudi::Property< bool > m_extSvcCreates
Gaudi::Property< std::vector< std::string > > m_createSvcNameList
Gaudi::Property< bool > m_auditSvcs
Gaudi::Property< std::map< std::string, std::string > > m_environment
EventContext createEventContext() override
implementation of IEventProcessor::createEventContext()
Gaudi::Property< std::string > m_jobOptionsPreAction
StatusCode reinitialize() override
Gaudi::Property< bool > m_loopCheck
Gaudi::Property< std::string > m_appName
void extSvcNameListHandler(Gaudi::Details::PropertyBase &theProp)
Gaudi::StateMachine::State targetFSMState() const override
Gaudi::Property< int > m_pluginDebugLevel
StatusCode restart() override
StatusCode stop() override
void printAlgsSequences()
Print the sequence of algorithms that have been loaded.
StatusCode executeRun(int evtmax) override
implementation of IEventProcessor::executeRun(int)
static auto i_delegateToEvtProc(SELF *self, PIMPL &member, std::string_view method_name, METHOD &&method, ARGS &&... args)
Helper to delegate calls to event processor implementation.
Gaudi::Property< bool > m_stopOnSignal
Property to enable/disable the "stop on signal" service.
Gaudi::StateMachine::State FSMState() const override
StatusCode i_startup()
Internal startup routine.
StatusCode sysFinalize() override
Gaudi::StateMachine::State m_state
Internal State.
Gaudi::Property< std::string > m_histPersName
StatusCode start() override
void outputLevelUpdate() override
Function to call to update the outputLevel of the components (after a change in MessageSvc).
StatusCode decodeExtSvcNameList()
Gaudi::Property< std::string > m_jobOptionsSvcType
Gaudi::Monitoring::Hub & monitoringHub() override
void push(EventContext &&ctx) override
void setServiceManager(ISvcManager *) override
StatusCode decodeCreateSvcNameList()
void dllNameListHandler(Gaudi::Details::PropertyBase &theProp)
Gaudi::Property< bool > m_auditAlgs
Gaudi::Property< int > m_outputLevel
ManagersMap m_managers
Map of known component managers.
bool empty() const override
StatusCode configure() override
StatusCode sysStart() override
StatusCode sysInitialize() override
Gaudi::Property< int > m_SIGo
void pluginDebugPropertyHandler(Gaudi::Details::PropertyBase &theProp)
SmartIF< ISvcManager > & svcManager()
SmartIF< IEventProcessor > m_processingMgr
Reference to processing manager object.
Gaudi::Property< std::string > m_jobOptionsPostAction
Gaudi::Property< std::string > m_messageSvcType
MSG::Level resetMessaging()
StatusCode loadModule(const std::string &module, bool fireIncident=true) override
DLLClassManager(IInterface *iface)
This class represents an entry point to all the event specific data.
PropertyBase base class allowing PropertyBase* collections to be "homogeneous".
const std::string name() const
property name
Implementation of property with value of concrete type.
Details::PropertyBase & declareUpdateHandler(std::function< void(Details::PropertyBase &)> fun) override
set new callback for update
const ValueType & value() const
std::string format(bool local, std::string spec="%c") const
Format the time using strftime.
static Time current()
Returns the current time.
Helper class to parse a string of format "type/name".
const std::string & type() const
const std::string & name() const
Define general base for Gaudi exception.
GaudiException(std::string Message, std::string Tag, StatusCode Code)
Constructor (1).
virtual EventContext createEventContext()=0
virtual StatusCode executeRun(int maxevt)=0
Process the maxevt events as a Run.
virtual StatusCode stopRun()=0
Schedule a stop of the current event processing.
virtual StatusCode nextEvent(int maxevt)=0
Process the next maxevt events.
virtual StatusCode executeEvent(EventContext &&ctx)=0
Process single event.
Definition of the basic interface.
static const InterfaceID & interfaceID()
Return an instance of InterfaceID identifying the interface.
The IMessage is the interface implemented by the message service.
virtual void reportMessage(const Message &msg, int outputLevel)=0
Report a message by sending a Message object to the message service.
virtual void setOutputLevel(int new_level)=0
Set new global output level threshold.
virtual int outputLevel() const =0
Retrieve the current output level threshold.
The IProperty is the basic interface for all components which have properties that can be set or get.
StatusCode setProperty(const Gaudi::Details::PropertyBase &p)
Set the property from a property.
virtual StatusCode run()=0
Run the class implementation.
General service interface definition.
virtual StatusCode sysStart()=0
Start Service.
virtual StatusCode sysRestart()=0
Re-start the Service.
virtual StatusCode sysStop()=0
Stop Service.
virtual StatusCode sysReinitialize()=0
Re-initialize the Service.
virtual StatusCode finalize()=0
Finalize (from INITIALIZED to CONFIGURED).
virtual StatusCode restart()=0
Initialization (from RUNNING to RUNNING, via INITIALIZED).
virtual StatusCode reinitialize()=0
Initialization (from INITIALIZED or RUNNING to INITIALIZED, via CONFIGURED).
virtual StatusCode start()=0
Start (from INITIALIZED to RUNNING).
virtual StatusCode stop()=0
Stop (from RUNNING to INITIALIZED).
virtual StatusCode initialize()=0
Initialization (from CONFIGURED to INITIALIZED).
virtual SmartIF< IService > & service(const Gaudi::Utils::TypeNameString &typeName, const bool createIf=true)=0
Returns a smart pointer to a service.
Gaudi::Interfaces::IOptionsSvc & getOptsSvc()
Direct access to Gaudi::Interfaces::IOptionsSvc implementation.
The ISvcManager is the interface implemented by the Service Factory in the Application Manager to sup...
virtual StatusCode removeService(IService *svc)=0
Remove a service from the "active" list of services of the factory.
virtual void setLoopCheckEnabled(bool en=true)=0
Set the value of the initialization loop check flag.
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 addService(IService *svc, int prio=DEFAULT_SVC_PRIORITY)=0
Add a service to the "active" list of services of the factory.
constexpr unsigned long id() const
get the interface identifier
Definition of the MsgStream class used to transmit messages.
Gaudi::Details::PropertyBase * property(std::string_view name) const
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Details::PropertyBase &prop)
void bindPropertiesTo(Gaudi::Interfaces::IOptionsSvc &optsSvc)
const std::vector< Gaudi::Details::PropertyBase * > & getProperties() const override
StatusCode setProperty(const Gaudi::Details::PropertyBase &p)
ServiceManager(IInterface *application)
default creator
Small smart pointer class with automatic reference counting for IInterface.
TYPE * get() const
Get interface pointer.
SmartIF< IFace > as() const
return a new SmartIF instance to another interface
This class is used for returning status codes from appropriate routines.
StatusCode andThen(F &&f, ARGS &&... args) const
Chain code blocks making the execution conditional a success result.
void ignore() const
Allow discarding a StatusCode without warning.
constexpr static const auto SUCCESS
constexpr static const auto FAILURE
constexpr int ScheduledStop
constexpr int FinalizationFailure
Error codes for operation failures.
State
Allowed states for classes implementing the state machine (ApplicationMgr, Algorithm,...
GAUDI_API bool isEnvSet(const char *var)
Check if an environment variable is set or not.
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
GAUDI_API std::vector< std::string > getEnv()
get all environment variables
GAUDI_API const std::string & hostName()
Host name.
GAUDI_API std::string getEnv(const char *var)
get a particular environment variable (returning "UNKNOWN" if not set)
GAUDI_API int setEnv(const std::string &name, const std::string &value, int overwrite=1)
Set an environment variables.
virtual std::optional< ResultType > pop()=0
Get the next available result.
virtual bool empty() const =0
Tell if the processor has events in the queues.
virtual void push(EventContext &&ctx)=0
Schedule the processing of an event.
Central entity in a Gaudi application that manages monitoring objects (i.e.
static const InterfaceID & interfaceID()