All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ApplicationMgr.cpp
Go to the documentation of this file.
1 // Include files
2 #include "ApplicationMgr.h"
3 #include "ServiceManager.h"
4 #include "AlgorithmManager.h"
5 #include "DLLClassManager.h"
6 
8 #include "GaudiKernel/IService.h"
9 #include "GaudiKernel/IRunable.h"
12 
13 #include "GaudiKernel/SmartIF.h"
14 #include "GaudiKernel/MsgStream.h"
17 
20 
21 #include "GaudiKernel/StatusCode.h"
22 #include "GaudiKernel/Time.h"
23 #include "GaudiKernel/System.h"
24 
26 
27 #include "GaudiCoreSvcVersion.h"
28 
29 
30 using System::getEnv;
31 using System::isEnvSet;
32 
33 #include <algorithm>
34 #include <cassert>
35 #include <ctime>
36 #include <limits>
37 
38 static const char* s_eventloop = "EventLoop";
39 static const char* s_runable = "Runable";
40 
41 #define ON_DEBUG if (UNLIKELY(m_outputLevel <= MSG::DEBUG))
42 #define ON_VERBOSE if (UNLIKELY(m_outputLevel <= MSG::VERBOSE))
43 
45 
46 // Implementation class for the Application Manager. In this way the
47 // ApplicationMgr class is a fully insulated concrete class. Clients
48 // (main programs) will not need to re-compile if there are changes
49 // in the implementation
50 
51 //=======================================================================
52 // Constructor
53 //=======================================================================
55  // IInterface initialization
56  addRef(); // Initial count set to 1
57 
58  // Initialize two basic services: messagesvc & joboptions
59  m_messageSvc = 0;
60  m_jobOptionsSvc = 0;
61 
62  // Instantiate component managers
63  m_managers[IService::interfaceID().id()] = new ServiceManager(this);
64  AlgorithmManager *algMgr = new AlgorithmManager(this);
65  m_managers[IAlgorithm::interfaceID().id()] = algMgr;
66 
67  m_svcLocator = svcManager();
68 
69  // Instantiate internal services
70  // SvcLocator/Factory HAS to be already instantiated
71  m_classManager = new DLLClassManager(this);
72  m_propertyMgr = new PropertyMgr(this);
73 
74  m_name = "ApplicationMgr";
76  m_targetState = Gaudi::StateMachine::OFFLINE;
77 
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 );
84 
85  m_propertyMgr->declareProperty("SvcMapping", m_svcMapping );
86  m_propertyMgr->declareProperty("SvcOptMapping", m_svcOptMapping );
87 
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");
96 
97  m_propertyMgr->declareProperty("HistogramPersistency", m_histPersName="NONE");
98 
99  // Declare Job Options Service properties and set default
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);
105 
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 = "");
110 
111  m_propertyMgr->declareProperty("AuditTools", m_auditTools = false);
112  m_propertyMgr->declareProperty("AuditServices", m_auditSvcs = false);
113  m_propertyMgr->declareProperty("AuditAlgorithms", m_auditAlgs = false);
114 
115  m_propertyMgr->declareProperty("ActivateHistory", m_actHistory = false);
116  m_propertyMgr->declareProperty("StatusCodeCheck", m_codeCheck = false);
117 
118  m_propertyMgr->declareProperty("Environment", m_environment);
119 
120  // ServiceMgr Initialization loop checking
121  m_propertyMgr->declareProperty("InitializationLoopCheck", m_loopCheck = true)
122  ->declareUpdateHandler(&ApplicationMgr::initLoopCheckHndlr, this);
123  svcManager()->setLoopCheckEnabled(m_loopCheck);
124 
125  // Flag to activate the printout of properties
126  m_propertyMgr->declareProperty
127  ( "PropertiesPrint",
128  m_propertiesPrint = false,
129  "Flag to activate the printout of properties" );
130 
131  m_propertyMgr->declareProperty("PluginDebugLevel", m_pluginDebugLevel = 0 );
132 
133  m_propertyMgr->declareProperty("StopOnSignal", m_stopOnSignal = false,
134  "Flag to enable/disable the signal handler that schedule a stop of the event loop");
135 
136  m_propertyMgr->declareProperty("StalledEventMonitoring", m_stalledEventMonitoring = false,
137  "Flag to enable/disable the monitoring and reporting of stalled events");
138 
139  m_propertyMgr->declareProperty("ReturnCode", m_returnCode = Gaudi::ReturnCode::Success,
140  "Return code of the application. Set internally in case of error conditions.");
141 
142  m_propertyMgr->declareProperty("AlgTypeAliases", algMgr->typeAliases(),
143  "Aliases of algorithm types, to replace an algorithm type for every instance");
144 
145  // Add action handlers to the appropriate properties
146  m_SIGo.declareUpdateHandler ( &ApplicationMgr::SIGoHandler , this );
147  m_SIExit.declareUpdateHandler( &ApplicationMgr::SIExitHandler , this );
148  m_topAlgNameList.declareUpdateHandler(&ApplicationMgr::evtLoopPropertyHandler, this);
149  m_outStreamNameList.declareUpdateHandler(&ApplicationMgr::evtLoopPropertyHandler, this);
150  m_outStreamType.declareUpdateHandler(&ApplicationMgr::evtLoopPropertyHandler, this);
151  m_pluginDebugLevel.declareUpdateHandler(&ApplicationMgr::pluginDebugPropertyHandler, this);
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");
160 }
161 
162 //============================================================================
163 // destructor
164 //============================================================================
168  if( m_messageSvc ) m_messageSvc->release();
169  if( m_jobOptionsSvc ) m_jobOptionsSvc->release();
170 }
171 
172 //============================================================================
173 // IInterface implementation: queryInterface::addRef()
174 //============================================================================
176 ( const InterfaceID& iid ,
177  void** ppvi )
178 {
179  if ( 0 == ppvi ) { return StatusCode::FAILURE ; }
180 
181  // try to find own/direct interfaces:
182  StatusCode sc = base_class::queryInterface(iid,ppvi);
183  if (sc.isSuccess()) return sc;
184 
185  // find indirect interfaces :
186  if ( ISvcLocator ::interfaceID() . versionMatch ( iid ) )
187  { return serviceLocator()-> queryInterface ( iid , ppvi ) ; }
188  else if ( ISvcManager ::interfaceID() . versionMatch ( iid ) )
189  { return svcManager() -> queryInterface ( iid , ppvi ) ; }
190  else if ( IAlgManager ::interfaceID() . versionMatch ( iid ) )
191  { return algManager() -> queryInterface ( iid , ppvi ) ; }
192  else if ( IClassManager ::interfaceID() . versionMatch ( iid ) )
193  { return m_classManager -> queryInterface ( iid , ppvi ) ; }
194  else if ( IProperty ::interfaceID() . versionMatch ( iid ) )
195  { return m_propertyMgr -> queryInterface ( iid , ppvi ) ; }
196  else if ( IMessageSvc ::interfaceID() . versionMatch ( iid ) )
197  {
198  *ppvi = reinterpret_cast<void*>(m_messageSvc.get());
199  if (m_messageSvc) {
200  m_messageSvc->addRef();
201  }
202  // Note that 0 can be a valid IMessageSvc pointer value (when used for
203  // MsgStream).
204  return StatusCode::SUCCESS;
205  }
206  *ppvi = 0;
207  return StatusCode::FAILURE;
208 }
209 
210 //============================================================================
211 // ApplicationMgr::i_startup()
212 //============================================================================
214  StatusCode sc;
215 
216  // declare factories in current module
218 
219  // Create the Message service
220  SmartIF<IService> msgsvc = svcManager()->createService(Gaudi::Utils::TypeNameString("MessageSvc", m_messageSvcType));
221  if( !msgsvc.isValid() ) {
222  fatal() << "Error creating MessageSvc of type " << m_messageSvcType << endmsg;
223  return sc;
224  }
225  // Create the Job Options service
226  SmartIF<IService> jobsvc = svcManager()->createService(Gaudi::Utils::TypeNameString("JobOptionsSvc", m_jobOptionsSvcType));
227  if( !jobsvc.isValid() ) {
228  fatal() << "Error creating JobOptionsSvc" << endmsg;
229  return sc;
230  }
231 
232  SmartIF<IProperty> jobOptsIProp(jobsvc);
233  if ( !jobOptsIProp.isValid() ) {
234  fatal() << "Error locating JobOptionsSvc" << endmsg;
235  return sc;
236  }
237  sc = jobOptsIProp->setProperty( StringProperty("TYPE", m_jobOptionsType) );
238  if( !sc.isSuccess() ) {
239  fatal() << "Error setting TYPE option in JobOptionsSvc" << endmsg;
240  return sc;
241  }
242 
243  if ( m_jobOptionsPath != "") { // The command line takes precedence
244  sc = jobOptsIProp->setProperty( StringProperty("PATH", m_jobOptionsPath) );
245  if( !sc.isSuccess() ) {
246  fatal() << "Error setting PATH option in JobOptionsSvc" << endmsg;
247  return sc;
248  }
249  }
250  else if ( isEnvSet("JOBOPTPATH") ) {// Otherwise the Environment JOBOPTPATH
251  sc = jobOptsIProp->setProperty (StringProperty("PATH",
252  getEnv("JOBOPTPATH")));
253  if( !sc.isSuccess() ) {
254  fatal()
255  << "Error setting PATH option in JobOptionsSvc from env"
256  << endmsg;
257  return sc;
258  }
259  }
260  else { // Otherwise the default
261  sc = jobOptsIProp->setProperty (StringProperty("PATH",
262  "../options/job.opts"));
263  if( !sc.isSuccess() ) {
264  fatal()
265  << "Error setting PATH option in JobOptionsSvc to default"
266  << endmsg;
267  return sc;
268  }
269  }
270  jobOptsIProp->release();
271 
272  // Sets my default the Output Level of the Message service to be
273  // the same as this
274  SmartIF<IProperty> msgSvcIProp(msgsvc);
275  msgSvcIProp->setProperty( IntegerProperty("OutputLevel", m_outputLevel)).ignore();
276  msgSvcIProp->release();
277 
278  sc = jobsvc->sysInitialize();
279  if( !sc.isSuccess() ) {
280  fatal() << "Error initializing JobOptionsSvc" << endmsg;
281  return sc;
282  }
283  sc = msgsvc->sysInitialize();
284  if( !sc.isSuccess() ) {
285  fatal() << "Error initializing MessageSvc" << endmsg;
286  return sc;
287  }
288 
289  // Get the useful interface from Message and JobOptions services
290  m_messageSvc = m_svcLocator->service("MessageSvc");
291  if( !m_messageSvc.isValid() ) {
292  fatal() << "Error retrieving MessageSvc." << endmsg;
293  return sc;
294  }
295  m_jobOptionsSvc = m_svcLocator->service("JobOptionsSvc");
296  if( !m_jobOptionsSvc.isValid() ) {
297  fatal() << "Error retrieving JobOptionsSvc." << endmsg;
298  return sc;
299  }
300 
301  return sc;
302 }
303 
304 //============================================================================
305 // IAppMgrUI implementation: ApplicationMgr::configure()
306 //============================================================================
308  // Check if the state is compatible with the transition
309  MsgStream tlog( m_messageSvc, name() );
311  tlog << MSG::INFO << "Already Configured" << endmsg;
312  return StatusCode::SUCCESS;
313  }
314  else if( Gaudi::StateMachine::OFFLINE != m_state ) {
315  tlog << MSG::FATAL
316  << "configure: Invalid state \"" << m_state << "\"" << endmsg;
317  return StatusCode::FAILURE;
318  }
320 
321  // Reset application return code.
323 
324  StatusCode sc;
325  sc = i_startup();
326  if ( !sc.isSuccess() ) {
327  return sc;
328  }
329 
331 
332  // Get my own options using the Job options service
333  if (log.level() <= MSG::DEBUG)
334  log << MSG::DEBUG << "Getting my own properties" << endmsg;
335  sc = m_jobOptionsSvc->setMyProperties( name(), m_propertyMgr );
336  if( !sc.isSuccess() ) {
337  log << MSG::WARNING << "Problems getting my properties from JobOptionsSvc"
338  << endmsg;
339  return sc;
340  }
341 
342  // Check current outputLevel to eventually inform the MessageSvc
343  if( m_outputLevel != MSG::NIL && !m_appName.empty() ) {
344  assert(m_messageSvc != 0);
345  m_messageSvc->setOutputLevel( name(), m_outputLevel );
346  // Print a welcome message
347  log << MSG::ALWAYS
348  << std::endl
349  << "=================================================================="
350  << "=================================================================="
351  << std::endl
352  << " "
353  << " Welcome to " << m_appName;
354 
355  if( "" != m_appVersion ) {
356  log << MSG::ALWAYS << " version " << m_appVersion;
357  }
358  else {
359  log << MSG::ALWAYS
360  << " (GaudiCoreSvc "
361  << "v" << GAUDICORESVC_MAJOR_VERSION
362  << "r" << GAUDICORESVC_MINOR_VERSION
363 #if GAUDICORESVC_PATCH_VERSION
364  << "p" << GAUDICORESVC_PATCH_VERSION
365 #endif
366  << ")";
367  }
368 
369  // Add the host name and current time to the message
370  log << MSG::ALWAYS
371  << std::endl
372  << " "
373  << " running on " << System::hostName()
374  << " on " << Gaudi::Time::current().format(true) << std::endl
375  << "=================================================================="
376  << "=================================================================="
377  << endmsg;
378  }
379 
380  // print all own properties if the options "PropertiesPrint" is set to true
381  if ( m_propertiesPrint )
382  {
383  typedef std::vector<Property*> Properties;
384  const Properties& properties = m_propertyMgr->getProperties() ;
385  log << MSG::ALWAYS
386  << "List of ALL properties of "
387  << System::typeinfoName ( typeid( *this ) ) << "/" << this->name()
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 ; }
392  }
393 
394  // Check if StatusCode need to be checked
395  if (m_codeCheck) {
397  sc = addMultiSvc("StatusCodeSvc", -9999);
398  if ( sc.isFailure() ) {
399  log << MSG::FATAL << "Error adding StatusCodeSvc for multiple threads" << endmsg;
400  return StatusCode::FAILURE;
401  }
402  } else {
404  }
405 
406  // set the requested environment variables
407  std::map<std::string,std::string>::iterator var;
408  for ( var = m_environment.begin(); var != m_environment.end(); ++var ) {
409  const std::string &name = var->first;
410  const std::string &value = var->second;
411  std::string old = System::getEnv(name.c_str());
412  const MSG::Level lvl = (!old.empty() && (old != "UNKNOWN" ))
413  ? MSG::WARNING
414  : MSG::DEBUG;
415  if (UNLIKELY(m_outputLevel <= lvl))
416  log << lvl << "Setting " << name << " = " << value << endmsg;
417  System::setEnv(name,value);
418  }
419 
420  //Declare Service Types
421  VectorName::const_iterator j;
422  for(j=m_svcMapping.begin(); j != m_svcMapping.end(); ++j) {
424  if ( declareMultiSvcType(itm.name(), itm.type()).isFailure() ) {
425  log << MSG::ERROR << "configure: declaring svc type:'" << *j << "' failed." << endmsg;
426  return StatusCode::FAILURE;
427  }
428  }
429  for(j=m_svcOptMapping.begin(); j != m_svcOptMapping.end(); ++j) {
431  if ( declareMultiSvcType(itm.name(), itm.type()).isFailure() ) {
432  log << MSG::ERROR << "configure: declaring svc type:'" << *j << "' failed." << endmsg;
433  return StatusCode::FAILURE;
434  }
435  }
436 
437  //--------------------------------------------------------------------------
438  // Declare other Services and Algorithms by loading DLL's
439  sc = decodeDllNameList( );
440  if ( sc.isFailure( ) ) {
441  log << MSG::ERROR << "Failure loading declared DLL's" << endmsg;
442  return sc;
443  }
444 
445  //--------------------------------------------------------------------------
446  // Deal with the services explicitly declared by the user.
447  sc = decodeExtSvcNameList();
448  if ( sc.isFailure( ) ) {
449  log << MSG::ERROR << "Failure during external service association" << endmsg;
450  return sc;
451  }
452 
454  if ( sc.isFailure( ) ) {
455  log << MSG::ERROR << "Failure during multi thread service creation"
456  << endmsg;
457  return sc;
458  }
459 
461  if ( sc.isFailure( ) ) {
462  log << MSG::ERROR << "Failure during external service creation" << endmsg;
463  return sc;
464  }
465 
466 
467  //--------------------------------------------------------------------------
468  // Retrieve intrinsic services. If needed configure them.
469  //--------------------------------------------------------------------------
471  sc = addMultiSvc(evtloop_item, ServiceManager::DEFAULT_SVC_PRIORITY*10);
472  if( !sc.isSuccess() ) {
473  log << MSG::FATAL << "Error adding :" << m_eventLoopMgr << endmsg;
474  return sc;
475  }
476 
477  if (m_noOfEvtThreads == 0) {
479  if( !m_runable.isValid() ) {
480  log << MSG::FATAL
481  << "Error retrieving Runable:" << m_runableType
482  << "\n Check option ApplicationMgr." << s_runable << endmsg;
483  return sc;
484  }
485  m_processingMgr = m_svcLocator->service(evtloop_item);
486  if( !m_processingMgr.isValid() ) {
487  log << MSG::FATAL
488  << "Error retrieving Processing manager:" << m_eventLoopMgr
489  << "\n Check option ApplicationMgr." << s_eventloop
490  << "\n No events will be processed." << endmsg;
491  return sc;
492  }
493  }
494 
495  // Establish Update Handlers for ExtSvc and DLLs Properties
497  this);
499  this);
503  this );
504 
505  if (m_actHistory) {
506  // Create HistorySvc with a priority to ensure it's initialized last, finalized first
507  sc = svcManager()->addService("HistorySvc",std::numeric_limits<int>::max());
508  if ( sc.isFailure() ) {
509  log << MSG::FATAL << "Error adding HistorySvc" << endmsg;
510  return StatusCode::FAILURE;
511  }
512 
513  if (m_noOfEvtThreads > 0) {
514  sc = addMultiSvc("HistorySvc",std::numeric_limits<int>::max());
515  if ( sc.isFailure() ) {
516  log << MSG::FATAL << "Error adding HistorySvc for multiple threads"
517  << endmsg;
518  return StatusCode::FAILURE;
519  }
520  }
521  }
522 
523  log << MSG::INFO << "Application Manager Configured successfully" << endmsg;
525  return StatusCode::SUCCESS;
526 }
527 
528 //============================================================================
529 // IAppMgrUI implementation: ApplicationMgr::initialize()
530 //============================================================================
532 
534  StatusCode sc;
535 
536  // I cannot add these services in configure() because they are coming from GaudiUtils
537  // and it messes up genconf when rebuilding it.
538  if (m_stopOnSignal) {
539  // Instantiate the service that schedules a stop when a signal is received
540  std::string svcname("Gaudi::Utils::StopSignalHandler");
541  sc = svcManager()->addService(svcname);
542  if ( sc.isFailure() ) {
543  log << MSG::INFO << "Cannot instantiate " << svcname << "signals will be ignored" << endmsg;
544  }
545  }
546 
548  // Instantiate the service that schedules a stop when a signal is received
549  std::string svcname("StalledEventMonitor");
550  sc = svcManager()->addService(svcname);
551  if ( sc.isFailure() ) {
552  log << MSG::INFO << "Cannot instantiate " << svcname << "signals will be ignored" << endmsg;
553  }
554  }
555 
557  log << MSG::INFO << "Already Initialized!" << endmsg;
558  return StatusCode::SUCCESS;
559  }
561  log << MSG::FATAL
562  << "initialize: Invalid state \"" << m_state << "\"" << endmsg;
563  return StatusCode::FAILURE;
564  }
566 
567  //--------------------------------------------------------------------------
568  // Initialize the list of top Services
569  //--------------------------------------------------------------------------
570  sc = svcManager()->initialize();
571  if( !sc.isSuccess() ) return sc;
572 
573  //--------------------------------------------------------------------------
574  // Final steps: Inform user and change internal state
575  //--------------------------------------------------------------------------
576  log << MSG::INFO << "Application Manager Initialized successfully" << endmsg;
578 
579  return sc;
580 }
581 
582 //============================================================================
583 // IAppMgrUI implementation: ApplicationMgr::start()
584 //============================================================================
586 
588  StatusCode sc;
589 
591  log << MSG::INFO << "Already Initialized!" << endmsg;
592  return StatusCode::SUCCESS;
593  }
595  log << MSG::FATAL
596  << "start: Invalid state \"" << m_state << "\"" << endmsg;
597  return StatusCode::FAILURE;
598  }
600 
601  //--------------------------------------------------------------------------
602  // Initialize the list of top Services
603  //--------------------------------------------------------------------------
604  sc = svcManager()->start();
605  if( !sc.isSuccess() ) return sc;
606 
607  //--------------------------------------------------------------------------
608  // Final steps: Inform user and change internal state
609  //--------------------------------------------------------------------------
610  log << MSG::INFO << "Application Manager Started successfully" << endmsg;
612 
613  return sc;
614 }
615 
616 //============================================================================
617 // IAppMgrUI implementation: ApplicationMgr::nextEvent(int)
618 //============================================================================
622  log << MSG::FATAL << "nextEvent: Invalid state \"" << m_state << "\""
623  << endmsg;
624  return StatusCode::FAILURE;
625  }
626  if (!m_processingMgr.isValid()) {
628  log << MSG::FATAL << "No event processing manager specified. Check option:"
629  << s_eventloop << endmsg;
630  return StatusCode::FAILURE;
631  }
632  return m_processingMgr->nextEvent(maxevt);
633 }
634 
635 //============================================================================
636 // IAppMgrUI implementation: ApplicationMgr::stop()
637 //============================================================================
639 
641  StatusCode sc;
642 
644  log << MSG::INFO << "Already Initialized!" << endmsg;
645  return StatusCode::SUCCESS;
646  }
647  else if( m_state != Gaudi::StateMachine::RUNNING ) {
648  log << MSG::FATAL
649  << "stop: Invalid state \"" << m_state << "\"" << endmsg;
650  return StatusCode::FAILURE;
651  }
653 
654  // Stop independently managed Algorithms
655  sc = algManager()->stop();
656  if( !sc.isSuccess() ) return sc;
657 
658  //--------------------------------------------------------------------------
659  // Stop the list of top Services
660  //--------------------------------------------------------------------------
661  sc = svcManager()->stop();
662  if( !sc.isSuccess() ) return sc;
663 
664  //--------------------------------------------------------------------------
665  // Final steps: Inform user and change internal state
666  //--------------------------------------------------------------------------
667  log << MSG::INFO << "Application Manager Stopped successfully" << endmsg;
669 
670  return sc;
671 }
672 
673 //============================================================================
674 // IAppMgrUI implementation: ApplicationMgr::finalize()
675 //============================================================================
679  log << MSG::INFO << "Already Finalized" << endmsg;
680  return StatusCode::SUCCESS;
681  }
683  log << MSG::FATAL << "finalize: Invalid state \"" << m_state << "\""
684  << endmsg;
685  return StatusCode::FAILURE;
686  }
688 
689  // disable message suppression in finalize
690  m_svcLocator->service<IProperty>("MessageSvc")->setProperty(BooleanProperty("enableSuppression", false)).ignore();
691 
692  // Finalize independently managed Algorithms
693  StatusCode sc = algManager()->finalize();
694  if (sc.isFailure()) {
695  log << MSG::WARNING << "Failed to finalize an algorithm." << endmsg;
697  }
698 
699  // Finalize all Services
700  sc = svcManager()->finalize();
701  if (sc.isFailure()) {
702  log << MSG::WARNING << "Failed to finalize a service." << endmsg;
704  }
705 
706  //svcManager()->removeService( (IService*) m_processingMgr.get() );
707  //svcManager()->removeService( (IService*) m_runable.get() );
708 
709  if (m_codeCheck) {
711  }
712 
713  if (sc.isSuccess()) {
714  log << MSG::INFO << "Application Manager Finalized successfully" << endmsg;
715  } else {
716  log << MSG::ERROR << "Application Manager failed to finalize" << endmsg;
717  }
718 
720  return sc;
721 }
722 
723 //============================================================================
724 // IAppMgrUI implementation: ApplicationMgr::terminate()
725 //============================================================================
728 
730  log << MSG::INFO << "Already Offline" << endmsg;
731  return StatusCode::SUCCESS;
732  }
734  log << MSG::FATAL << "terminate: Invalid state \"" << m_state << "\""
735  << endmsg;
736  return StatusCode::FAILURE;
737  }
738  // release all Services
740 
742  log << MSG::INFO << "Application Manager Terminated successfully" << endmsg;
744  log << MSG::INFO << "Application Manager Terminated successfully with a user requested ScheduledStop" << endmsg;
745  } else {
746  log << MSG::ERROR << "Application Manager Terminated with error code " << m_returnCode.value() << endmsg;
747  }
748 
749  { // Force a disable the auditing of finalize for MessageSvc
751  if (prop.isValid()) {
752  prop->setProperty(BooleanProperty("AuditFinalize", false)).ignore();
753  }
754  }
755  { // Force a disable the auditing of finalize for JobOptionsSvc
757  if (prop.isValid()) {
758  prop->setProperty(BooleanProperty("AuditFinalize", false)).ignore();
759  }
760  }
761 
762  // finalize MessageSvc
764  if ( !svc.isValid() ) {
765  log << MSG::ERROR << "Could not get the IService interface of the MessageSvc" << endmsg;
766  } else {
767  svc->sysFinalize().ignore();
768  }
769 
770  // finalize JobOptionsSvc
771  svc = m_jobOptionsSvc;
772  if ( !svc.isValid() ) {
773  log << MSG::ERROR << "Could not get the IService interface of the JobOptionsSvc" << endmsg;
774  } else {
775  svc->sysFinalize().ignore();
776  }
777 
779  return StatusCode::SUCCESS;
780 }
781 
782 //============================================================================
783 // Reach the required state going through all the needed transitions
784 //============================================================================
787 
788  switch (state) {
789 
791  switch (m_state) {
793  case Gaudi::StateMachine::CONFIGURED : return terminate(); break;
794  default: // Gaudi::StateMachine::INITIALIZED or Gaudi::StateMachine::RUNNING
796  if (sc.isSuccess()) {
797  return terminate();
798  } break;
799  } break;
800 
802  switch (m_state) {
804  case Gaudi::StateMachine::OFFLINE : return configure(); break;
805  case Gaudi::StateMachine::INITIALIZED : return finalize(); break;
806  default: // Gaudi::StateMachine::RUNNING
808  if (sc.isSuccess()) {
809  return finalize();
810  } break;
811  } break;
812 
814  switch (m_state) {
816  case Gaudi::StateMachine::CONFIGURED : return initialize(); break;
817  case Gaudi::StateMachine::RUNNING : return stop(); break;
818  default: // Gaudi::StateMachine::OFFLINE
820  if (sc.isSuccess()) {
821  return initialize();
822  } break;
823  } break;
824 
826  switch (m_state) {
828  case Gaudi::StateMachine::INITIALIZED : return start(); break;
829  default: // Gaudi::StateMachine::OFFLINE or Gaudi::StateMachine::CONFIGURED
831  if (sc.isSuccess()) {
832  return start();
833  } break;
834  } break;
835 
836  }
837 
838  // If I get here, there has been a problem in the recursion
839 
840  if (ignoreFailures){
841  // force the new state
842  m_state = state;
843  return StatusCode::SUCCESS;
844  }
845 
846  return sc;
847 }
848 
849 //============================================================================
850 // IAppMgrUI implementation: ApplicationMgr::run()
851 //============================================================================
854 
856  if ( sc.isSuccess() ) {
858  if ( m_runable != 0 ) { // loop over the events
859  sc = m_runable->run();
860  if ( !sc.isSuccess() ) {
861  log << MSG::FATAL << "Application execution failed. Ending the job."
862  << endmsg;
863  }
864  } else {
865  log << MSG::FATAL << "Application has no runable object. Check option:"
866  << s_runable << endmsg;
867  }
868  }
869  if (sc.isSuccess()) { // try to close cleanly
871  }
872  // either the runable failed of the stut-down
873  if (sc.isFailure()) { // try to close anyway (but keep the StatusCode unchanged)
875  }
876  return sc;
877 }
878 
879 //============================================================================
880 // IEventProcessor implementation: executeEvent(void* par)
881 //============================================================================
885  if ( m_processingMgr.isValid() ) {
886  return m_processingMgr->executeEvent(par);
887  }
888  }
889  log << MSG::FATAL << "executeEvent: Invalid state \"" << FSMState() << "\""
890  <<endmsg;
891  return StatusCode::FAILURE;
892 }
893 
894 //============================================================================
895 // IEventProcessor implementation: executeRun(int)
896 //============================================================================
900  if ( m_processingMgr.isValid() ) {
901  return m_processingMgr->executeRun(evtmax);
902  }
903  log << MSG::WARNING << "No EventLoop Manager specified " << endmsg;
904  return StatusCode::SUCCESS;
905  }
906  log << MSG::FATAL << "executeRun: Invalid state \"" << FSMState() << "\""
907  << endmsg;
908  return StatusCode::FAILURE;
909 }
910 
911 //============================================================================
912 // IEventProcessor implementation: stopRun(int)
913 //============================================================================
917  if ( m_processingMgr.isValid() ) {
918  return m_processingMgr->stopRun();
919  }
920  log << MSG::WARNING << "No EventLoop Manager specified " << endmsg;
921  return StatusCode::SUCCESS;
922  }
923  log << MSG::FATAL << "stopRun: Invalid state \"" << FSMState() << "\""
924  << endmsg;
925  return StatusCode::FAILURE;
926 }
927 // Implementation of IAppMgrUI::name
928 const std::string& ApplicationMgr::name() const {
929  return m_name;
930 }
931 
932 // implementation of IService::state
934  return m_state;
935 }
936 // implementation of IService::state
938  return m_targetState;
939 }
940 
941 
942 //============================================================================
943 // implementation of IService::reinitilaize
944 //============================================================================
947  StatusCode sc;
949  throw GaudiException("Cannot reinitialize application if not INITIALIZED or RUNNING",
950  "ApplicationMgr::reinitialize", StatusCode::FAILURE);
951  }
954  }
955  sc = svcManager()->reinitialize();
956  if (sc.isFailure()) retval = sc;
957  sc = algManager()->reinitialize();
958  if (sc.isFailure()) retval = sc;
959  return retval;
960 }
961 
962 //============================================================================
963 // implementation of IService::reinitiaize
964 //============================================================================
967  StatusCode sc;
969  throw GaudiException("Cannot restart application if not RUNNING",
970  "ApplicationMgr::restart", StatusCode::FAILURE);
971  }
972  sc = svcManager()->restart();
973  if (sc.isFailure()) retval = sc;
974  sc = algManager()->restart();
975  if (sc.isFailure()) retval = sc;
976  return retval;
977 }
978 
979 //============================================================================
980 // SI Go Handler
981 //============================================================================
983 
985  StatusCode sc;
986 
987  // Re-initialize everything
988  sc = reinitialize();
989  // Execute a number of events
991 
992  return;
993 }
994 
995 //============================================================================
996 // SI Exit Handler
997 //============================================================================
999  StatusCode status;
1000  status = finalize();
1001  status = terminate();
1002  ::exit( 0 );
1003 }
1004 
1005 //============================================================================
1006 // Handle properties of the event loop manager (Top alg/Output stream list)
1007 //============================================================================
1009  if ( m_processingMgr.isValid() ) {
1011  if ( props.isValid() ) {
1012  props->setProperty( p ).ignore();
1013  }
1014  }
1015 }
1016 
1017 //============================================================================
1018 // External Service List handler
1019 //============================================================================
1021  if ( !(decodeCreateSvcNameList()).isSuccess() ) {
1022  throw GaudiException("Failed to create ext services",
1023  "MinimalEventLoopMgr::createSvcNameListHandler",
1025  }
1026 }
1027 //============================================================================
1028 // decodeCreateSvcNameList
1029 //============================================================================
1032  const std::vector<std::string>& theNames = m_createSvcNameList.value( );
1033  VectorName::const_iterator it(theNames.begin());
1034  VectorName::const_iterator et(theNames.end());
1035  while(result.isSuccess() && it != et) {
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;
1041  } else {
1042  ON_DEBUG {
1044  log << MSG::DEBUG << "decodeCreateSvcNameList: Created service "
1045  << item.type() << "/" << item.name() << endmsg;
1046  }
1047  }
1048  }
1049  return result;
1050 }
1051 
1052 //============================================================================
1053 // External Service List handler
1054 //============================================================================
1056  if ( !(decodeExtSvcNameList( )).isSuccess() ) {
1057  throw GaudiException("Failed to declare ext services",
1058  "MinimalEventLoopMgr::extSvcNameListHandler",
1060  }
1061 }
1062 
1063 //============================================================================
1064 // decodeExtSvcNameList
1065 //============================================================================
1068 
1069  std::vector<std::string> theNames = m_extSvcNameList.value( );
1070 
1071  VectorName::const_iterator it(theNames.begin());
1072  VectorName::const_iterator et(theNames.end());
1073  while(result.isSuccess() && it != et) {
1075  if (m_extSvcCreates == true) {
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;
1080  }
1081  } else {
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;
1087  }
1088  }
1089  }
1090  return result;
1091 }
1092 
1093 //============================================================================
1094 // External Service List handler
1095 //============================================================================
1097  if ( !(decodeMultiThreadSvcNameList( )).isSuccess() ) {
1098  throw GaudiException("Failed to create copies of mt services",
1099  "MinimalEventLoopMgr::multiThreadSvcNameListHandler",
1101  }
1102 
1103 }
1104 
1105 //============================================================================
1106 // decodeMultiExtSvcNameList
1107 //============================================================================
1110  const std::vector<std::string>& theNames = m_multiThreadSvcNameList.value( );
1111  for(int iCopy=0; iCopy<m_noOfEvtThreads; ++iCopy) {
1112  for (VectorName::const_iterator it = theNames.begin();
1113  it != theNames.end();
1114  ++it) {
1117  //FIXME SHOULD CLONE?
1118  if( result.isFailure() ) {
1120  log << MSG::ERROR
1121  << "decodeMultiThreadSvcNameList: Cannot create service "
1122  << item.type() << "/" << item.name() << endmsg;
1123  } else {
1124  ON_VERBOSE {
1126  log << MSG::VERBOSE
1127  << "decodeMultiThreadSvcNameList: created service "
1128  << item.type() << "/" << item.name() << endmsg;
1129  }
1130  }
1131  }
1132  }
1133  return result;
1134 }
1135 //=============================================================================
1136 // declareMultiSvcType
1137 //=============================================================================
1139  const std::string& type) {
1142  if (0 == m_noOfEvtThreads) {
1143  result = svcManager()->declareSvcType(name, type);
1144  if( result.isFailure() ) {
1145  log << MSG::ERROR << "declareMultiSvcType: Cannot declare service "
1146  << type << "/" << name << endmsg;
1147  } else {
1148  ON_VERBOSE
1149  log << MSG::VERBOSE << "declareMultiSvcType: declared service "
1150  << type << "/" << name << endmsg;
1151  }
1152  } else {
1153  for(int iCopy=0; iCopy<m_noOfEvtThreads; ++iCopy) {
1154  std::string thrName(name + getGaudiThreadIDfromID(iCopy));
1155  result = svcManager()->declareSvcType(thrName, type);
1156  if( result.isFailure() ) {
1157  log << MSG::ERROR << "declareMultiSvcType: Cannot declare service "
1158  << type << "/" << thrName << endmsg;
1159  } else {
1160  ON_VERBOSE
1161  log << MSG::VERBOSE << "declareMultiSvcType: declared service "
1162  << type << "/" << thrName << endmsg;
1163  }
1164  }
1165  }
1166  return result;
1167 }
1168 //=============================================================================
1169 // addMultiSvc
1170 //=============================================================================
1172  int prio) {
1176  if (0 == m_noOfEvtThreads) {
1177  result = svcManager()->addService(typeName, prio);
1178  // result = svcManager()->addService(name, type, prio); // CHECKME???
1179  if( result.isFailure() ) {
1180  log << MSG::ERROR << "addMultiSvc: Cannot add service "
1181  << typeName.type() << "/" << typeName.name() << endmsg;
1182  } else {
1183  ON_VERBOSE
1184  log << MSG::VERBOSE << "addMultiSvc: added service "
1185  << typeName.type() << "/" << typeName.name() << endmsg;
1186  }
1187  } else {
1188  for(int iCopy=0; iCopy<m_noOfEvtThreads; ++iCopy) {
1189  const std::string &type = typeName.type();
1190  std::string thrName(typeName.name() + getGaudiThreadIDfromID(iCopy));
1191  result = svcManager()->addService(TypeNameString(thrName, type), prio);
1192  if( result.isFailure() ) {
1193  log << MSG::ERROR << "addMultiSvc: Cannot add service "
1194  << type << "/" << thrName << endmsg;
1195  } else {
1196  ON_VERBOSE
1197  log << MSG::VERBOSE << "addMultiSvc: added service "
1198  << type << "/" << thrName << endmsg;
1199  }
1200  }
1201  }
1202  return result;
1203 }
1204 
1205 //============================================================================
1206 // Dll List handler
1207 //============================================================================
1209  if ( !(decodeDllNameList( )).isSuccess() ) {
1210  throw GaudiException("Failed to load DLLs.",
1211  "MinimalEventLoopMgr::dllNameListHandler",
1213  }
1214 }
1215 
1216 //============================================================================
1217 // decodeDllNameList
1218 //============================================================================
1220 
1223 
1224  // Clean up multiple entries from DLL list
1225  // -------------------------------------------------------------------------
1226  std::vector<std::string> newList;
1227  std::map<std::string,unsigned int> dllInList, duplicateList;
1228  {for ( std::vector<std::string>::const_iterator it = m_dllNameList.value().begin();
1229  it != m_dllNameList.value().end(); ++it ) {
1230  if ( 0 == dllInList[*it] ) {
1231  newList.push_back(*it); // first instance of this module
1232  } else { ++duplicateList[*it]; } // module listed multiple times
1233  ++dllInList[*it]; // increment count for this module
1234  }}
1235  //m_dllNameList = newList; // update primary list to new, filtered list (do not use the
1236  // property itself otherwise we get called again infinitely)
1237  // List modules that were in there twice..
1238  ON_DEBUG if ( !duplicateList.empty() ) {
1239  log << MSG::DEBUG << "Removed duplicate entries for modules : ";
1240  for ( std::map<std::string,unsigned int>::const_iterator it = duplicateList.begin();
1241  it != duplicateList.end(); ++it ) {
1242  log << it->first << "(" << 1+it->second << ")";
1243  if ( it != --duplicateList.end() ) log << ", ";
1244  }
1245  log << endmsg;
1246  }
1247  // -------------------------------------------------------------------------
1248 
1249  const std::vector<std::string>& theNames = newList;
1250 
1251  // only load the new dlls or previously failed dlls
1252  ON_DEBUG log << MSG::DEBUG << "Loading declared DLL's" << endmsg;
1253 
1254  std::vector<std::string> successNames, failNames;
1255  std::vector<std::string>::const_iterator it;
1256 
1257  for (it = theNames.begin(); it != theNames.end(); it++) {
1258  if (std::find (m_okDlls.rbegin(), m_okDlls.rend(), *it) == m_okDlls.rend()){
1259  // found a new module name
1260  StatusCode status = m_classManager->loadModule( (*it) );
1261  if( status.isFailure() ) {
1262  failNames.push_back(*it);
1263  result = StatusCode::FAILURE;
1264  }
1265  else {
1266  successNames.push_back(*it);
1267  }
1268  }
1269  }
1270 
1271  // report back to the user and store the names of the succesfully loaded dlls
1272  if ( !successNames.empty() ) {
1273  log << MSG::INFO << "Successfully loaded modules : ";
1274  for (it = successNames.begin(); it != successNames.end(); it++) {
1275  log<< (*it);
1276  if( (it+1) != successNames.end()) log << ", ";
1277  // save name
1278  m_okDlls.push_back( *it );
1279  }
1280  log << endmsg;
1281  }
1282 
1283  if ( result == StatusCode::FAILURE ) {
1284  log << MSG::WARNING << "Failed to load modules: ";
1285  for (it = failNames.begin(); it != failNames.end(); it++) {
1286  log<< (*it);
1287  if( (it+1) != failNames.end()) log << ", ";
1288  }
1289  log << endmsg;
1290  }
1291  return result;
1292 }
1293 
1294 //============================================================================
1295 // Plugin debug level handler
1296 //============================================================================
1298 {
1299  // Setup debug level for the plugin system
1301  log << MSG::INFO
1302  << "Updating Gaudi::PluginService::SetDebug(level) to level="
1303  << (int)m_pluginDebugLevel
1304  << endmsg;
1306 }
1307 
1308 //============================================================================
1309 // Init loop check handler
1310 //============================================================================
1312  svcManager()->setLoopCheckEnabled(m_loopCheck);
1313 }
The ServiceManager class is in charge of the creation of concrete instances of Services.
void dllNameListHandler(Property &theProp)
Gaudi::StateMachine::State m_targetState
Internal State.
GAUDI_API std::string getEnv(const char *var)
get a particular environment variable (returning "UNKNOWN" if not set)
Definition: System.cpp:608
The AlgorithmManager class is in charge of the creation of concrete instances of Algorithms.
StatusCode setProperty(IProperty *component, const std::string &name, const TYPE &value, const std::string &doc)
simple function to set the property of the given object from the value
Definition: Property.h:1212
virtual Gaudi::StateMachine::State FSMState() const
Get the current state.
std::string m_jobOptionsType
Source type (e.g. dbase, file...)
StringArrayProperty m_createSvcNameList
#define UNLIKELY(x)
Definition: Kernel.h:127
void createSvcNameListHandler(Property &)
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
StringProperty m_messageSvcType
MessageSvc type.
Define general base for Gaudi exception.
StatusCode decodeDllNameList()
GAUDI_API int setEnv(const std::string &name, const std::string &value, int overwrite=1)
Set an environment variables.
Definition: System.cpp:746
SmartIF< IRunable > m_runable
Reference to the runable object.
tuple itm
Definition: ana.py:57
virtual ~ApplicationMgr()
MSG::Level level()
Retrieve output level.
Definition: MsgStream.h:112
virtual StatusCode executeEvent(void *par)
implementation of IEventProcessor::executeEvent(void*)
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:298
int m_noOfEvtThreads
no of multiThreadSvc copies
unsigned long id() const
get the interface identifier
Definition: IInterface.h:78
bool m_codeCheck
Activate StatusCode checking.
static Time current(void)
Returns the current time.
Definition: Time.cpp:114
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
std::string m_appName
The name of the application.
IntegerProperty m_pluginDebugLevel
Debug level for the plugin system.
static GAUDI_API void enableChecking()
Definition: StatusCode.cpp:19
std::vector< std::string > m_okDlls
names of successfully loaded dlls
std::map< std::string, std::string > m_environment
Environment variables to set.
State
Allowed states for classes implementing the state machine (ApplicationMgr, Algorithm, Service, AlgTool).
Definition: StateMachine.h:12
virtual StatusCode restart()
Initialization (from RUNNING to RUNNING, via INITIALIZED).
StringArrayProperty m_dllNameList
List of DDL's names.
SimpleProperty< bool > BooleanProperty
Definition: Property.h:727
SmartIF< IJobOptionsSvc > m_jobOptionsSvc
Reference to JobOption service.
AlgTypeAliasesMap & typeAliases()
Property manager helper class.
Definition: PropertyMgr.h:38
virtual Gaudi::StateMachine::State targetFSMState() const
When we are in the middle of a transition, get the state where the transition is leading us...
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:85
SmartIF< IEventProcessor > m_processingMgr
Reference to processing manager object.
SmartIF< ISvcManager > & svcManager()
SimpleProperty< std::string > StringProperty
Definition: Property.h:743
int m_outputLevel
Message output level.
virtual StatusCode run()
Run the complete job (from initialize to terminate)
DLLClassManager * m_classManager
Reference to the class manager.
PropertyMgr * m_propertyMgr
Reference to Property Manager.
StatusCode addMultiSvc(const Gaudi::Utils::TypeNameString &typeName, int prio)
add one or more copies of svc type/name as determined by NoOfThreads
const int FinalizationFailure
Error codes for operation failures.
Definition: AppReturnCode.h:32
Gaudi::InterfaceId< IInterface, 0, 0 > iid
Interface ID.
Definition: IInterface.h:164
virtual StatusCode stopRun()
implementation of IEventProcessor::stopRun()
int m_evtMax
Number of events to be processed.
virtual void declareUpdateHandler(PropertyCallbackFunctor *pf)
set new callback for update
Definition: Property.cpp:141
IntegerProperty m_returnCode
Property to record the error conditions occurring during the running.
void multiThreadSvcNameListHandler(Property &theProp)
Interface ID class.
Definition: IInterface.h:55
GAUDIPS_API void SetDebug(int debugLevel)
Backward compatibility with Reflex.
virtual const std::string & name() const
This is needed to avoid ambiguous calls to name()
Helper class to parse a string of format "type/name".
Definition: TypeNameString.h:9
string type
Definition: gaudirun.py:126
virtual StatusCode start()
Start (from INITIALIZED to RUNNING).
bool isValid() const
Allow for check if smart pointer is valid.
Definition: SmartIF.h:51
std::string m_jobOptionsPath
The "file" to look for properties.
BooleanProperty m_extSvcCreates
LHCb or ATLAS defn of "ExtSvc".
VectorName m_svcMapping
Default mapping of services.
#define ON_DEBUG
SmartIF< ISvcLocator > m_svcLocator
Reference to its own service locator.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
Definition of the basic interface.
Definition: IInterface.h:160
bool m_actHistory
Activate HistorySvc.
#define DECLARE_OBJECT_FACTORY(x)
Definition: ObjectFactory.h:17
BooleanProperty m_loopCheck
For ServiceMgr initialization loop checking.
GAUDI_API std::string getGaudiThreadIDfromID(int iCopy)
helper function to extract Gaudi Thread ID from thread copy number
Definition: ThreadGaudi.cpp:18
virtual StatusCode reinitialize()
Initialization (from INITIALIZED or RUNNING to INITIALIZED, via CONFIGURED).
StatusCode GoToState(Gaudi::StateMachine::State state, bool ignoreFailures=false)
Reach a state from current state (whichever it is) going through the correct transitions.
static const int DEFAULT_SVC_PRIORITY
Definition: ISvcManager.h:34
SimpleProperty< int > IntegerProperty
Definition: Property.h:733
const TYPE & value() const
explicit conversion
Definition: Property.h:355
StringArrayProperty m_multiThreadSvcNameList
List of external services names for which we want a copy per evt thread.
virtual StatusCode queryInterface(const InterfaceID &iid, void **pinterface)
Set the void** to the pointer to the requested interface of the instance.
VectorName m_svcOptMapping
Default mapping of services.
GAUDI_API bool isEnvSet(const char *var)
Check if an environment variable is set or not.
Definition: System.cpp:628
The Application Manager class.
virtual StatusCode stop()
Stop (from RUNNING to INITIALIZED).
std::string m_runableType
Runable type.
StatusCode decodeExtSvcNameList()
const std::vector< Property * > & getProperties() const
get all properties
GAUDI_API const std::string & hostName()
Host name.
Definition: System.cpp:427
void initLoopCheckHndlr(Property &)
bool m_propertiesPrint
flag to activate the printout of properties
Property base class allowing Property* collections to be "homogeneous".
Definition: Property.h:43
void SIGoHandler(Property &theProp)
virtual unsigned long release()=0
Release Interface instance.
StringArrayProperty m_extSvcNameList
List of external services names.
StringProperty m_jobOptionsSvcType
JobOptionsSvc type.
const std::string & type() const
StatusCode decodeCreateSvcNameList()
void evtLoopPropertyHandler(Property &theProp)
const int ScheduledStop
Definition: AppReturnCode.h:25
virtual StatusCode nextEvent(int maxevt)
Process the next maxevt events.
BooleanProperty m_stalledEventMonitoring
Property to enable/disable the monitoring and reporting of stalled events (enabled by default)...
std::string m_eventLoopMgr
Processing manager type.
virtual StatusCode finalize()
Finalize the job.
tuple item
print s1,s2
Definition: ana.py:146
void SIExitHandler(Property &theProp)
MsgStream & fatal() const
shortcut for the method msgStream(MSG::FATAL)
StatusCode i_startup()
Internal startup routine.
std::string m_name
Name.
static GAUDI_API void disableChecking()
Definition: StatusCode.cpp:23
virtual StatusCode initialize()
Initialize the job.
#define ON_VERBOSE
Gaudi::StateMachine::State m_state
Internal State.
const std::string & name() const
void ignore() const
Definition: StatusCode.h:107
std::string typeName(const std::type_info &typ)
Definition: Dictionary.cpp:22
StatusCode decodeMultiThreadSvcNameList()
virtual StatusCode terminate()
Terminate the job.
The IProperty is the basic interface for all components which have properties that can be set or get...
Definition: IProperty.h:22
SmartIF< IAlgManager > & algManager()
void extSvcNameListHandler(Property &theProp)
void pluginDebugPropertyHandler(Property &theProp)
BooleanProperty m_stopOnSignal
Property to enable/disable the "stop on signal" service (enabled by default).
static const InterfaceID & interfaceID()
Return an instance of InterfaceID identifying the interface.
Definition: IInterface.h:171
std::string m_appVersion
The version of the application.
SmartIF< IMessageSvc > m_messageSvc
Reference to the message service.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
virtual StatusCode loadModule(const std::string &module, bool fireIncident=true)
Declare a sharable library to be used for creating instances of a given algorithm type...
virtual StatusCode executeRun(int evtmax)
implementation of IEventProcessor::executeRun(int)
virtual StatusCode configure()
Configure the job.
std::string format(bool local, std::string spec="%c") const
Format the time using strftime.
Definition: Time.cpp:280
StatusCode declareMultiSvcType(const std::string &name, const std::string &type)
declare one or more copies of svc type/name as determined by NoOfThreads