27 #include "GaudiCoreSvcVersion.h"
41 #define ON_DEBUG if (UNLIKELY(m_outputLevel <= MSG::DEBUG))
42 #define ON_VERBOSE if (UNLIKELY(m_outputLevel <= MSG::VERBOSE))
67 m_svcLocator = svcManager();
74 m_name =
"ApplicationMgr";
78 m_propertyMgr->declareProperty(
"Go", m_SIGo = 0 );
79 m_propertyMgr->declareProperty(
"Exit", m_SIExit = 0 );
80 m_propertyMgr->declareProperty(
"Dlls", m_dllNameList );
81 m_propertyMgr->declareProperty(
"ExtSvc", m_extSvcNameList );
82 m_propertyMgr->declareProperty(
"CreateSvc", m_createSvcNameList );
83 m_propertyMgr->declareProperty(
"ExtSvcCreates", m_extSvcCreates=
true );
85 m_propertyMgr->declareProperty(
"SvcMapping", m_svcMapping );
86 m_propertyMgr->declareProperty(
"SvcOptMapping", m_svcOptMapping );
88 m_propertyMgr->declareProperty(
"TopAlg", m_topAlgNameList );
89 m_propertyMgr->declareProperty(
"OutStream", m_outStreamNameList );
90 m_propertyMgr->declareProperty(
"OutStreamType", m_outStreamType =
"OutputStream" );
91 m_propertyMgr->declareProperty(
"MessageSvcType",m_messageSvcType=
"MessageSvc" );
92 m_propertyMgr->declareProperty(
"JobOptionsSvcType",
93 m_jobOptionsSvcType =
"JobOptionsSvc" );
94 m_propertyMgr->declareProperty(
s_runable, m_runableType =
"AppMgrRunable");
95 m_propertyMgr->declareProperty(
s_eventloop, m_eventLoopMgr =
"EventLoopMgr");
97 m_propertyMgr->declareProperty(
"HistogramPersistency", m_histPersName=
"NONE");
100 m_propertyMgr->declareProperty(
"JobOptionsType", m_jobOptionsType =
"FILE");
101 m_propertyMgr->declareProperty(
"JobOptionsPath", m_jobOptionsPath =
"");
102 m_propertyMgr->declareProperty(
"EvtMax", m_evtMax = -1);
103 m_propertyMgr->declareProperty(
"EvtSel", m_evtsel );
104 m_propertyMgr->declareProperty(
"OutputLevel", m_outputLevel =
MSG::INFO);
106 m_propertyMgr->declareProperty(
"MultiThreadExtSvc", m_multiThreadSvcNameList);
107 m_propertyMgr->declareProperty(
"NoOfThreads", m_noOfEvtThreads = 0);
108 m_propertyMgr->declareProperty(
"AppName", m_appName =
"ApplicationMgr");
109 m_propertyMgr->declareProperty(
"AppVersion", m_appVersion =
"");
111 m_propertyMgr->declareProperty(
"AuditTools", m_auditTools =
false);
112 m_propertyMgr->declareProperty(
"AuditServices", m_auditSvcs =
false);
113 m_propertyMgr->declareProperty(
"AuditAlgorithms", m_auditAlgs =
false);
115 m_propertyMgr->declareProperty(
"ActivateHistory", m_actHistory =
false);
116 m_propertyMgr->declareProperty(
"StatusCodeCheck", m_codeCheck =
false);
118 m_propertyMgr->declareProperty(
"Environment", m_environment);
121 m_propertyMgr->declareProperty(
"InitializationLoopCheck", m_loopCheck =
true)
123 svcManager()->setLoopCheckEnabled(m_loopCheck);
126 m_propertyMgr->declareProperty
128 m_propertiesPrint =
false,
129 "Flag to activate the printout of properties" );
131 m_propertyMgr->declareProperty(
"ReflexPluginDebugLevel", m_reflexDebugLevel = 0 );
133 m_propertyMgr->declareProperty(
"StopOnSignal", m_stopOnSignal =
false,
134 "Flag to enable/disable the signal handler that schedule a stop of the event loop");
136 m_propertyMgr->declareProperty(
"StalledEventMonitoring", m_stalledEventMonitoring =
false,
137 "Flag to enable/disable the monitoring and reporting of stalled events");
140 "Return code of the application. Set internally in case of error conditions.");
142 m_propertyMgr->declareProperty(
"AlgTypeAliases", algMgr->
typeAliases(),
143 "Aliases of algorithm types, to replace an algorithm type for every instance");
152 m_svcMapping.push_back(
"EvtDataSvc/EventDataSvc");
153 m_svcMapping.push_back(
"DetDataSvc/DetectorDataSvc");
154 m_svcMapping.push_back(
"HistogramSvc/HistogramDataSvc");
155 m_svcMapping.push_back(
"HbookCnv::PersSvc/HbookHistSvc");
156 m_svcMapping.push_back(
"RootHistCnv::PersSvc/RootHistSvc");
157 m_svcMapping.push_back(
"EvtPersistencySvc/EventPersistencySvc");
158 m_svcMapping.push_back(
"DetPersistencySvc/DetectorPersistencySvc");
159 m_svcMapping.push_back(
"HistogramPersistencySvc/HistogramPersistencySvc");
187 {
return serviceLocator()-> queryInterface ( iid , ppvi ) ; }
189 {
return svcManager() -> queryInterface ( iid , ppvi ) ; }
191 {
return algManager() -> queryInterface ( iid , ppvi ) ; }
193 {
return m_classManager -> queryInterface ( iid , ppvi ) ; }
195 {
return m_propertyMgr -> queryInterface ( iid , ppvi ) ; }
198 *ppvi =
reinterpret_cast<void*
>(m_messageSvc.get());
200 m_messageSvc->addRef();
228 fatal() <<
"Error creating JobOptionsSvc" <<
endmsg;
233 if ( !jobOptsIProp.
isValid() ) {
234 fatal() <<
"Error locating JobOptionsSvc" <<
endmsg;
239 fatal() <<
"Error setting TYPE option in JobOptionsSvc" <<
endmsg;
246 fatal() <<
"Error setting PATH option in JobOptionsSvc" <<
endmsg;
250 else if (
isEnvSet(
"JOBOPTPATH") ) {
255 <<
"Error setting PATH option in JobOptionsSvc from env"
262 "../options/job.opts"));
265 <<
"Error setting PATH option in JobOptionsSvc to default"
270 jobOptsIProp->release();
276 msgSvcIProp->release();
278 sc = jobsvc->sysInitialize();
280 fatal() <<
"Error initializing JobOptionsSvc" <<
endmsg;
283 sc = msgsvc->sysInitialize();
285 fatal() <<
"Error initializing MessageSvc" <<
endmsg;
292 fatal() <<
"Error retrieving MessageSvc." <<
endmsg;
297 fatal() <<
"Error retrieving JobOptionsSvc." <<
endmsg;
316 <<
"configure: Invalid state \"" <<
m_state <<
"\"" <<
endmsg;
337 log <<
MSG::WARNING <<
"Problems getting my properties from JobOptionsSvc"
349 <<
"=================================================================="
350 <<
"=================================================================="
361 <<
"v" << GAUDICORESVC_MAJOR_VERSION
362 <<
"r" << GAUDICORESVC_MINOR_VERSION
363 #if GAUDICORESVC_PATCH_VERSION
364 <<
"p" << GAUDICORESVC_PATCH_VERSION
375 <<
"=================================================================="
376 <<
"=================================================================="
386 <<
"List of ALL properties of "
388 <<
" #properties = " << properties.size() <<
endmsg ;
389 for ( Properties::const_iterator property = properties.begin() ;
390 properties.end() != property ; ++property )
391 { log <<
"Property ['Name': Value] = " << ( **property) <<
endmsg ; }
399 log <<
MSG::FATAL <<
"Error adding StatusCodeSvc for multiple threads" <<
endmsg;
412 const MSG::Level lvl = (!old.empty() && (old !=
"UNKNOWN" ))
416 log << lvl <<
"Setting " << name <<
" = " << value <<
endmsg;
423 Gaudi::Utils::TypeNameString
itm(*j);
425 log <<
MSG::ERROR <<
"configure: declaring svc type:'" << *j <<
"' failed." <<
endmsg;
430 Gaudi::Utils::TypeNameString
itm(*j);
432 log <<
MSG::ERROR <<
"configure: declaring svc type:'" << *j <<
"' failed." <<
endmsg;
449 log <<
MSG::ERROR <<
"Failure during external service association" <<
endmsg;
455 log <<
MSG::ERROR <<
"Failure during multi thread service creation"
471 sc =
addMultiSvc(evtloop_item, ServiceManager::DEFAULT_SVC_PRIORITY*10);
489 <<
"\n Check option ApplicationMgr." <<
s_eventloop
490 <<
"\n No events will be processed." <<
endmsg;
516 log <<
MSG::FATAL <<
"Error adding HistorySvc for multiple threads"
523 log <<
MSG::INFO <<
"Application Manager Configured successfully" <<
endmsg;
540 std::string svcname(
"Gaudi::Utils::StopSignalHandler");
543 log <<
MSG::INFO <<
"Cannot instantiate " << svcname <<
"signals will be ignored" <<
endmsg;
552 log <<
MSG::INFO <<
"Cannot instantiate " << svcname <<
"signals will be ignored" <<
endmsg;
562 <<
"initialize: Invalid state \"" <<
m_state <<
"\"" <<
endmsg;
576 log <<
MSG::INFO <<
"Application Manager Initialized successfully" <<
endmsg;
610 log <<
MSG::INFO <<
"Application Manager Started successfully" <<
endmsg;
628 log <<
MSG::FATAL <<
"No event processing manager specified. Check option:"
667 log <<
MSG::INFO <<
"Application Manager Stopped successfully" <<
endmsg;
714 log <<
MSG::INFO <<
"Application Manager Finalized successfully" <<
endmsg;
742 log <<
MSG::INFO <<
"Application Manager Terminated successfully" <<
endmsg;
744 log <<
MSG::INFO <<
"Application Manager Terminated successfully with a user requested ScheduledStop" <<
endmsg;
765 log <<
MSG::ERROR <<
"Could not get the IService interface of the MessageSvc" <<
endmsg;
767 svc->sysFinalize().ignore();
773 log <<
MSG::ERROR <<
"Could not get the IService interface of the JobOptionsSvc" <<
endmsg;
775 svc->sysFinalize().ignore();
861 log <<
MSG::FATAL <<
"Application execution failed. Ending the job."
865 log <<
MSG::FATAL <<
"Application has no runable object. Check option:"
949 throw GaudiException(
"Cannot reinitialize application if not INITIALIZED or RUNNING",
1012 props->setProperty( p ).ignore();
1023 "MinimalEventLoopMgr::createSvcNameListHandler",
1036 Gaudi::Utils::TypeNameString
item(*it++);
1037 if( (result =
svcManager()->addService(item, ServiceManager::DEFAULT_SVC_PRIORITY) ).isFailure()) {
1039 log <<
MSG::ERROR <<
"decodeCreateSvcNameList: Cannot create service "
1040 << item.type() <<
"/" << item.name() <<
endmsg;
1044 log <<
MSG::DEBUG <<
"decodeCreateSvcNameList: Created service "
1045 << item.type() <<
"/" << item.name() <<
endmsg;
1058 "MinimalEventLoopMgr::extSvcNameListHandler",
1074 Gaudi::Utils::TypeNameString
item(*it++);
1076 if ( (result =
svcManager()->addService(item, ServiceManager::DEFAULT_SVC_PRIORITY)).isFailure()) {
1078 log <<
MSG::ERROR <<
"decodeExtSvcNameList: Cannot create service "
1079 << item.type() <<
"/" << item.name() <<
endmsg;
1082 if( ( result =
svcManager()->declareSvcType(item.name(),
1083 item.type()) ).isFailure()) {
1085 log <<
MSG::ERROR <<
"decodeExtSvcNameList: Cannot declare service "
1086 << item.type() <<
"/" << item.name() <<
endmsg;
1099 "MinimalEventLoopMgr::multiThreadSvcNameListHandler",
1113 it != theNames.
end();
1115 Gaudi::Utils::TypeNameString
item(*it);
1116 result =
addMultiSvc(item, ServiceManager::DEFAULT_SVC_PRIORITY);
1121 <<
"decodeMultiThreadSvcNameList: Cannot create service "
1122 << item.type() <<
"/" << item.name() <<
endmsg;
1127 <<
"decodeMultiThreadSvcNameList: created service "
1128 << item.type() <<
"/" << item.name() <<
endmsg;
1143 result =
svcManager()->declareSvcType(name, type);
1145 log <<
MSG::ERROR <<
"declareMultiSvcType: Cannot declare service "
1146 << type <<
"/" << name <<
endmsg;
1149 log <<
MSG::VERBOSE <<
"declareMultiSvcType: declared service "
1150 << type <<
"/" << name <<
endmsg;
1155 result =
svcManager()->declareSvcType(thrName, type);
1157 log <<
MSG::ERROR <<
"declareMultiSvcType: Cannot declare service "
1158 << type <<
"/" << thrName <<
endmsg;
1161 log <<
MSG::VERBOSE <<
"declareMultiSvcType: declared service "
1162 << type <<
"/" << thrName <<
endmsg;
1173 using Gaudi::Utils::TypeNameString;
1177 result =
svcManager()->addService(typeName, prio);
1180 log <<
MSG::ERROR <<
"addMultiSvc: Cannot add service "
1181 << typeName.type() <<
"/" << typeName.name() <<
endmsg;
1185 << typeName.type() <<
"/" << typeName.name() <<
endmsg;
1191 result =
svcManager()->addService(TypeNameString(thrName, type), prio);
1192 if( result.isFailure() ) {
1193 log <<
MSG::ERROR <<
"addMultiSvc: Cannot add service "
1194 << type <<
"/" << thrName <<
endmsg;
1198 << type <<
"/" << thrName <<
endmsg;
1211 "MinimalEventLoopMgr::dllNameListHandler",
1230 if ( 0 == dllInList[*it] ) {
1232 }
else { ++duplicateList[*it]; }
1239 log <<
MSG::DEBUG <<
"Removed duplicate entries for modules : ";
1241 it != duplicateList.
end(); ++it ) {
1242 log << it->first <<
"(" << 1+it->second <<
")";
1243 if ( it != --duplicateList.
end() ) log <<
", ";
1257 for (it = theNames.
begin(); it != theNames.
end(); it++) {
1272 if ( !successNames.
empty() ) {
1273 log <<
MSG::INFO <<
"Successfully loaded modules : ";
1274 for (it = successNames.
begin(); it != successNames.
end(); it++) {
1276 if( (it+1) != successNames.
end()) log <<
", ";
1285 for (it = failNames.
begin(); it != failNames.
end(); it++) {
1287 if( (it+1) != failNames.
end()) log <<
", ";
1302 <<
"Updating ROOT::Reflex::PluginService::SetDebug(level) to level="