|
Gaudi Framework, version v21r8 |
| Home | Generated: 17 Mar 2010 |
#include <ApplicationMgr.h>


Public Types | |
| typedef std::list< std::pair < IService *, int > > | ListSvc |
| typedef std::list< std::string > | ListName |
| typedef std::vector< std::string > | VectorName |
Public Member Functions | |
| ApplicationMgr (IInterface *=0) | |
| virtual | ~ApplicationMgr () |
| virtual StatusCode | queryInterface (const InterfaceID &iid, void **pinterface) |
| virtual StatusCode | run () |
| virtual StatusCode | configure () |
| virtual StatusCode | terminate () |
| virtual StatusCode | initialize () |
| virtual StatusCode | start () |
| virtual StatusCode | stop () |
| virtual StatusCode | finalize () |
| virtual StatusCode | nextEvent (int maxevt) |
| virtual const std::string & | name () const |
| This is needed to avoid ambiguous calls to name(). | |
| virtual StatusCode | executeEvent (void *par) |
| implementation of IEventProcessor::executeEvent(void*) | |
| virtual StatusCode | executeRun (int evtmax) |
| implementation of IEventProcessor::executeRun(int) | |
| virtual StatusCode | stopRun () |
| implementation of IEventProcessor::stopRun() | |
| virtual Gaudi::StateMachine::State | FSMState () const |
| virtual Gaudi::StateMachine::State | targetFSMState () const |
| virtual StatusCode | reinitialize () |
| virtual StatusCode | restart () |
| virtual StatusCode | sysInitialize () |
| virtual StatusCode | sysStart () |
| virtual StatusCode | sysStop () |
| virtual StatusCode | sysFinalize () |
| virtual StatusCode | sysReinitialize () |
| virtual StatusCode | sysRestart () |
| void | SIGoHandler (Property &theProp) |
| void | SIExitHandler (Property &theProp) |
| template<class I> | |
| SmartIF< IComponentManager > & | getManager () |
| SmartIF< ISvcManager > & | svcManager () |
| SmartIF< IAlgManager > & | algManager () |
| virtual SmartIF< ISvcLocator > & | serviceLocator () const |
| Needed to locate the message service. | |
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 | reflexDebugPropertyHandler (Property &theProp) |
| void | initLoopCheckHndlr (Property &) |
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. | |
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 | |
| StatusCode | addMultiSvc (const Gaudi::Utils::TypeNameString &typeName, int prio) |
| add one or more copies of svc type/name as determined by NoOfThreads | |
| void | setServiceManager (ISvcManager *) |
| StatusCode | i_startup () |
| Internal startup routine. | |
| StatusCode | GoToState (Gaudi::StateMachine::State state, bool ignoreFailures=false) |
| Reach a state from current state (whichever it is) going through the correct transitions. | |
Protected Attributes | |
| ManagersMap | m_managers |
| Map of known component managers. | |
| StringArrayProperty | m_declaredManagers |
| Property to declare the list of known managers. | |
| SmartIF< ISvcManager > | m_svcManager |
| Cached pointer to the manager of services. | |
| SmartIF< IAlgManager > | m_algManager |
| Cached pointer to the manager of algorithms. | |
| DLLClassManager * | m_classManager |
| Reference to the class manager. | |
| SmartIF< ISvcLocator > | m_svcLocator |
| Reference to its own service locator. | |
| IntegerProperty | m_SIGo |
| For SI's "Go" command via callback. | |
| IntegerProperty | m_SIExit |
| For SI's "Exit" command via callback. | |
| StringArrayProperty | m_topAlgNameList |
| List of top level algorithms names. | |
| StringArrayProperty | m_outStreamNameList |
| List of output stream names. | |
| StringProperty | m_outStreamType |
| Output stream type (obsolete?). | |
| StringProperty | m_messageSvcType |
| MessageSvc type. | |
| StringProperty | m_jobOptionsSvcType |
| JobOptionsSvc type. | |
| ListSvc | m_topSvcList |
| List of top level services. | |
| ListName | m_topSvcNameList |
| List of top level services names. | |
| std::string | m_name |
| Name. | |
| Gaudi::StateMachine::State | m_state |
| Internal State. | |
| Gaudi::StateMachine::State | m_targetState |
| Internal State. | |
| VectorName | m_defServices |
| Vector default services names. | |
| VectorName | m_svcMapping |
| Default mapping of services. | |
| VectorName | m_svcOptMapping |
| Default mapping of services. | |
| PropertyMgr * | m_propertyMgr |
| Reference to Property Manager. | |
| SmartIF< IMessageSvc > | m_messageSvc |
| Reference to the message service. | |
| SmartIF< IRunable > | m_runable |
| Reference to the runable object. | |
| SmartIF< IEventProcessor > | m_processingMgr |
| Reference to processing manager object. | |
| SmartIF< IJobOptionsSvc > | m_jobOptionsSvc |
| Reference to JobOption service. | |
| int | m_evtMax |
| Number of events to be processed. | |
| StringArrayProperty | m_extSvcNameList |
| List of external services names. | |
| BooleanProperty | m_extSvcCreates |
| LHCb or ATLAS defn of "ExtSvc". | |
| StringArrayProperty | m_multiThreadSvcNameList |
| List of external services names for which we want a copy per evt thread. | |
| int | m_noOfEvtThreads |
| no of multiThreadSvc copies | |
| StringArrayProperty | m_dllNameList |
| List of DDL's names. | |
| std::string | m_jobOptionsType |
| Source type (e.g. dbase, file...). | |
| std::string | m_jobOptionsPath |
| The "file" to look for properties. | |
| std::string | m_runableType |
| Runable type. | |
| std::string | m_eventLoopMgr |
| Processing manager type. | |
| std::string | m_evtsel |
| Event selection. | |
| std::string | m_histPersName |
| CGL: Name of the Hist Pers Svc. | |
| int | m_outputLevel |
| Message output level. | |
| std::string | m_appName |
| The name of the application. | |
| std::string | m_appVersion |
| The version of the application. | |
| bool | m_actHistory |
| Activate HistorySvc. | |
| bool | m_codeCheck |
| Activate StatusCode checking. | |
| IntegerProperty | m_reflexDebugLevel |
| Debug level for the reflex plugin system. | |
| StringArrayProperty | m_createSvcNameList |
| BooleanProperty | m_auditTools |
| Defaults for auditors. | |
| BooleanProperty | m_auditSvcs |
| BooleanProperty | m_auditAlgs |
| std::map< std::string, std::string > | m_environment |
| Environment variables to set. | |
| BooleanProperty | m_loopCheck |
| For ServiceMgr initialization loop checking. | |
| bool | m_propertiesPrint |
| flag to activate the printout of properties | |
Private Types | |
| typedef CommonMessaging < implements4< IAppMgrUI, IEventProcessor, IService, IStateful > > | base_class |
| Typedef to this class. | |
Private Attributes | |
| std::vector< std::string > | m_okDlls |
| names of successfully loaded dlls | |
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.).
Definition at line 47 of file ApplicationMgr.h.
typedef CommonMessaging<implements4<IAppMgrUI, IEventProcessor, IService, IStateful> > ApplicationMgr::base_class [private] |
Typedef to this class.
Reimplemented from CommonMessaging< implements4< IAppMgrUI, IEventProcessor, IService, IStateful > >.
Definition at line 54 of file ApplicationMgr.h.
| typedef std::list<std::pair<IService*,int> > ApplicationMgr::ListSvc |
Definition at line 56 of file ApplicationMgr.h.
| typedef std::list<std::string> ApplicationMgr::ListName |
Definition at line 57 of file ApplicationMgr.h.
Definition at line 58 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 184 of file ApplicationMgr.h.
| ApplicationMgr::ApplicationMgr | ( | IInterface * | = 0 |
) |
Definition at line 44 of file ApplicationMgr.cpp.
00044 : base_class() { 00045 // IInterface initialization 00046 addRef(); // Initial count set to 1 00047 00048 // Initialize two basic services: messagesvc & joboptions 00049 m_messageSvc = 0; 00050 m_jobOptionsSvc = 0; 00051 00052 // Instantiate component managers 00053 m_managers[IService::interfaceID().id()] = new ServiceManager(this); 00054 m_managers[IAlgorithm::interfaceID().id()] = new AlgorithmManager(this); 00055 00056 m_svcLocator = svcManager(); 00057 00058 // Instantiate internal services 00059 // SvcLocator/Factory HAS to be already instantiated 00060 m_classManager = new DLLClassManager(this); 00061 m_propertyMgr = new PropertyMgr(this); 00062 00063 m_name = "ApplicationMgr"; 00064 m_state = Gaudi::StateMachine::OFFLINE; 00065 m_targetState = Gaudi::StateMachine::OFFLINE; 00066 00067 m_propertyMgr->declareProperty("Go", m_SIGo = 0 ); 00068 m_propertyMgr->declareProperty("Exit", m_SIExit = 0 ); 00069 m_propertyMgr->declareProperty("Dlls", m_dllNameList ); 00070 m_propertyMgr->declareProperty("ExtSvc", m_extSvcNameList ); 00071 m_propertyMgr->declareProperty("CreateSvc", m_createSvcNameList ); 00072 m_propertyMgr->declareProperty("ExtSvcCreates", m_extSvcCreates=true ); 00073 00074 m_propertyMgr->declareProperty("SvcMapping", m_svcMapping ); 00075 m_propertyMgr->declareProperty("SvcOptMapping", m_svcOptMapping ); 00076 00077 m_propertyMgr->declareProperty("TopAlg", m_topAlgNameList ); 00078 m_propertyMgr->declareProperty("OutStream", m_outStreamNameList ); 00079 m_propertyMgr->declareProperty("OutStreamType", m_outStreamType = "OutputStream" ); 00080 m_propertyMgr->declareProperty("MessageSvcType",m_messageSvcType= "MessageSvc" ); 00081 m_propertyMgr->declareProperty("JobOptionsSvcType", 00082 m_jobOptionsSvcType = "JobOptionsSvc" ); 00083 m_propertyMgr->declareProperty( s_runable, m_runableType = "AppMgrRunable"); 00084 m_propertyMgr->declareProperty( s_eventloop, m_eventLoopMgr = "EventLoopMgr"); 00085 00086 m_propertyMgr->declareProperty("HistogramPersistency", m_histPersName="NONE"); 00087 00088 // Declare Job Options Service properties and set default 00089 m_propertyMgr->declareProperty("JobOptionsType", m_jobOptionsType = "FILE"); 00090 m_propertyMgr->declareProperty("JobOptionsPath", m_jobOptionsPath = ""); 00091 m_propertyMgr->declareProperty("EvtMax", m_evtMax = -1); 00092 m_propertyMgr->declareProperty("EvtSel", m_evtsel ); 00093 m_propertyMgr->declareProperty("OutputLevel", m_outputLevel = MSG::INFO); 00094 00095 m_propertyMgr->declareProperty("MultiThreadExtSvc", m_multiThreadSvcNameList); 00096 m_propertyMgr->declareProperty("NoOfThreads", m_noOfEvtThreads = 0); 00097 m_propertyMgr->declareProperty("AppName", m_appName = "ApplicationMgr"); 00098 m_propertyMgr->declareProperty("AppVersion", m_appVersion = ""); 00099 00100 m_propertyMgr->declareProperty("AuditTools", m_auditTools = false); 00101 m_propertyMgr->declareProperty("AuditServices", m_auditSvcs = false); 00102 m_propertyMgr->declareProperty("AuditAlgorithms", m_auditAlgs = false); 00103 00104 m_propertyMgr->declareProperty("ActivateHistory", m_actHistory = false); 00105 m_propertyMgr->declareProperty("StatusCodeCheck", m_codeCheck = false); 00106 00107 m_propertyMgr->declareProperty("Environment", m_environment); 00108 00109 // ServiceMgr Initialization loop checking 00110 m_propertyMgr->declareProperty("InitializationLoopCheck", m_loopCheck = true) 00111 ->declareUpdateHandler(&ApplicationMgr::initLoopCheckHndlr, this); 00112 svcManager()->setLoopCheckEnabled(m_loopCheck); 00113 00114 // Flag to activate the printout of properties 00115 m_propertyMgr->declareProperty 00116 ( "PropertiesPrint", 00117 m_propertiesPrint = false, 00118 "Flag to activate the printout of properties" ); 00119 00120 m_propertyMgr->declareProperty("ReflexPluginDebugLevel", m_reflexDebugLevel = 0 ); 00121 00122 // Add action handlers to the appropriate properties 00123 m_SIGo.declareUpdateHandler ( &ApplicationMgr::SIGoHandler , this ); 00124 m_SIExit.declareUpdateHandler( &ApplicationMgr::SIExitHandler , this ); 00125 m_topAlgNameList.declareUpdateHandler(&ApplicationMgr::evtLoopPropertyHandler, this); 00126 m_outStreamNameList.declareUpdateHandler(&ApplicationMgr::evtLoopPropertyHandler, this); 00127 m_outStreamType.declareUpdateHandler(&ApplicationMgr::evtLoopPropertyHandler, this); 00128 m_reflexDebugLevel.declareUpdateHandler(&ApplicationMgr::reflexDebugPropertyHandler, this); 00129 m_svcMapping.push_back("EvtDataSvc/EventDataSvc"); 00130 m_svcMapping.push_back("DetDataSvc/DetectorDataSvc"); 00131 m_svcMapping.push_back("HistogramSvc/HistogramDataSvc"); 00132 m_svcMapping.push_back("HbookCnv::PersSvc/HbookHistSvc"); 00133 m_svcMapping.push_back("RootHistCnv::PersSvc/RootHistSvc"); 00134 m_svcMapping.push_back("EvtPersistencySvc/EventPersistencySvc"); 00135 m_svcMapping.push_back("DetPersistencySvc/DetectorPersistencySvc"); 00136 m_svcMapping.push_back("HistogramPersistencySvc/HistogramPersistencySvc"); 00137 }
| ApplicationMgr::~ApplicationMgr | ( | ) | [virtual] |
Definition at line 142 of file ApplicationMgr.cpp.
00142 { 00143 if( m_classManager ) m_classManager->release(); 00144 if( m_propertyMgr ) m_propertyMgr->release(); 00145 if( m_messageSvc ) m_messageSvc->release(); 00146 if( m_jobOptionsSvc ) m_jobOptionsSvc->release(); 00147 }
| StatusCode ApplicationMgr::queryInterface | ( | const InterfaceID & | iid, | |
| void ** | pinterface | |||
| ) | [virtual] |
Definition at line 153 of file ApplicationMgr.cpp.
00155 { 00156 if ( 0 == ppvi ) { return StatusCode::FAILURE ; } 00157 00158 // try to find own/direct interfaces: 00159 StatusCode sc = base_class::queryInterface(iid,ppvi); 00160 if (sc.isSuccess()) return sc; 00161 00162 // find indirect interfaces : 00163 if ( ISvcLocator ::interfaceID() . versionMatch ( iid ) ) 00164 { return serviceLocator()-> queryInterface ( iid , ppvi ) ; } 00165 else if ( ISvcManager ::interfaceID() . versionMatch ( iid ) ) 00166 { return svcManager() -> queryInterface ( iid , ppvi ) ; } 00167 else if ( IAlgManager ::interfaceID() . versionMatch ( iid ) ) 00168 { return algManager() -> queryInterface ( iid , ppvi ) ; } 00169 else if ( IClassManager ::interfaceID() . versionMatch ( iid ) ) 00170 { return m_classManager -> queryInterface ( iid , ppvi ) ; } 00171 else if ( IProperty ::interfaceID() . versionMatch ( iid ) ) 00172 { return m_propertyMgr -> queryInterface ( iid , ppvi ) ; } 00173 else if ( IMessageSvc ::interfaceID() . versionMatch ( iid ) ) 00174 { 00175 *ppvi = reinterpret_cast<void*>(m_messageSvc.get()); 00176 if (m_messageSvc) { 00177 m_messageSvc->addRef(); 00178 } 00179 // Note that 0 can be a valid IMessageSvc pointer value (when used for 00180 // MsgStream). 00181 return StatusCode::SUCCESS; 00182 } 00183 *ppvi = 0; 00184 return StatusCode::FAILURE; 00185 }
| StatusCode ApplicationMgr::run | ( | ) | [virtual] |
Definition at line 788 of file ApplicationMgr.cpp.
00788 { 00789 StatusCode sc = StatusCode::SUCCESS; 00790 00791 sc = GoToState(Gaudi::StateMachine::RUNNING); 00792 if ( sc.isSuccess() ) { 00793 MsgStream log(m_messageSvc, name()); 00794 if ( m_runable != 0 ) { // loop over the events 00795 sc = m_runable->run(); 00796 if ( !sc.isSuccess() ) { 00797 log << MSG::FATAL << "Application execution failed. Ending the job." 00798 << endmsg; 00799 } 00800 } else { 00801 log << MSG::FATAL << "Application has no runable object. Check option:" 00802 << s_runable << endmsg; 00803 } 00804 } 00805 if (sc.isSuccess()) { // try to close cleanly 00806 sc = GoToState(Gaudi::StateMachine::OFFLINE); 00807 } 00808 // either the runable failed of the stut-down 00809 if (sc.isFailure()) { // try to close anyway (but keep the StatusCode unchanged) 00810 GoToState(Gaudi::StateMachine::OFFLINE,true).ignore(); 00811 } 00812 return sc; 00813 }
| StatusCode ApplicationMgr::configure | ( | ) | [virtual] |
Definition at line 284 of file ApplicationMgr.cpp.
00284 { 00285 // Check if the state is compatible with the transition 00286 MsgStream tlog( m_messageSvc, name() ); 00287 if( Gaudi::StateMachine::CONFIGURED == m_state ) { 00288 tlog << MSG::INFO << "Already Configured" << endmsg; 00289 return StatusCode::SUCCESS; 00290 } 00291 else if( Gaudi::StateMachine::OFFLINE != m_state ) { 00292 tlog << MSG::FATAL 00293 << "configure: Invalid state \"" << m_state << "\"" << endmsg; 00294 return StatusCode::FAILURE; 00295 } 00296 m_targetState = Gaudi::StateMachine::CONFIGURED; 00297 00298 StatusCode sc; 00299 sc = i_startup(); 00300 if ( !sc.isSuccess() ) { 00301 return sc; 00302 } 00303 00304 MsgStream log( m_messageSvc, name() ); 00305 00306 // Get my own options using the Job options service 00307 log << MSG::DEBUG << "Getting my own properties" << endmsg; 00308 sc = m_jobOptionsSvc->setMyProperties( name(), m_propertyMgr ); 00309 if( !sc.isSuccess() ) { 00310 log << MSG::WARNING << "Problems getting my properties from JobOptionsSvc" 00311 << endmsg; 00312 return sc; 00313 } 00314 00315 // Check current outputLevel to eventually inform the MessageSvc 00316 if( m_outputLevel != MSG::NIL && !m_appName.empty() ) { 00317 assert(m_messageSvc != 0); 00318 m_messageSvc->setOutputLevel( name(), m_outputLevel ); 00319 // Print a welcome message 00320 log << MSG::ALWAYS 00321 << std::endl 00322 << "==================================================================" 00323 << "==================================================================" 00324 << std::endl 00325 << " " 00326 << " Welcome to " << m_appName; 00327 00328 if( "" != m_appVersion ) { 00329 log << MSG::ALWAYS << " version " << m_appVersion; 00330 } 00331 else { 00332 log << MSG::ALWAYS << " $Revision: 1.77 $"; 00333 } 00334 00335 // Add the host name and current time to the message 00336 time_t t; 00337 std::time( &t ); 00338 tm* localt = std::localtime( &t ); 00339 00340 log << MSG::ALWAYS 00341 << std::endl 00342 << " " 00343 << " running on " << System::hostName() 00344 << " on " << std::asctime( localt ) 00345 << "==================================================================" 00346 << "==================================================================" 00347 << endmsg; 00348 } 00349 00350 // print all own properties if the options "PropertiesPrint" is set to true 00351 if ( m_propertiesPrint ) 00352 { 00353 typedef std::vector<Property*> Properties; 00354 const Properties& properties = m_propertyMgr->getProperties() ; 00355 log << MSG::ALWAYS 00356 << "List of ALL properties of " 00357 << System::typeinfoName ( typeid( *this ) ) << "/" << this->name() 00358 << " #properties = " << properties.size() << endmsg ; 00359 for ( Properties::const_iterator property = properties.begin() ; 00360 properties.end() != property ; ++property ) 00361 { log << "Property ['Name': Value] = " << ( **property) << endmsg ; } 00362 } 00363 00364 // Check if StatusCode need to be checked 00365 if (m_codeCheck) { 00366 StatusCode::enableChecking(); 00367 sc = addMultiSvc("StatusCodeSvc", -9999); 00368 if ( sc.isFailure() ) { 00369 log << MSG::FATAL << "Error adding StatusCodeSvc for multiple threads" << endmsg; 00370 return StatusCode::FAILURE; 00371 } 00372 } else { 00373 StatusCode::disableChecking(); 00374 } 00375 00376 // set the requested environment variables 00377 std::map<std::string,std::string>::iterator var; 00378 for ( var = m_environment.begin(); var != m_environment.end(); ++var ) { 00379 const std::string &name = var->first; 00380 const std::string &value = var->second; 00381 std::string old = System::getEnv(name.c_str()); 00382 if ( !old.empty() && (old != "UNKNOWN" )) { 00383 log << MSG::WARNING; 00384 } 00385 else { 00386 log << MSG::DEBUG; 00387 } 00388 log << "Setting " << name << " = " << value << endmsg; 00389 System::setEnv(name,value); 00390 } 00391 00392 //Declare Service Types 00393 VectorName::const_iterator j; 00394 for(j=m_svcMapping.begin(); j != m_svcMapping.end(); ++j) { 00395 Gaudi::Utils::TypeNameString itm(*j); 00396 if ( declareMultiSvcType(itm.name(), itm.type()).isFailure() ) { 00397 log << MSG::ERROR << "configure: declaring svc type:'" << *j << "' failed." << endmsg; 00398 return StatusCode::FAILURE; 00399 } 00400 } 00401 for(j=m_svcOptMapping.begin(); j != m_svcOptMapping.end(); ++j) { 00402 Gaudi::Utils::TypeNameString itm(*j); 00403 if ( declareMultiSvcType(itm.name(), itm.type()).isFailure() ) { 00404 log << MSG::ERROR << "configure: declaring svc type:'" << *j << "' failed." << endmsg; 00405 return StatusCode::FAILURE; 00406 } 00407 } 00408 00409 //-------------------------------------------------------------------------- 00410 // Declare other Services and Algorithms by loading DLL's 00411 sc = decodeDllNameList( ); 00412 if ( sc.isFailure( ) ) { 00413 log << MSG::ERROR << "Failure loading declared DLL's" << endmsg; 00414 return sc; 00415 } 00416 00417 //-------------------------------------------------------------------------- 00418 // Deal with the services explicitely declared by the user. 00419 sc = decodeExtSvcNameList(); 00420 if ( sc.isFailure( ) ) { 00421 log << MSG::ERROR << "Failure during external service association" << endmsg; 00422 return sc; 00423 } 00424 00425 sc = decodeMultiThreadSvcNameList( ); 00426 if ( sc.isFailure( ) ) { 00427 log << MSG::ERROR << "Failure during multi thread service creation" 00428 << endmsg; 00429 return sc; 00430 } 00431 00432 sc = decodeCreateSvcNameList(); 00433 if ( sc.isFailure( ) ) { 00434 log << MSG::ERROR << "Failure during external service creation" << endmsg; 00435 return sc; 00436 } 00437 00438 00439 //-------------------------------------------------------------------------- 00440 // Retrieve intrinsic services. If needed configure them. 00441 //-------------------------------------------------------------------------- 00442 Gaudi::Utils::TypeNameString evtloop_item(m_eventLoopMgr); 00443 sc = addMultiSvc(evtloop_item, 100); 00444 if( !sc.isSuccess() ) { 00445 log << MSG::FATAL << "Error adding :" << m_eventLoopMgr << endmsg; 00446 return sc; 00447 } 00448 00449 if (m_noOfEvtThreads == 0) { 00450 m_runable = m_svcLocator->service(m_runableType); 00451 if( !m_runable.isValid() ) { 00452 log << MSG::FATAL 00453 << "Error retrieving Runable:" << m_runableType 00454 << "\n Check option ApplicationMgr." << s_runable << endmsg; 00455 return sc; 00456 } 00457 m_processingMgr = m_svcLocator->service(evtloop_item); 00458 if( !m_processingMgr.isValid() ) { 00459 log << MSG::FATAL 00460 << "Error retrieving Processing manager:" << m_eventLoopMgr 00461 << "\n Check option ApplicationMgr." << s_eventloop 00462 << "\n No events will be processed." << endmsg; 00463 return sc; 00464 } 00465 } 00466 00467 // Establish Update Handlers for ExtSvc and DLLs Properties 00468 m_extSvcNameList.declareUpdateHandler (&ApplicationMgr::extSvcNameListHandler, 00469 this); 00470 m_createSvcNameList.declareUpdateHandler (&ApplicationMgr::createSvcNameListHandler, 00471 this); 00472 m_multiThreadSvcNameList.declareUpdateHandler 00473 (&ApplicationMgr::multiThreadSvcNameListHandler, this); 00474 m_dllNameList.declareUpdateHandler (&ApplicationMgr::dllNameListHandler, 00475 this ); 00476 00477 if (m_actHistory) { 00478 // Create HistorySvc with a priority to ensure it's initialized last, finalized first 00479 sc = svcManager()->addService("HistorySvc",std::numeric_limits<int>::max()); 00480 if ( sc.isFailure() ) { 00481 log << MSG::FATAL << "Error adding HistorySvc" << endmsg; 00482 return StatusCode::FAILURE; 00483 } 00484 00485 if (m_noOfEvtThreads > 0) { 00486 sc = addMultiSvc("HistorySvc",std::numeric_limits<int>::max()); 00487 if ( sc.isFailure() ) { 00488 log << MSG::FATAL << "Error adding HistorySvc for multiple threads" 00489 << endmsg; 00490 return StatusCode::FAILURE; 00491 } 00492 } 00493 } 00494 00495 log << MSG::INFO << "Application Manager Configured successfully" << endmsg; 00496 m_state = m_targetState; 00497 return StatusCode::SUCCESS; 00498 }
| StatusCode ApplicationMgr::terminate | ( | ) | [virtual] |
Definition at line 667 of file ApplicationMgr.cpp.
00667 { 00668 MsgStream log( m_messageSvc, name() ); 00669 00670 if( m_state == Gaudi::StateMachine::OFFLINE ) { 00671 log << MSG::INFO << "Already Offline" << endmsg; 00672 return StatusCode::SUCCESS; 00673 } 00674 else if( m_state != Gaudi::StateMachine::CONFIGURED ) { 00675 log << MSG::FATAL << "terminate: Invalid state \"" << m_state << "\"" 00676 << endmsg; 00677 return StatusCode::FAILURE; 00678 } 00679 // release all Services 00680 m_targetState = Gaudi::StateMachine::OFFLINE; 00681 00682 00683 log << MSG::INFO << "Application Manager Terminated successfully" << endmsg; 00684 00685 { // Force a disable the auditing of finalize for MessageSvc 00686 SmartIF<IProperty> prop(m_messageSvc); 00687 if (prop.isValid()) { 00688 prop->setProperty(BooleanProperty("AuditFinalize", false)); 00689 } 00690 } 00691 { // Force a disable the auditing of finalize for JobOptionsSvc 00692 SmartIF<IProperty> prop(m_jobOptionsSvc); 00693 if (prop.isValid()) { 00694 prop->setProperty(BooleanProperty("AuditFinalize", false)); 00695 } 00696 } 00697 00698 // finalize MessageSvc 00699 SmartIF<IService> svc(m_messageSvc); 00700 if ( !svc.isValid() ) { 00701 log << MSG::ERROR << "Could not get the IService interface of the MessageSvc" << endmsg; 00702 } else { 00703 svc->sysFinalize().ignore(); 00704 } 00705 00706 // finalize JobOptionsSvc 00707 svc = m_jobOptionsSvc; 00708 if ( !svc.isValid() ) { 00709 log << MSG::ERROR << "Could not get the IService interface of the JobOptionsSvc" << endmsg; 00710 } else { 00711 svc->sysFinalize().ignore(); 00712 } 00713 00714 m_state = m_targetState; 00715 return StatusCode::SUCCESS; 00716 }
| StatusCode ApplicationMgr::initialize | ( | ) | [virtual] |
Definition at line 503 of file ApplicationMgr.cpp.
00503 { 00504 00505 MsgStream log( m_messageSvc, name() ); 00506 StatusCode sc; 00507 00508 if( m_state == Gaudi::StateMachine::INITIALIZED ) { 00509 log << MSG::INFO << "Already Initialized!" << endmsg; 00510 return StatusCode::SUCCESS; 00511 } 00512 else if( m_state != Gaudi::StateMachine::CONFIGURED ) { 00513 log << MSG::FATAL 00514 << "initialize: Invalid state \"" << m_state << "\"" << endmsg; 00515 return StatusCode::FAILURE; 00516 } 00517 m_targetState = Gaudi::StateMachine::INITIALIZED; 00518 00519 //-------------------------------------------------------------------------- 00520 // Initialize the list of top Services 00521 //-------------------------------------------------------------------------- 00522 sc = svcManager()->initialize(); 00523 if( !sc.isSuccess() ) return sc; 00524 00525 //-------------------------------------------------------------------------- 00526 // Final steps: Inform user and change internal state 00527 //-------------------------------------------------------------------------- 00528 log << MSG::INFO << "Application Manager Initialized successfully" << endmsg; 00529 m_state = m_targetState; 00530 00531 return sc; 00532 }
| StatusCode ApplicationMgr::start | ( | ) | [virtual] |
Definition at line 537 of file ApplicationMgr.cpp.
00537 { 00538 00539 MsgStream log( m_messageSvc, name() ); 00540 StatusCode sc; 00541 00542 if( m_state == Gaudi::StateMachine::RUNNING ) { 00543 log << MSG::INFO << "Already Initialized!" << endmsg; 00544 return StatusCode::SUCCESS; 00545 } 00546 else if( m_state != Gaudi::StateMachine::INITIALIZED ) { 00547 log << MSG::FATAL 00548 << "start: Invalid state \"" << m_state << "\"" << endmsg; 00549 return StatusCode::FAILURE; 00550 } 00551 m_targetState = Gaudi::StateMachine::RUNNING; 00552 00553 //-------------------------------------------------------------------------- 00554 // Initialize the list of top Services 00555 //-------------------------------------------------------------------------- 00556 sc = svcManager()->start(); 00557 if( !sc.isSuccess() ) return sc; 00558 00559 //-------------------------------------------------------------------------- 00560 // Final steps: Inform user and change internal state 00561 //-------------------------------------------------------------------------- 00562 log << MSG::INFO << "Application Manager Started successfully" << endmsg; 00563 m_state = m_targetState; 00564 00565 return sc; 00566 }
| StatusCode ApplicationMgr::stop | ( | ) | [virtual] |
Definition at line 590 of file ApplicationMgr.cpp.
00590 { 00591 00592 MsgStream log( m_messageSvc, name() ); 00593 StatusCode sc; 00594 00595 if( m_state == Gaudi::StateMachine::INITIALIZED ) { 00596 log << MSG::INFO << "Already Initialized!" << endmsg; 00597 return StatusCode::SUCCESS; 00598 } 00599 else if( m_state != Gaudi::StateMachine::RUNNING ) { 00600 log << MSG::FATAL 00601 << "stop: Invalid state \"" << m_state << "\"" << endmsg; 00602 return StatusCode::FAILURE; 00603 } 00604 m_targetState = Gaudi::StateMachine::INITIALIZED; 00605 00606 // Stop independently managed Algorithms 00607 sc = algManager()->stop(); 00608 if( !sc.isSuccess() ) return sc; 00609 00610 //-------------------------------------------------------------------------- 00611 // Stop the list of top Services 00612 //-------------------------------------------------------------------------- 00613 sc = svcManager()->stop(); 00614 if( !sc.isSuccess() ) return sc; 00615 00616 //-------------------------------------------------------------------------- 00617 // Final steps: Inform user and change internal state 00618 //-------------------------------------------------------------------------- 00619 log << MSG::INFO << "Application Manager Stopped successfully" << endmsg; 00620 m_state = m_targetState; 00621 00622 return sc; 00623 }
| StatusCode ApplicationMgr::finalize | ( | void | ) | [virtual] |
Definition at line 628 of file ApplicationMgr.cpp.
00628 { 00629 MsgStream log( m_messageSvc, name() ); 00630 if( m_state == Gaudi::StateMachine::CONFIGURED ) { 00631 log << MSG::INFO << "Already Finalized" << endmsg; 00632 return StatusCode::SUCCESS; 00633 } 00634 else if( m_state != Gaudi::StateMachine::INITIALIZED ) { 00635 log << MSG::FATAL << "finalize: Invalid state \"" << m_state << "\"" 00636 << endmsg; 00637 return StatusCode::FAILURE; 00638 } 00639 m_targetState = Gaudi::StateMachine::CONFIGURED; 00640 00641 // disable message suppression in finalize 00642 m_svcLocator->service<IProperty>("MessageSvc")->setProperty(BooleanProperty("enableSuppression", false)).ignore(); 00643 00644 // Finalize independently managed Algorithms 00645 StatusCode sc = algManager()->finalize(); 00646 00647 00648 // Finalize all Services 00649 sc = svcManager()->finalize(); 00650 00651 //svcManager()->removeService( (IService*) m_processingMgr.get() ); 00652 //svcManager()->removeService( (IService*) m_runable.get() ); 00653 00654 if (m_codeCheck) { 00655 StatusCode::disableChecking(); 00656 } 00657 00658 log << MSG::INFO << "Application Manager Finalized successfully" << endmsg; 00659 00660 m_state = m_targetState; 00661 return sc; 00662 }
| StatusCode ApplicationMgr::nextEvent | ( | int | maxevt | ) | [virtual] |
Definition at line 571 of file ApplicationMgr.cpp.
00571 { 00572 if( m_state != Gaudi::StateMachine::RUNNING ) { 00573 MsgStream log( m_messageSvc, name() ); 00574 log << MSG::FATAL << "nextEvent: Invalid state \"" << m_state << "\"" 00575 << endmsg; 00576 return StatusCode::FAILURE; 00577 } 00578 if (!m_processingMgr.isValid()) { 00579 MsgStream log( m_messageSvc, name() ); 00580 log << MSG::FATAL << "No event processing manager specified. Check option:" 00581 << s_eventloop << endmsg; 00582 return StatusCode::FAILURE; 00583 } 00584 return m_processingMgr->nextEvent(maxevt); 00585 }
| const std::string & ApplicationMgr::name | ( | ) | const [virtual] |
This is needed to avoid ambiguous calls to name().
Implements CommonMessaging< implements4< IAppMgrUI, IEventProcessor, IService, IStateful > >.
Definition at line 864 of file ApplicationMgr.cpp.
00864 { 00865 return m_name; 00866 }
| StatusCode ApplicationMgr::executeEvent | ( | void * | par | ) | [virtual] |
implementation of IEventProcessor::executeEvent(void*)
Definition at line 818 of file ApplicationMgr.cpp.
00818 { 00819 MsgStream log( m_messageSvc, name() ); 00820 if( m_state == Gaudi::StateMachine::RUNNING ) { 00821 if ( m_processingMgr.isValid() ) { 00822 return m_processingMgr->executeEvent(par); 00823 } 00824 } 00825 log << MSG::FATAL << "executeEvent: Invalid state \"" << FSMState() << "\"" 00826 <<endmsg; 00827 return StatusCode::FAILURE; 00828 }
| StatusCode ApplicationMgr::executeRun | ( | int | evtmax | ) | [virtual] |
implementation of IEventProcessor::executeRun(int)
Definition at line 833 of file ApplicationMgr.cpp.
00833 { 00834 MsgStream log( m_messageSvc, name() ); 00835 if( m_state == Gaudi::StateMachine::RUNNING ) { 00836 if ( m_processingMgr.isValid() ) { 00837 return m_processingMgr->executeRun(evtmax); 00838 } 00839 log << MSG::WARNING << "No EventLoop Manager specified " << endmsg; 00840 return StatusCode::SUCCESS; 00841 } 00842 log << MSG::FATAL << "executeRun: Invalid state \"" << FSMState() << "\"" 00843 << endmsg; 00844 return StatusCode::FAILURE; 00845 }
| StatusCode ApplicationMgr::stopRun | ( | ) | [virtual] |
implementation of IEventProcessor::stopRun()
Definition at line 850 of file ApplicationMgr.cpp.
00850 { 00851 MsgStream log( m_messageSvc, name() ); 00852 if( m_state == Gaudi::StateMachine::RUNNING ) { 00853 if ( m_processingMgr.isValid() ) { 00854 return m_processingMgr->stopRun(); 00855 } 00856 log << MSG::WARNING << "No EventLoop Manager specified " << endmsg; 00857 return StatusCode::SUCCESS; 00858 } 00859 log << MSG::FATAL << "stopRun: Invalid state \"" << FSMState() << "\"" 00860 << endmsg; 00861 return StatusCode::FAILURE; 00862 }
| Gaudi::StateMachine::State ApplicationMgr::FSMState | ( | ) | const [virtual] |
| Gaudi::StateMachine::State ApplicationMgr::targetFSMState | ( | ) | const [virtual] |
| StatusCode ApplicationMgr::reinitialize | ( | ) | [virtual] |
Definition at line 881 of file ApplicationMgr.cpp.
00881 { 00882 StatusCode retval = StatusCode::SUCCESS; 00883 StatusCode sc; 00884 if ( m_state < Gaudi::StateMachine::INITIALIZED ) { 00885 throw GaudiException("Cannot reinitialize application if not INITIALIZED or RUNNING", 00886 "ApplicationMgr::reinitialize", StatusCode::FAILURE); 00887 } 00888 if ( m_state == Gaudi::StateMachine::RUNNING ) { 00889 retval = GoToState(Gaudi::StateMachine::INITIALIZED); 00890 } 00891 sc = svcManager()->reinitialize(); 00892 if (sc.isFailure()) retval = sc; 00893 sc = algManager()->reinitialize(); 00894 if (sc.isFailure()) retval = sc; 00895 return retval; 00896 }
| StatusCode ApplicationMgr::restart | ( | ) | [virtual] |
Definition at line 901 of file ApplicationMgr.cpp.
00901 { 00902 StatusCode retval = StatusCode::SUCCESS; 00903 StatusCode sc; 00904 if ( m_state != Gaudi::StateMachine::RUNNING ) { 00905 throw GaudiException("Cannot restart application if not RUNNING", 00906 "ApplicationMgr::restart", StatusCode::FAILURE); 00907 } 00908 sc = svcManager()->restart(); 00909 if (sc.isFailure()) retval = sc; 00910 sc = algManager()->restart(); 00911 if (sc.isFailure()) retval = sc; 00912 return retval; 00913 }
| virtual StatusCode ApplicationMgr::sysInitialize | ( | ) | [inline, virtual] |
| virtual StatusCode ApplicationMgr::sysStart | ( | ) | [inline, virtual] |
| virtual StatusCode ApplicationMgr::sysStop | ( | ) | [inline, virtual] |
| virtual StatusCode ApplicationMgr::sysFinalize | ( | ) | [inline, virtual] |
| virtual StatusCode ApplicationMgr::sysReinitialize | ( | ) | [inline, virtual] |
| virtual StatusCode ApplicationMgr::sysRestart | ( | ) | [inline, virtual] |
| void ApplicationMgr::SIGoHandler | ( | Property & | theProp | ) |
Definition at line 918 of file ApplicationMgr.cpp.
00918 { 00919 00920 MsgStream log (m_messageSvc, name()); 00921 StatusCode sc; 00922 00923 // Re-initialize everything 00924 sc = reinitialize(); 00925 // Execute a number of events 00926 executeRun(m_evtMax); 00927 00928 return; 00929 }
| void ApplicationMgr::SIExitHandler | ( | Property & | theProp | ) |
Definition at line 934 of file ApplicationMgr.cpp.
00934 { 00935 StatusCode status; 00936 status = finalize(); 00937 status = terminate(); 00938 ::exit( 0 ); 00939 }
| void ApplicationMgr::evtLoopPropertyHandler | ( | Property & | theProp | ) |
Definition at line 944 of file ApplicationMgr.cpp.
00944 { 00945 if ( m_processingMgr.isValid() ) { 00946 SmartIF<IProperty> props(m_processingMgr); 00947 if ( props.isValid() ) { 00948 props->setProperty( p ).ignore(); 00949 } 00950 } 00951 }
| StatusCode ApplicationMgr::decodeExtSvcNameList | ( | ) |
Definition at line 1000 of file ApplicationMgr.cpp.
01000 { 01001 StatusCode result = StatusCode::SUCCESS; 01002 01003 std::vector<std::string> theNames = m_extSvcNameList.value( ); 01004 01005 VectorName::const_iterator it(theNames.begin()); 01006 VectorName::const_iterator et(theNames.end()); 01007 while(result.isSuccess() && it != et) { 01008 Gaudi::Utils::TypeNameString item(*it++); 01009 if (m_extSvcCreates == true) { 01010 if ( (result = svcManager()->addService(item, 10)).isFailure()) { 01011 MsgStream log( m_messageSvc, m_name ); 01012 log << MSG::ERROR << "decodeExtSvcNameList: Cannot create service " 01013 << item.type() << "/" << item.name() << endmsg; 01014 } 01015 } else { 01016 if( ( result = svcManager()->declareSvcType(item.name(), 01017 item.type()) ).isFailure()) { 01018 MsgStream log( m_messageSvc, m_name ); 01019 log << MSG::ERROR << "decodeExtSvcNameList: Cannot declare service " 01020 << item.type() << "/" << item.name() << endmsg; 01021 } 01022 } 01023 } 01024 return result; 01025 }
| StatusCode ApplicationMgr::decodeCreateSvcNameList | ( | ) |
Definition at line 966 of file ApplicationMgr.cpp.
00966 { 00967 StatusCode result = StatusCode::SUCCESS; 00968 const std::vector<std::string>& theNames = m_createSvcNameList.value( ); 00969 VectorName::const_iterator it(theNames.begin()); 00970 VectorName::const_iterator et(theNames.end()); 00971 while(result.isSuccess() && it != et) { 00972 Gaudi::Utils::TypeNameString item(*it++); 00973 if( (result = svcManager()->addService(item, 10) ).isFailure()) { 00974 MsgStream log( m_messageSvc, m_name ); 00975 log << MSG::ERROR << "decodeCreateSvcNameList: Cannot create service " 00976 << item.type() << "/" << item.name() << endmsg; 00977 } else { 00978 MsgStream log( m_messageSvc, m_name ); 00979 log << MSG::DEBUG << "decodeCreateSvcNameList: Created service " 00980 << item.type() << "/" << item.name() << endmsg; 00981 } 00982 } 00983 return result; 00984 }
| void ApplicationMgr::createSvcNameListHandler | ( | Property & | ) |
Definition at line 956 of file ApplicationMgr.cpp.
00956 { 00957 if ( !(decodeCreateSvcNameList()).isSuccess() ) { 00958 throw GaudiException("Failed to create ext services", 00959 "MinimalEventLoopMgr::createSvcNameListHandler", 00960 StatusCode::FAILURE); 00961 } 00962 }
| void ApplicationMgr::extSvcNameListHandler | ( | Property & | theProp | ) |
Definition at line 989 of file ApplicationMgr.cpp.
00989 { 00990 if ( !(decodeExtSvcNameList( )).isSuccess() ) { 00991 throw GaudiException("Failed to declare ext services", 00992 "MinimalEventLoopMgr::extSvcNameListHandler", 00993 StatusCode::FAILURE); 00994 } 00995 }
| StatusCode ApplicationMgr::decodeMultiThreadSvcNameList | ( | ) |
Definition at line 1042 of file ApplicationMgr.cpp.
01042 { 01043 StatusCode result = StatusCode::SUCCESS; 01044 const std::vector<std::string>& theNames = m_multiThreadSvcNameList.value( ); 01045 for(int iCopy=0; iCopy<m_noOfEvtThreads; ++iCopy) { 01046 for (VectorName::const_iterator it = theNames.begin(); 01047 it != theNames.end(); 01048 ++it) { 01049 Gaudi::Utils::TypeNameString item(*it); 01050 result = addMultiSvc(item, 10); 01051 //FIXME SHOULD CLONE? 01052 if( result.isFailure() ) { 01053 MsgStream log( m_messageSvc, m_name ); 01054 log << MSG::ERROR 01055 << "decodeMultiThreadSvcNameList: Cannot create service " 01056 << item.type() << "/" << item.name() << endmsg; 01057 } else { 01058 MsgStream log( m_messageSvc, m_name ); 01059 log << MSG::VERBOSE 01060 << "decodeMultiThreadSvcNameList: created service " 01061 << item.type() << "/" << item.name() << endmsg; 01062 } 01063 } 01064 } 01065 return result; 01066 }
| void ApplicationMgr::multiThreadSvcNameListHandler | ( | Property & | theProp | ) |
Definition at line 1030 of file ApplicationMgr.cpp.
01030 { 01031 if ( !(decodeMultiThreadSvcNameList( )).isSuccess() ) { 01032 throw GaudiException("Failed to create copies of mt services", 01033 "MinimalEventLoopMgr::multiThreadSvcNameListHandler", 01034 StatusCode::FAILURE); 01035 } 01036 01037 }
| StatusCode ApplicationMgr::decodeDllNameList | ( | ) |
Definition at line 1147 of file ApplicationMgr.cpp.
01147 { 01148 01149 MsgStream log( m_messageSvc, m_name ); 01150 StatusCode result = StatusCode::SUCCESS; 01151 01152 // Clean up multiple entries from DLL list 01153 // ------------------------------------------------------------------------- 01154 std::vector<std::string> newList; 01155 std::map<std::string,unsigned int> dllInList, duplicateList; 01156 {for ( std::vector<std::string>::const_iterator it = m_dllNameList.value().begin(); 01157 it != m_dllNameList.value().end(); ++it ) { 01158 if ( 0 == dllInList[*it] ) { 01159 newList.push_back(*it); // first instance of this module 01160 } else { ++duplicateList[*it]; } // module listed multiple times 01161 ++dllInList[*it]; // increment count for this module 01162 }} 01163 //m_dllNameList = newList; // update primary list to new, filtered list (do not use the 01164 // property itself otherwise we get called again infinitely) 01165 // List modules that were in there twice.. 01166 if ( !duplicateList.empty() ) { 01167 log << MSG::DEBUG << "Removed duplicate entries for modules : "; 01168 for ( std::map<std::string,unsigned int>::const_iterator it = duplicateList.begin(); 01169 it != duplicateList.end(); ++it ) { 01170 log << it->first << "(" << 1+it->second << ")"; 01171 if ( it != --duplicateList.end() ) log << ", "; 01172 } 01173 log << endmsg; 01174 } 01175 // ------------------------------------------------------------------------- 01176 01177 const std::vector<std::string>& theNames = newList; 01178 01179 // only load the new dlls or previously failed dlls 01180 log << MSG::DEBUG << "Loading declared DLL's" << endmsg; 01181 01182 std::vector<std::string> successNames, failNames; 01183 std::vector<std::string>::const_iterator it; 01184 01185 for (it = theNames.begin(); it != theNames.end(); it++) { 01186 if (std::find (m_okDlls.rbegin(), m_okDlls.rend(), *it) == m_okDlls.rend()){ 01187 // found a new module name 01188 StatusCode status = m_classManager->loadModule( (*it) ); 01189 if( status.isFailure() ) { 01190 failNames.push_back(*it); 01191 result = StatusCode::FAILURE; 01192 } 01193 else { 01194 successNames.push_back(*it); 01195 } 01196 } 01197 } 01198 01199 // report back to the user and store the names of the succesfully loaded dlls 01200 if ( !successNames.empty() ) { 01201 log << MSG::INFO << "Successfully loaded modules : "; 01202 for (it = successNames.begin(); it != successNames.end(); it++) { 01203 log<< (*it); 01204 if( (it+1) != successNames.end()) log << ", "; 01205 // save name 01206 m_okDlls.push_back( *it ); 01207 } 01208 log << endmsg; 01209 } 01210 01211 if ( result == StatusCode::FAILURE ) { 01212 log << MSG::WARNING << "Failed to load modules: "; 01213 for (it = failNames.begin(); it != failNames.end(); it++) { 01214 log<< (*it); 01215 if( (it+1) != failNames.end()) log << ", "; 01216 } 01217 log << endmsg; 01218 } 01219 return result; 01220 }
| void ApplicationMgr::dllNameListHandler | ( | Property & | theProp | ) |
Definition at line 1136 of file ApplicationMgr.cpp.
01136 { 01137 if ( !(decodeDllNameList( )).isSuccess() ) { 01138 throw GaudiException("Failed to load DLLs.", 01139 "MinimalEventLoopMgr::dllNameListHandler", 01140 StatusCode::FAILURE); 01141 } 01142 }
| void ApplicationMgr::reflexDebugPropertyHandler | ( | Property & | theProp | ) |
Definition at line 1225 of file ApplicationMgr.cpp.
01226 { 01227 // Setup debug level for Reflex plugin system 01228 MsgStream log (m_messageSvc, name()); 01229 log << MSG::INFO 01230 << "Updating ROOT::Reflex::PluginService::SetDebug(level) to level=" 01231 << (int)m_reflexDebugLevel 01232 << endmsg; 01233 ROOT::Reflex::PluginService::SetDebug(m_reflexDebugLevel); 01234 }
| void ApplicationMgr::initLoopCheckHndlr | ( | Property & | ) |
Definition at line 1239 of file ApplicationMgr.cpp.
01239 { 01240 svcManager()->setLoopCheckEnabled(m_loopCheck); 01241 }
| SmartIF<IComponentManager>& ApplicationMgr::getManager | ( | ) | [inline] |
Definition at line 137 of file ApplicationMgr.h.
00137 { 00138 return m_managers[I::interfaceID().id()]; 00139 }
| SmartIF<ISvcManager>& ApplicationMgr::svcManager | ( | ) | [inline] |
Definition at line 141 of file ApplicationMgr.h.
00141 { 00142 // Cache the casted pointer to ISvcManager 00143 if (!m_svcManager) { 00144 m_svcManager = getManager<IService>(); 00145 } 00146 return m_svcManager; 00147 }
| SmartIF<IAlgManager>& ApplicationMgr::algManager | ( | ) | [inline] |
Definition at line 149 of file ApplicationMgr.h.
00149 { 00150 // Cache the casted pointer to IAlgManager 00151 if (!m_algManager) { 00152 m_algManager = getManager<IAlgorithm>(); 00153 } 00154 return m_algManager; 00155 }
| virtual SmartIF<ISvcLocator>& ApplicationMgr::serviceLocator | ( | ) | const [inline, virtual] |
Needed to locate the message service.
Implements CommonMessaging< implements4< IAppMgrUI, IEventProcessor, IService, IStateful > >.
Definition at line 158 of file ApplicationMgr.h.
00158 { 00159 return m_svcLocator; 00160 }
| 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 1070 of file ApplicationMgr.cpp.
01071 { 01072 StatusCode result = StatusCode::SUCCESS; 01073 MsgStream log( m_messageSvc, m_name ); 01074 if (0 == m_noOfEvtThreads) { 01075 result = svcManager()->declareSvcType(name, type); 01076 if( result.isFailure() ) { 01077 log << MSG::ERROR << "declareMultiSvcType: Cannot declare service " 01078 << type << "/" << name << endmsg; 01079 } else { 01080 log << MSG::VERBOSE << "declareMultiSvcType: declared service " 01081 << type << "/" << name << endmsg; 01082 } 01083 } else { 01084 for(int iCopy=0; iCopy<m_noOfEvtThreads; ++iCopy) { 01085 std::string thrName(name + getGaudiThreadIDfromID(iCopy)); 01086 result = svcManager()->declareSvcType(thrName, type); 01087 if( result.isFailure() ) { 01088 log << MSG::ERROR << "declareMultiSvcType: Cannot declare service " 01089 << type << "/" << thrName << endmsg; 01090 } else { 01091 log << MSG::VERBOSE << "declareMultiSvcType: declared service " 01092 << type << "/" << thrName << endmsg; 01093 } 01094 } 01095 } 01096 return result; 01097 }
| 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 1101 of file ApplicationMgr.cpp.
01102 { 01103 using Gaudi::Utils::TypeNameString; 01104 StatusCode result = StatusCode::SUCCESS; 01105 MsgStream log( m_messageSvc, m_name ); 01106 if (0 == m_noOfEvtThreads) { 01107 result = svcManager()->addService(typeName, prio); 01108 // result = svcManager()->addService(name, type, prio); // CHECKME??? 01109 if( result.isFailure() ) { 01110 log << MSG::ERROR << "addMultiSvc: Cannot add service " 01111 << typeName.type() << "/" << typeName.name() << endmsg; 01112 } else { 01113 log << MSG::VERBOSE << "addMultiSvc: added service " 01114 << typeName.type() << "/" << typeName.name() << endmsg; 01115 } 01116 } else { 01117 for(int iCopy=0; iCopy<m_noOfEvtThreads; ++iCopy) { 01118 const std::string &type = typeName.type(); 01119 std::string thrName(typeName.name() + getGaudiThreadIDfromID(iCopy)); 01120 result = svcManager()->addService(TypeNameString(thrName, type), prio); 01121 if( result.isFailure() ) { 01122 log << MSG::ERROR << "addMultiSvc: Cannot add service " 01123 << type << "/" << thrName << endmsg; 01124 } else { 01125 log << MSG::VERBOSE << "addMultiSvc: added service " 01126 << type << "/" << thrName << endmsg; 01127 } 01128 } 01129 } 01130 return result; 01131 }
| void ApplicationMgr::setServiceManager | ( | ISvcManager * | ) | [inline, protected] |
| StatusCode ApplicationMgr::i_startup | ( | ) | [protected] |
Internal startup routine.
Definition at line 190 of file ApplicationMgr.cpp.
00190 { 00191 StatusCode sc; 00192 00193 // declare factories in current module 00194 m_classManager->loadModule("").ignore(); 00195 00196 // Create the Message service 00197 SmartIF<IService> msgsvc = svcManager()->createService(Gaudi::Utils::TypeNameString("MessageSvc", m_messageSvcType)); 00198 if( !msgsvc.isValid() ) { 00199 fatal() << "Error creating MessageSvc of type " << m_messageSvcType << endmsg; 00200 return sc; 00201 } 00202 // Create the Job Options service 00203 SmartIF<IService> jobsvc = svcManager()->createService(Gaudi::Utils::TypeNameString("JobOptionsSvc", m_jobOptionsSvcType)); 00204 if( !jobsvc.isValid() ) { 00205 fatal() << "Error creating JobOptionsSvc" << endmsg; 00206 return sc; 00207 } 00208 00209 SmartIF<IProperty> jobOptsIProp(jobsvc); 00210 if ( !jobOptsIProp.isValid() ) { 00211 fatal() << "Error locating JobOptionsSvc" << endmsg; 00212 return sc; 00213 } 00214 sc = jobOptsIProp->setProperty( StringProperty("TYPE", m_jobOptionsType) ); 00215 if( !sc.isSuccess() ) { 00216 fatal() << "Error setting TYPE option in JobOptionsSvc" << endmsg; 00217 return sc; 00218 } 00219 00220 if ( m_jobOptionsPath != "") { // The command line takes precedence 00221 sc = jobOptsIProp->setProperty( StringProperty("PATH", m_jobOptionsPath) ); 00222 if( !sc.isSuccess() ) { 00223 fatal() << "Error setting PATH option in JobOptionsSvc" << endmsg; 00224 return sc; 00225 } 00226 } 00227 else if ( 0 != getenv("JOBOPTPATH") ) {// Otherwise the Environment JOBOPTPATH 00228 sc = jobOptsIProp->setProperty (StringProperty("PATH", 00229 getenv("JOBOPTPATH"))); 00230 if( !sc.isSuccess() ) { 00231 fatal() 00232 << "Error setting PATH option in JobOptionsSvc from env" 00233 << endmsg; 00234 return sc; 00235 } 00236 } 00237 else { // Otherwise the default 00238 sc = jobOptsIProp->setProperty (StringProperty("PATH", 00239 "../options/job.opts")); 00240 if( !sc.isSuccess() ) { 00241 fatal() 00242 << "Error setting PATH option in JobOptionsSvc to default" 00243 << endmsg; 00244 return sc; 00245 } 00246 } 00247 jobOptsIProp->release(); 00248 00249 // Sets my default the Output Level of the Message service to be 00250 // the same as this 00251 SmartIF<IProperty> msgSvcIProp(msgsvc); 00252 msgSvcIProp->setProperty( IntegerProperty("OutputLevel", m_outputLevel)).ignore(); 00253 msgSvcIProp->release(); 00254 00255 sc = jobsvc->sysInitialize(); 00256 if( !sc.isSuccess() ) { 00257 fatal() << "Error initializing JobOptionsSvc" << endmsg; 00258 return sc; 00259 } 00260 sc = msgsvc->sysInitialize(); 00261 if( !sc.isSuccess() ) { 00262 fatal() << "Error initializing MessageSvc" << endmsg; 00263 return sc; 00264 } 00265 00266 // Get the useful interface from Message anf JobOptions services 00267 m_messageSvc = m_svcLocator->service("MessageSvc"); 00268 if( !m_messageSvc.isValid() ) { 00269 fatal() << "Error retrieving MessageSvc." << endmsg; 00270 return sc; 00271 } 00272 m_jobOptionsSvc = m_svcLocator->service("JobOptionsSvc"); 00273 if( !m_jobOptionsSvc.isValid() ) { 00274 fatal() << "Error retrieving JobOptionsSvc." << endmsg; 00275 return sc; 00276 } 00277 00278 return sc; 00279 }
| 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 721 of file ApplicationMgr.cpp.
00721 { 00722 StatusCode sc = StatusCode(StatusCode::SUCCESS,true); 00723 00724 switch (state) { 00725 00726 case Gaudi::StateMachine::OFFLINE: 00727 switch (m_state) { 00728 case Gaudi::StateMachine::OFFLINE : return StatusCode::SUCCESS; break; 00729 case Gaudi::StateMachine::CONFIGURED : return terminate(); break; 00730 default: // Gaudi::StateMachine::INITIALIZED or Gaudi::StateMachine::RUNNING 00731 sc = GoToState(Gaudi::StateMachine::CONFIGURED); 00732 if (sc.isSuccess()) { 00733 return terminate(); 00734 } break; 00735 } break; 00736 00737 case Gaudi::StateMachine::CONFIGURED: 00738 switch (m_state) { 00739 case Gaudi::StateMachine::CONFIGURED : return StatusCode::SUCCESS; break; 00740 case Gaudi::StateMachine::OFFLINE : return configure(); break; 00741 case Gaudi::StateMachine::INITIALIZED : return finalize(); break; 00742 default: // Gaudi::StateMachine::RUNNING 00743 sc = GoToState(Gaudi::StateMachine::INITIALIZED); 00744 if (sc.isSuccess()) { 00745 return finalize(); 00746 } break; 00747 } break; 00748 00749 case Gaudi::StateMachine::INITIALIZED: 00750 switch (m_state) { 00751 case Gaudi::StateMachine::INITIALIZED : return StatusCode::SUCCESS; break; 00752 case Gaudi::StateMachine::CONFIGURED : return initialize(); break; 00753 case Gaudi::StateMachine::RUNNING : return stop(); break; 00754 default: // Gaudi::StateMachine::OFFLINE 00755 sc = GoToState(Gaudi::StateMachine::CONFIGURED); 00756 if (sc.isSuccess()) { 00757 return initialize(); 00758 } break; 00759 } break; 00760 00761 case Gaudi::StateMachine::RUNNING: 00762 switch (m_state) { 00763 case Gaudi::StateMachine::RUNNING : return StatusCode::SUCCESS; break; 00764 case Gaudi::StateMachine::INITIALIZED : return start(); break; 00765 default: // Gaudi::StateMachine::OFFLINE or Gaudi::StateMachine::CONFIGURED 00766 sc = GoToState(Gaudi::StateMachine::INITIALIZED); 00767 if (sc.isSuccess()) { 00768 return start(); 00769 } break; 00770 } break; 00771 00772 } 00773 00774 // If I get here, there has been a problem in the recursion 00775 00776 if (ignoreFailures){ 00777 // force the new state 00778 m_state = state; 00779 return StatusCode::SUCCESS; 00780 } 00781 00782 return sc; 00783 }
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 188 of file ApplicationMgr.h.
SmartIF<ISvcManager> ApplicationMgr::m_svcManager [protected] |
SmartIF<IAlgManager> ApplicationMgr::m_algManager [protected] |
DLLClassManager* ApplicationMgr::m_classManager [protected] |
SmartIF<ISvcLocator> ApplicationMgr::m_svcLocator [mutable, protected] |
IntegerProperty ApplicationMgr::m_SIGo [protected] |
IntegerProperty ApplicationMgr::m_SIExit [protected] |
StringArrayProperty ApplicationMgr::m_topAlgNameList [protected] |
StringProperty ApplicationMgr::m_outStreamType [protected] |
StringProperty ApplicationMgr::m_messageSvcType [protected] |
StringProperty ApplicationMgr::m_jobOptionsSvcType [protected] |
ListSvc ApplicationMgr::m_topSvcList [protected] |
ListName ApplicationMgr::m_topSvcNameList [protected] |
std::string ApplicationMgr::m_name [protected] |
Gaudi::StateMachine::State ApplicationMgr::m_state [protected] |
VectorName ApplicationMgr::m_defServices [protected] |
VectorName ApplicationMgr::m_svcMapping [protected] |
VectorName ApplicationMgr::m_svcOptMapping [protected] |
PropertyMgr* ApplicationMgr::m_propertyMgr [protected] |
SmartIF<IMessageSvc> ApplicationMgr::m_messageSvc [protected] |
SmartIF<IRunable> ApplicationMgr::m_runable [protected] |
SmartIF<IEventProcessor> ApplicationMgr::m_processingMgr [protected] |
SmartIF<IJobOptionsSvc> ApplicationMgr::m_jobOptionsSvc [protected] |
int ApplicationMgr::m_evtMax [protected] |
StringArrayProperty ApplicationMgr::m_extSvcNameList [protected] |
BooleanProperty ApplicationMgr::m_extSvcCreates [protected] |
List of external services names for which we want a copy per evt thread.
Definition at line 238 of file ApplicationMgr.h.
int ApplicationMgr::m_noOfEvtThreads [protected] |
StringArrayProperty ApplicationMgr::m_dllNameList [protected] |
std::string ApplicationMgr::m_jobOptionsType [protected] |
std::string ApplicationMgr::m_jobOptionsPath [protected] |
std::string ApplicationMgr::m_runableType [protected] |
std::string ApplicationMgr::m_eventLoopMgr [protected] |
std::string ApplicationMgr::m_evtsel [protected] |
std::string ApplicationMgr::m_histPersName [protected] |
int ApplicationMgr::m_outputLevel [protected] |
std::string ApplicationMgr::m_appName [protected] |
std::string ApplicationMgr::m_appVersion [protected] |
bool ApplicationMgr::m_actHistory [protected] |
bool ApplicationMgr::m_codeCheck [protected] |
IntegerProperty ApplicationMgr::m_reflexDebugLevel [protected] |
Definition at line 255 of file ApplicationMgr.h.
BooleanProperty ApplicationMgr::m_auditTools [protected] |
BooleanProperty ApplicationMgr::m_auditSvcs [protected] |
Definition at line 259 of file ApplicationMgr.h.
BooleanProperty ApplicationMgr::m_auditAlgs [protected] |
Definition at line 260 of file ApplicationMgr.h.
std::map<std::string,std::string> ApplicationMgr::m_environment [protected] |
BooleanProperty ApplicationMgr::m_loopCheck [protected] |
bool ApplicationMgr::m_propertiesPrint [protected] |
std::vector<std::string> ApplicationMgr::m_okDlls [private] |