The Gaudi Framework  v36r9p1 (5c15b2bb)
ApplicationMgr.cpp
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations *
3 * *
4 * This software is distributed under the terms of the Apache version 2 licence, *
5 * copied verbatim in the file "LICENSE". *
6 * *
7 * In applying this licence, CERN does not waive the privileges and immunities *
8 * granted to it by virtue of its status as an Intergovernmental Organization *
9 * or submit itself to any jurisdiction. *
10 \***********************************************************************************/
11 
12 // Include files
13 #include "ApplicationMgr.h"
14 
15 #include "AlgorithmManager.h"
16 #include "DLLClassManager.h"
17 #include "ServiceManager.h"
18 
20 #include "GaudiKernel/IRunable.h"
21 #include "GaudiKernel/IService.h"
23 
24 #include "GaudiKernel/MsgStream.h"
26 #include "GaudiKernel/SmartIF.h"
27 
29 
30 #include "GaudiKernel/StatusCode.h"
31 #include "GaudiKernel/System.h"
32 #include "GaudiKernel/Time.h"
33 
34 #include "GAUDI_VERSION.h"
35 
36 using System::getEnv;
37 using System::isEnvSet;
38 
39 #include <algorithm>
40 #include <cassert>
41 #include <ctime>
42 #include <limits>
43 #include <sstream>
44 
45 #define ON_DEBUG if ( m_outputLevel <= MSG::DEBUG )
46 #define ON_VERBOSE if ( m_outputLevel <= MSG::VERBOSE )
47 
49 
50 // Implementation class for the Application Manager. In this way the
51 // ApplicationMgr class is a fully insulated concrete class. Clients
52 // (main programs) will not need to re-compile if there are changes
53 // in the implementation
54 
55 //=======================================================================
56 // Constructor
57 //=======================================================================
59  // IInterface initialization
60  addRef(); // Initial count set to 1
61 
62  // Instantiate component managers
63  m_managers[IService::interfaceID().id()] = new ServiceManager( this );
64 
65  m_svcLocator = svcManager();
66 
67  // Instantiate internal services
68  // SvcLocator/Factory HAS to be already instantiated
69  m_classManager = new DLLClassManager( this );
70 
71  AlgorithmManager* algMgr = new AlgorithmManager( this );
72  m_managers[IAlgorithm::interfaceID().id()] = algMgr;
73  // m_managers[IAlgorithm::interfaceID().id()] = new HiveAlgorithmManager(this);
74 
75  // This property is not hosted in the ApplicationMgr instance
76  declareProperty( "AlgTypeAliases", algMgr->typeAliases(),
77  "Aliases of algorithm types, to replace an algorithm type for every instance" );
78 
79  // ServiceMgr Initialization loop checking
80  svcManager()->setLoopCheckEnabled( m_loopCheck );
81 
82  m_svcMapping = { "EvtDataSvc/EventDataSvc",
83  "DetDataSvc/DetectorDataSvc",
84  "HistogramSvc/HistogramDataSvc",
85  "HbookCnv::PersSvc/HbookHistSvc",
86  "RootHistCnv::PersSvc/RootHistSvc",
87  "EvtPersistencySvc/EventPersistencySvc",
88  "DetPersistencySvc/DetectorPersistencySvc",
89  "HistogramPersistencySvc/HistogramPersistencySvc" };
90 }
91 
92 //============================================================================
93 // IInterface implementation: queryInterface::addRef()
94 //============================================================================
96  if ( !ppvi ) { return StatusCode::FAILURE; }
97 
98  // try to find own/direct interfaces:
99  StatusCode sc = base_class::queryInterface( iid, ppvi );
100  if ( sc.isSuccess() ) return sc;
101 
102  // find indirect interfaces :
103  if ( ISvcLocator::interfaceID().versionMatch( iid ) ) { return serviceLocator()->queryInterface( iid, ppvi ); }
104  if ( ISvcManager::interfaceID().versionMatch( iid ) ) { return svcManager()->queryInterface( iid, ppvi ); }
105  if ( IAlgManager::interfaceID().versionMatch( iid ) ) { return algManager()->queryInterface( iid, ppvi ); }
106  if ( IClassManager::interfaceID().versionMatch( iid ) ) { return m_classManager->queryInterface( iid, ppvi ); }
107  if ( IMessageSvc::interfaceID().versionMatch( iid ) ) {
108  *ppvi = m_messageSvc.get();
109  if ( m_messageSvc ) m_messageSvc->addRef();
110  // Note that 0 can be a valid IMessageSvc pointer value (when used for
111  // MsgStream).
112  return StatusCode::SUCCESS;
113  }
114  *ppvi = nullptr;
115  return StatusCode::FAILURE;
116 }
117 
118 //============================================================================
119 // ApplicationMgr::i_startup()
120 //============================================================================
122 
123  StatusCode sc;
124 
125  // declare factories in current module
126  m_classManager->loadModule( "" ).ignore();
127 
128  // Note: we cannot use CommonMessaging methods here because MessageSvc is not there yet
129  MsgStream log( nullptr, name() );
130 
131  // Create the Message service
132  auto msgsvc = svcManager()->createService( Gaudi::Utils::TypeNameString( "MessageSvc", m_messageSvcType ) );
133  if ( !msgsvc ) {
134  log << MSG::FATAL << "Error creating MessageSvc of type " << m_messageSvcType << endmsg;
135  return StatusCode::FAILURE;
136  }
137  // Get the useful interface from Message services
138  m_messageSvc = m_svcLocator->service( "MessageSvc" );
139  if ( !m_messageSvc ) {
140  log << MSG::FATAL << "Error retrieving MessageSvc." << endmsg;
141  return StatusCode::FAILURE;
142  }
143  sc = m_messageSvc.as<IProperty>()->setProperty( "OutputLevel", m_outputLevel );
144  if ( !sc ) {
145  log << MSG::FATAL << "Error setting OutputLevel option of MessageSvc" << endmsg;
146  return sc;
147  }
148 
149  auto jobsvc = svcManager()->createService( Gaudi::Utils::TypeNameString( "JobOptionsSvc", m_jobOptionsSvcType ) );
150  // Create the Job Options service
151  if ( !jobsvc ) {
152  log << MSG::FATAL << "Error creating JobOptionsSvc" << endmsg;
153  return StatusCode::FAILURE;
154  }
155 
156  auto jobOptsIProp = jobsvc.as<IProperty>();
157  if ( !jobOptsIProp ) {
158  log << MSG::FATAL << "Error locating JobOptionsSvc" << endmsg;
159  return StatusCode::FAILURE;
160  }
161  sc = jobOptsIProp->setProperty( Gaudi::Property<std::string>( "TYPE", m_jobOptionsType ) );
162  if ( !sc.isSuccess() ) {
163  log << MSG::FATAL << "Error setting TYPE option in JobOptionsSvc" << endmsg;
164  return sc;
165  }
166 
167  if ( !m_jobOptionsPreAction.empty() ) {
168  sc = jobOptsIProp->setProperty( Gaudi::Property<std::string>( "PYTHONPARAMS", m_jobOptionsPreAction ) );
169  if ( !sc.isSuccess() ) {
170  log << MSG::FATAL << "Error setting JobOptionsPreAction option in JobOptionsSvc" << endmsg;
171  return sc;
172  }
173  }
174 
175  if ( !m_jobOptionsPostAction.empty() ) {
176  sc = jobOptsIProp->setProperty( Gaudi::Property<std::string>( "PYTHONACTION", m_jobOptionsPostAction ) );
177  if ( !sc.isSuccess() ) {
178  log << MSG::FATAL << "Error setting JobOptionsPostAction option in JobOptionsSvc" << endmsg;
179  return sc;
180  }
181  }
182 
183  if ( !m_jobOptionsPath.empty() ) { // The command line takes precedence
184  sc = jobOptsIProp->setProperty( Gaudi::Property<std::string>( "PATH", m_jobOptionsPath ) );
185  if ( !sc.isSuccess() ) {
186  log << MSG::FATAL << "Error setting PATH option in JobOptionsSvc" << endmsg;
187  return sc;
188  }
189  } else if ( isEnvSet( "JOBOPTPATH" ) ) { // Otherwise the Environment JOBOPTPATH
190  sc = jobOptsIProp->setProperty( Gaudi::Property<std::string>( "PATH", getEnv( "JOBOPTPATH" ) ) );
191  if ( !sc.isSuccess() ) {
192  log << MSG::FATAL << "Error setting PATH option in JobOptionsSvc from env" << endmsg;
193  return sc;
194  }
195  } else { // Otherwise the default
196  sc = jobOptsIProp->setProperty( Gaudi::Property<std::string>( "PATH", "../options/job.opts" ) );
197  if ( !sc.isSuccess() ) {
198  log << MSG::FATAL << "Error setting PATH option in JobOptionsSvc to default" << endmsg;
199  return sc;
200  }
201  }
202  jobOptsIProp.reset();
203 
204  // Sets my default the Output Level of the Message service to be
205  // the same as this
206  auto msgSvcIProp = msgsvc.as<IProperty>();
207  msgSvcIProp->setProperty( Gaudi::Property<int>( "OutputLevel", m_outputLevel ) ).ignore();
208  msgSvcIProp.reset();
209 
210  sc = jobsvc->sysInitialize();
211  if ( !sc.isSuccess() ) {
212  log << MSG::FATAL << "Error initializing JobOptionsSvc" << endmsg;
213  return sc;
214  }
215  sc = msgsvc->sysInitialize();
216  if ( !sc.isSuccess() ) {
217  log << MSG::FATAL << "Error initializing MessageSvc" << endmsg;
218  return sc;
219  }
220 
221  // Make sure output level caches are up to date.
223 
224  return sc;
225 }
226 
227 //============================================================================
228 // IAppMgrUI implementation: ApplicationMgr::configure()
229 //============================================================================
231 
232  // Check if the state is compatible with the transition
233  MsgStream tlog( m_messageSvc, name() );
235  tlog << MSG::INFO << "Already Configured" << endmsg;
236  return StatusCode::SUCCESS;
237  }
239  tlog << MSG::FATAL << "configure: Invalid state \"" << m_state << "\"" << endmsg;
240  return StatusCode::FAILURE;
241  }
243 
244  // Reset application return code.
246 
247  StatusCode sc;
248  sc = i_startup();
249  if ( !sc.isSuccess() ) { return sc; }
250 
251  {
253  // Get my own options using the Job options service
254  if ( log.level() <= MSG::DEBUG ) log << MSG::DEBUG << "Getting my own properties" << endmsg;
255  bindPropertiesTo( serviceLocator()->getOptsSvc() );
256  }
257 
258  // Make sure that the OutputLevel is in sync
259  if ( m_outputLevel != MSG::NIL && m_messageSvc ) m_messageSvc->setOutputLevel( name(), m_outputLevel );
261 
262  // Check current outputLevel to eventually inform the MessageSvc
263  if ( m_outputLevel != MSG::NIL && !m_appName.empty() ) {
264  // Print a welcome message
266  << "=================================================================="
267  << "==================================================================" << std::endl
268  << " "
269  << " Welcome to " << m_appName.value();
270 
271  if ( !m_appVersion.empty() ) {
272  log << MSG::ALWAYS << " version " << m_appVersion.value();
273  } else {
274  log << MSG::ALWAYS << " (GaudiCoreSvc "
275  << "v" << GAUDI_MAJOR_VERSION << "r" << GAUDI_MINOR_VERSION
276 #if GAUDI_PATCH_VERSION
277  << "p" << GAUDI_PATCH_VERSION
278 #endif
279  << ")";
280  }
281 
282  // Add the host name and current time to the message
284  << " "
285  << " running on " << System::hostName() << " on " << Gaudi::Time::current().format( true ) << std::endl
286  << "=================================================================="
287  << "==================================================================" << endmsg;
288  }
289 
290  // print all own properties if the options "PropertiesPrint" is set to true
291  if ( m_propertiesPrint ) {
292  const auto& properties = getProperties();
293  log << MSG::ALWAYS << "List of ALL properties of " << System::typeinfoName( typeid( *this ) ) << "/" << this->name()
294  << " #properties = " << properties.size() << endmsg;
295  for ( const auto& property : properties ) { log << "Property ['Name': Value] = " << *property << endmsg; }
296  }
297 
298  // set the requested environment variables
299  for ( auto& var : m_environment ) {
300  const std::string& name = var.first;
301  const std::string& value = var.second;
303  const MSG::Level lvl = ( !old.empty() && ( old != "UNKNOWN" ) ) ? MSG::WARNING : MSG::DEBUG;
304  if ( m_outputLevel <= lvl ) log << lvl << "Setting " << name << " = " << value << endmsg;
305  System::setEnv( name, value );
306  }
307 
308  // Declare Service Types
309  for ( auto& j : m_svcMapping ) {
311  if ( svcManager()->declareSvcType( itm.name(), itm.type() ).isFailure() ) {
312  log << MSG::ERROR << "configure: declaring svc type:'" << j << "' failed." << endmsg;
313  return StatusCode::FAILURE;
314  } else {
315  ON_VERBOSE
316  log << MSG::VERBOSE << "declared service " << j << endmsg;
317  }
318  }
319  for ( auto& j : m_svcOptMapping ) {
321  if ( svcManager()->declareSvcType( itm.name(), itm.type() ).isFailure() ) {
322  log << MSG::ERROR << "declaring svc type:'" << j << "' failed." << endmsg;
323  return StatusCode::FAILURE;
324  }
325  }
326 
327  //--------------------------------------------------------------------------
328  // Declare other Services and Algorithms by loading DLL's
329  sc = decodeDllNameList();
330  if ( sc.isFailure() ) {
331  log << MSG::ERROR << "Failure loading declared DLL's" << endmsg;
332  return sc;
333  }
334 
335  //--------------------------------------------------------------------------
336  // Deal with the services explicitly declared by the user.
337  sc = decodeExtSvcNameList();
338  if ( sc.isFailure() ) {
339  log << MSG::ERROR << "Failure during external service association" << endmsg;
340  return sc;
341  }
342 
344  if ( sc.isFailure() ) {
345  log << MSG::ERROR << "Failure during external service creation" << endmsg;
346  return sc;
347  }
348 
349  //--------------------------------------------------------------------------
350  // Retrieve intrinsic services. If needed configure them.
351  //--------------------------------------------------------------------------
352  const Gaudi::Utils::TypeNameString evtloop_item( m_eventLoopMgr );
353  sc = svcManager()->addService( evtloop_item, ServiceManager::DEFAULT_SVC_PRIORITY * 10 );
354  if ( !sc.isSuccess() ) {
355  log << MSG::FATAL << "Error adding :" << m_eventLoopMgr << endmsg;
356  return sc;
357  } else {
358  ON_VERBOSE
359  log << MSG::VERBOSE << "added service " << evtloop_item << endmsg;
360  }
361 
362  m_runable = m_svcLocator->service( m_runableType );
363  if ( !m_runable ) {
364  log << MSG::FATAL << "Error retrieving Runable: " << m_runableType.value() << "\n Check option ApplicationMgr."
365  << m_runableType.name() << endmsg;
366  return sc;
367  }
368  m_processingMgr = m_svcLocator->service( evtloop_item );
369  if ( !m_processingMgr ) {
370  log << MSG::FATAL << "Error retrieving Processing manager: " << m_eventLoopMgr.value()
371  << "\n Check option ApplicationMgr." << m_eventLoopMgr.name() << "\n No events will be processed." << endmsg;
372  return sc;
373  }
374  // The IEventProcessor might also be an IQueueingEventProcessor
376 
377  // Establish Update Handlers for ExtSvc and DLLs Properties
381 
382  if ( m_actHistory ) {
383  // Create HistorySvc with a priority to ensure it's initialized last, finalized first
384  sc = svcManager()->addService( "HistorySvc", std::numeric_limits<int>::max() );
385  if ( sc.isFailure() ) {
386  log << MSG::FATAL << "Error adding HistorySvc" << endmsg;
387  return StatusCode::FAILURE;
388  }
389  }
390 
391  log << MSG::INFO << "Application Manager Configured successfully" << endmsg;
393  return StatusCode::SUCCESS;
394 }
395 
396 //============================================================================
397 // IAppMgrUI implementation: ApplicationMgr::initialize()
398 //============================================================================
400  StatusCode sc;
401 
403 
404  // Make sure output level caches are up to date.
406 
407  // I cannot add these services in configure() because they are coming from GaudiUtils
408  // and it messes up genconf when rebuilding it.
409  if ( m_stopOnSignal ) {
410  // Instantiate the service that schedules a stop when a signal is received
411  std::string svcname( "Gaudi::Utils::StopSignalHandler" );
412  sc = svcManager()->addService( svcname );
413  if ( sc.isFailure() ) {
414  log << MSG::INFO << "Cannot instantiate " << svcname << "signals will be ignored" << endmsg;
415  }
416  }
417 
418  if ( m_stalledEventMonitoring ) {
419  // Instantiate the service that schedules a stop when a signal is received
420  std::string svcname( "StalledEventMonitor" );
421  sc = svcManager()->addService( svcname );
422  if ( sc.isFailure() ) {
423  log << MSG::INFO << "Cannot instantiate " << svcname << "signals will be ignored" << endmsg;
424  }
425  }
426 
428  log << MSG::INFO << "Already Initialized!" << endmsg;
429  return StatusCode::SUCCESS;
430  }
432  log << MSG::FATAL << "initialize: Invalid state \"" << m_state << "\"" << endmsg;
433  return StatusCode::FAILURE;
434  }
436 
437  //--------------------------------------------------------------------------
438  // Initialize the list of top Services
439  //--------------------------------------------------------------------------
440  sc = svcManager()->initialize();
441  if ( !sc.isSuccess() ) return sc;
442 
443  sc = algManager()->initialize();
444  if ( !sc.isSuccess() ) return sc;
445 
446  //--------------------------------------------------------------------------
447  // Final steps: Inform user and change internal state
448  //--------------------------------------------------------------------------
449  log << MSG::INFO << "Application Manager Initialized successfully" << endmsg;
451 
453 
454  return sc;
455 }
456 
457 //============================================================================
458 // IAppMgrUI implementation: ApplicationMgr::start()
459 //============================================================================
461 
463 
465  log << MSG::INFO << "Already Initialized!" << endmsg;
466  return StatusCode::SUCCESS;
467  }
469  log << MSG::FATAL << "start: Invalid state \"" << m_state << "\"" << endmsg;
470  return StatusCode::FAILURE;
471  }
473 
474  //--------------------------------------------------------------------------
475  // Initialize the list of top Services
476  //--------------------------------------------------------------------------
477  return m_svcLocator->service( "JobOptionsSvc" )
478  ->sysStart()
479  .andThen( [&]() { return m_messageSvc.as<IService>()->sysStart(); } )
480  .andThen( [&]() { return svcManager()->start(); } )
481  .andThen( [&]() { return algManager()->start(); } )
482  .andThen( [&]() {
483  //--------------------------------------------------------------------------
484  // Final steps: Inform user and change internal state
485  //--------------------------------------------------------------------------
486  log << MSG::INFO << "Application Manager Started successfully" << endmsg;
488  } );
489 }
490 
491 //============================================================================
492 // IAppMgrUI implementation: ApplicationMgr::nextEvent(int)
493 //============================================================================
497  log << MSG::FATAL << "nextEvent: Invalid state \"" << m_state << "\"" << endmsg;
498  return StatusCode::FAILURE;
499  }
500  if ( !m_processingMgr ) {
502  log << MSG::FATAL << "No event processing manager specified. Check option: " << m_eventLoopMgr.name() << endmsg;
503  return StatusCode::FAILURE;
504  }
505  return m_processingMgr->nextEvent( maxevt );
506 }
507 
508 //============================================================================
509 // IAppMgrUI implementation: ApplicationMgr::stop()
510 //============================================================================
512 
514 
516  log << MSG::INFO << "Already Initialized!" << endmsg;
517  return StatusCode::SUCCESS;
518  }
520  log << MSG::FATAL << "stop: Invalid state \"" << m_state << "\"" << endmsg;
521  return StatusCode::FAILURE;
522  }
524 
525  // Stop independently managed Algorithms
526  return algManager()
527  ->stop()
528  //--------------------------------------------------------------------------
529  // Stop the list of top Services
530  //--------------------------------------------------------------------------
531  .andThen( [&]() { return svcManager()->stop(); } )
532  .andThen( [&]() { return m_messageSvc.as<IService>()->sysStop(); } )
533  .andThen( [&]() { return m_svcLocator->service( "JobOptionsSvc" )->sysStop(); } )
534  //--------------------------------------------------------------------------
535  // Final steps: Inform user and change internal state
536  //--------------------------------------------------------------------------
537  .andThen( [&]() {
538  log << MSG::INFO << "Application Manager Stopped successfully" << endmsg;
540  } );
541 }
542 
543 //============================================================================
544 // IAppMgrUI implementation: ApplicationMgr::finalize()
545 //============================================================================
549  log << MSG::INFO << "Already Finalized" << endmsg;
550  return StatusCode::SUCCESS;
551  }
553  log << MSG::FATAL << "finalize: Invalid state \"" << m_state << "\"" << endmsg;
554  return StatusCode::FAILURE;
555  }
557 
558  // disable message suppression in finalize
559  m_svcLocator->service<IProperty>( "MessageSvc" )
560  ->setProperty( Gaudi::Property<bool>( "enableSuppression", false ) )
561  .ignore();
562 
563  // Finalize independently managed Algorithms
564  StatusCode sc = algManager()->finalize();
565  if ( sc.isFailure() ) {
566  log << MSG::WARNING << "Failed to finalize an algorithm." << endmsg;
568  }
569 
570  // Finalize all Services
571  sc = svcManager()->finalize();
572  if ( sc.isFailure() ) {
573  log << MSG::WARNING << "Failed to finalize a service." << endmsg;
575  }
576 
577  // svcManager()->removeService( (IService*) m_processingMgr.get() );
578  // svcManager()->removeService( (IService*) m_runable.get() );
579 
580  if ( sc.isSuccess() ) {
581  log << MSG::INFO << "Application Manager Finalized successfully" << endmsg;
582  } else {
583  log << MSG::ERROR << "Application Manager failed to finalize" << endmsg;
584  }
585 
587  return sc;
588 }
589 
590 //============================================================================
591 // IAppMgrUI implementation: ApplicationMgr::terminate()
592 //============================================================================
595 
597  log << MSG::INFO << "Already Offline" << endmsg;
598  return StatusCode::SUCCESS;
599  }
601  log << MSG::FATAL << "terminate: Invalid state \"" << m_state << "\"" << endmsg;
602  return StatusCode::FAILURE;
603  }
604  // release all Services
606 
608  log << MSG::INFO << "Application Manager Terminated successfully" << endmsg;
610  log << MSG::INFO << "Application Manager Terminated successfully with a user requested ScheduledStop" << endmsg;
611  } else {
612  log << MSG::ERROR << "Application Manager Terminated with error code " << m_returnCode.value() << endmsg;
613  }
614 
615  {
616  auto& opts = m_svcLocator->getOptsSvc();
617  // Force a disable the auditing of finalize for MessageSvc
618  opts.set( "MessageSvc.AuditFinalize", "false" );
619  // Force a disable the auditing of finalize for JobOptionsSvc
620  opts.set( "JobOptionsSvc.AuditFinalize", "false" );
621  }
622 
623  // finalize MessageSvc
624  auto svc = m_messageSvc.as<IService>();
625  if ( !svc ) {
626  log << MSG::ERROR << "Could not get the IService interface of the MessageSvc" << endmsg;
627  } else {
628  svc->sysFinalize().ignore();
629  svcManager()->removeService( svc ).ignore();
630  }
631 
632  // finalize JobOptionsSvc
633  svc = m_svcLocator->service( "JobOptionsSvc" );
634  if ( !svc ) {
635  log << MSG::ERROR << "Could not get the IService interface of the JobOptionsSvc" << endmsg;
636  } else {
637  svc->sysFinalize().ignore();
638  svcManager()->removeService( svc ).ignore();
639  }
640 
642  return StatusCode::SUCCESS;
643 }
644 
645 //============================================================================
646 // Reach the required state going through all the needed transitions
647 //============================================================================
650 
651  switch ( state ) {
652 
654  switch ( m_state ) {
656  return StatusCode::SUCCESS;
657  break;
659  return terminate();
660  break;
661  default: // Gaudi::StateMachine::INITIALIZED or Gaudi::StateMachine::RUNNING
663  if ( sc.isSuccess() ) { return terminate(); }
664  break;
665  }
666  break;
667 
669  switch ( m_state ) {
671  return StatusCode::SUCCESS;
672  break;
674  return configure();
675  break;
677  return finalize();
678  break;
679  default: // Gaudi::StateMachine::RUNNING
681  if ( sc.isSuccess() ) { return finalize(); }
682  break;
683  }
684  break;
685 
687  switch ( m_state ) {
689  return StatusCode::SUCCESS;
690  break;
692  return initialize();
693  break;
695  return stop();
696  break;
697  default: // Gaudi::StateMachine::OFFLINE
699  if ( sc.isSuccess() ) { return initialize(); }
700  break;
701  }
702  break;
703 
705  switch ( m_state ) {
707  return StatusCode::SUCCESS;
708  break;
710  return start();
711  break;
712  default: // Gaudi::StateMachine::OFFLINE or Gaudi::StateMachine::CONFIGURED
714  if ( sc.isSuccess() ) { return start(); }
715  break;
716  }
717  break;
718  }
719 
720  // If I get here, there has been a problem in the recursion
721 
722  if ( ignoreFailures ) {
723  // force the new state
724  m_state = state;
725  return StatusCode::SUCCESS;
726  }
727 
728  return sc;
729 }
730 
731 //============================================================================
732 // IAppMgrUI implementation: ApplicationMgr::run()
733 //============================================================================
736 
738  if ( sc.isSuccess() ) {
740  if ( m_runable != 0 ) { // loop over the events
741  sc = m_runable->run();
742  if ( !sc.isSuccess() ) { log << MSG::FATAL << "Application execution failed. Ending the job." << endmsg; }
743  } else {
744  log << MSG::FATAL << "Application has no runable object. Check option:" << m_runableType.name() << endmsg;
745  }
746  }
747  if ( sc.isSuccess() ) { // try to close cleanly
749  }
750  // either the runable failed of the stut-down
751  if ( sc.isFailure() ) { // try to close anyway (but keep the StatusCode unchanged)
753  }
754  return sc;
755 }
756 
757 //============================================================================
758 // IEventProcessor implementation: executeEvent(EventContext&&)
759 //============================================================================
762  if ( m_processingMgr ) { return m_processingMgr->executeEvent( std::move( ctx ) ); }
763  }
765  log << MSG::FATAL << "executeEvent: Invalid state \"" << FSMState() << "\"" << endmsg;
766  return StatusCode::FAILURE;
767 }
768 
771  std::move( ctx ) );
772 }
773 
774 bool ApplicationMgr::empty() const {
776 }
777 
778 std::optional<Gaudi::Interfaces::IQueueingEventProcessor::ResultType> ApplicationMgr::pop() {
780 }
781 
784  if ( m_processingMgr ) { return m_processingMgr->createEventContext(); }
785  }
787  ss << "createEventContext: Invalid state \"" << FSMState() << '"';
788  throw GaudiException( ss.str(), name(), StatusCode::FAILURE );
789 }
790 //============================================================================
791 // IEventProcessor implementation: executeRun(int)
792 //============================================================================
796  if ( m_processingMgr ) { return m_processingMgr->executeRun( evtmax ); }
797  log << MSG::WARNING << "No EventLoop Manager specified " << endmsg;
798  return StatusCode::SUCCESS;
799  }
800  log << MSG::FATAL << "executeRun: Invalid state \"" << FSMState() << "\"" << endmsg;
801  return StatusCode::FAILURE;
802 }
803 
804 //============================================================================
805 // IEventProcessor implementation: stopRun(int)
806 //============================================================================
810  if ( m_processingMgr ) { return m_processingMgr->stopRun(); }
811  log << MSG::WARNING << "No EventLoop Manager specified " << endmsg;
812  return StatusCode::SUCCESS;
813  }
814  log << MSG::FATAL << "stopRun: Invalid state \"" << FSMState() << "\"" << endmsg;
815  return StatusCode::FAILURE;
816 }
817 // Implementation of IAppMgrUI::name
818 const std::string& ApplicationMgr::name() const { return m_name; }
819 
820 // implementation of IService::state
822 // implementation of IService::state
824 
825 //============================================================================
826 // implementation of IService::reinitilaize
827 //============================================================================
831  StatusCode sc;
833  throw GaudiException( "Cannot reinitialize application if not INITIALIZED or RUNNING",
834  "ApplicationMgr::reinitialize", StatusCode::FAILURE );
835  }
837  sc = svcManager()->reinitialize();
838  if ( sc.isFailure() ) retval = sc;
839  sc = algManager()->reinitialize();
840  if ( sc.isFailure() ) retval = sc;
841 
843  if ( sc.isFailure() ) retval = sc;
844  sc = m_svcLocator->service( "JobOptionsSvc" )->sysReinitialize();
845  if ( sc.isFailure() ) retval = sc;
846 
847  log << MSG::INFO << "Application Manager Reinitialized successfully" << endmsg;
848 
849  return retval;
850 }
851 
852 //============================================================================
853 // implementation of IService::reinitiaize
854 //============================================================================
857  StatusCode sc;
859  throw GaudiException( "Cannot restart application if not RUNNING", "ApplicationMgr::restart", StatusCode::FAILURE );
860  }
861 
862  sc = svcManager()->restart();
863  if ( sc.isFailure() ) retval = sc;
864  sc = algManager()->restart();
865  if ( sc.isFailure() ) retval = sc;
866 
867  sc = m_messageSvc.as<IService>()->sysRestart();
868  if ( sc.isFailure() ) retval = sc;
869  sc = m_svcLocator->service( "JobOptionsSvc" )->sysRestart();
870  if ( sc.isFailure() ) retval = sc;
871 
872  return retval;
873 }
874 
875 //============================================================================
876 // Handle properties of the event loop manager (Top alg/Output stream list)
877 //============================================================================
879  if ( m_processingMgr ) {
880  auto props = m_processingMgr.as<IProperty>();
881  if ( props ) props->setProperty( p ).ignore();
882  }
883 }
884 
885 //============================================================================
886 // External Service List handler
887 //============================================================================
889  if ( !( decodeCreateSvcNameList() ).isSuccess() ) {
890  throw GaudiException( "Failed to create ext services", "MinimalEventLoopMgr::createSvcNameListHandler",
892  }
893 }
894 //============================================================================
895 // decodeCreateSvcNameList
896 //============================================================================
899  const auto& theNames = m_createSvcNameList.value();
900  auto it = theNames.begin();
901  auto et = theNames.end();
902  while ( result.isSuccess() && it != et ) {
903  Gaudi::Utils::TypeNameString item( *it++ );
904  if ( ( result = svcManager()->addService( item, ServiceManager::DEFAULT_SVC_PRIORITY ) ).isFailure() ) {
906  log << MSG::ERROR << "decodeCreateSvcNameList: Cannot create service " << item.type() << "/" << item.name()
907  << endmsg;
908  } else {
909  ON_DEBUG {
911  log << MSG::DEBUG << "decodeCreateSvcNameList: Created service " << item.type() << "/" << item.name() << endmsg;
912  }
913  }
914  }
915  return result;
916 }
917 
918 //============================================================================
919 // External Service List handler
920 //============================================================================
922  if ( !( decodeExtSvcNameList() ).isSuccess() ) {
923  throw GaudiException( "Failed to declare ext services", "MinimalEventLoopMgr::extSvcNameListHandler",
925  }
926 }
927 
928 //============================================================================
929 // decodeExtSvcNameList
930 //============================================================================
933 
934  const auto& theNames = m_extSvcNameList.value();
935 
936  auto it = theNames.begin();
937  auto et = theNames.end();
938  while ( result.isSuccess() && it != et ) {
939  Gaudi::Utils::TypeNameString item( *it++ );
940  if ( m_extSvcCreates ) {
941  if ( ( result = svcManager()->addService( item, ServiceManager::DEFAULT_SVC_PRIORITY ) ).isFailure() ) {
943  log << MSG::ERROR << "decodeExtSvcNameList: Cannot create service " << item.type() << "/" << item.name()
944  << endmsg;
945  }
946  } else {
947  if ( ( result = svcManager()->declareSvcType( item.name(), item.type() ) ).isFailure() ) {
949  log << MSG::ERROR << "decodeExtSvcNameList: Cannot declare service " << item.type() << "/" << item.name()
950  << endmsg;
951  }
952  }
953  }
954  return result;
955 }
956 
957 //============================================================================
958 // Dll List handler
959 //============================================================================
961  if ( !( decodeDllNameList() ).isSuccess() ) {
962  throw GaudiException( "Failed to load DLLs.", "MinimalEventLoopMgr::dllNameListHandler", StatusCode::FAILURE );
963  }
964 }
965 
966 //============================================================================
967 // decodeDllNameList
968 //============================================================================
970 
973 
974  // Clean up multiple entries from DLL list
975  // -------------------------------------------------------------------------
976  std::vector<std::string> newList;
977  std::map<std::string, unsigned int> dllInList, duplicateList;
978  {
979  for ( const auto& it : m_dllNameList ) {
980  if ( 0 == dllInList[it] ) {
981  newList.push_back( it ); // first instance of this module
982  } else {
983  ++duplicateList[it];
984  } // module listed multiple times
985  ++dllInList[it]; // increment count for this module
986  }
987  }
988  // m_dllNameList = newList; // update primary list to new, filtered list (do not use the
989  // property itself otherwise we get called again infinitely)
990  // List modules that were in there twice..
991  ON_DEBUG if ( !duplicateList.empty() ) {
992  log << MSG::DEBUG << "Removed duplicate entries for modules : ";
993  for ( auto it = duplicateList.begin(); it != duplicateList.end(); ++it ) {
994  log << it->first << "(" << 1 + it->second << ")";
995  if ( it != --duplicateList.end() ) log << ", ";
996  }
997  log << endmsg;
998  }
999  // -------------------------------------------------------------------------
1000 
1001  const std::vector<std::string>& theNames = newList;
1002 
1003  // only load the new dlls or previously failed dlls
1004  ON_DEBUG log << MSG::DEBUG << "Loading declared DLL's" << endmsg;
1005 
1006  std::vector<std::string> successNames, failNames;
1007  for ( const auto& it : theNames ) {
1008  if ( std::find( m_okDlls.rbegin(), m_okDlls.rend(), it ) == m_okDlls.rend() ) {
1009  // found a new module name
1010  StatusCode status = m_classManager->loadModule( it );
1011  if ( status.isFailure() ) {
1012  failNames.push_back( it );
1013  result = StatusCode::FAILURE;
1014  } else {
1015  successNames.push_back( it );
1016  }
1017  }
1018  }
1019 
1020  // report back to the user and store the names of the succesfully loaded dlls
1021  if ( !successNames.empty() ) {
1022  log << MSG::INFO << "Successfully loaded modules : ";
1023  for ( auto it = successNames.begin(); it != successNames.end(); it++ ) {
1024  log << ( *it );
1025  if ( ( it + 1 ) != successNames.end() ) log << ", ";
1026  // save name
1027  m_okDlls.push_back( *it );
1028  }
1029  log << endmsg;
1030  }
1031 
1032  if ( result == StatusCode::FAILURE ) {
1033  log << MSG::WARNING << "Failed to load modules: ";
1034  for ( auto it = failNames.begin(); it != failNames.end(); it++ ) {
1035  log << ( *it );
1036  if ( ( it + 1 ) != failNames.end() ) log << ", ";
1037  }
1038  log << endmsg;
1039  }
1040  return result;
1041 }
1042 
1044  resetMessaging();
1045  for ( auto& mgrItem : m_managers ) { mgrItem.second->outputLevelUpdate(); }
1046 }
1047 
1048 namespace {
1050  void printAlgsSequencesHelper( SmartIF<IAlgManager>& algmgr, const std::string& algname, MsgStream& log,
1051  int indent ) {
1053  log << MSG::ALWAYS;
1054  for ( int i = 0; i < indent; ++i ) log << " ";
1055  log << algname << endmsg;
1056  auto prop = algmgr->algorithm<IProperty>( algname, false );
1057  if ( prop ) {
1058  // Try to get the property Members
1059  Gaudi::Property<std::vector<std::string>> p( "Members", {} );
1060  if ( prop->getProperty( &p ).isSuccess() ) {
1061  for ( auto& subalgname : p.value() ) { printAlgsSequencesHelper( algmgr, subalgname, log, indent + 1 ); }
1062  }
1063  } else {
1064  log << MSG::WARNING << "Cannot get properties of " << algname << endmsg;
1065  }
1066  }
1067 } // namespace
1068 
1071  log << MSG::ALWAYS << "****************************** Algorithm Sequence ****************************" << endmsg;
1072  for ( auto& algname : m_topAlgNameList ) { printAlgsSequencesHelper( algManager(), algname, log, 0 ); }
1073  log << MSG::ALWAYS << "******************************************************************************" << endmsg;
1074 }
ApplicationMgr::printAlgsSequences
void printAlgsSequences()
Print the sequence of algorithms that have been loaded.
Definition: ApplicationMgr.cpp:1069
Gaudi::ReturnCode::Success
constexpr int Success
Definition: AppReturnCode.h:26
MSG::DEBUG
@ DEBUG
Definition: IMessageSvc.h:25
IService
Definition: IService.h:28
Gaudi::Details::PropertyBase
PropertyBase base class allowing PropertyBase* collections to be "homogeneous".
Definition: PropertyBase.h:35
Gaudi::Details::PropertyBase::name
const std::string name() const
property name
Definition: PropertyBase.h:39
Gaudi::Interfaces::IQueueingEventProcessor::pop
virtual std::optional< ResultType > pop()=0
Get the next available result.
Gaudi::ReturnCode::FinalizationFailure
constexpr int FinalizationFailure
Error codes for operation failures.
Definition: AppReturnCode.h:42
IService.h
std::string
STL class.
ApplicationMgr::m_propertiesPrint
Gaudi::Property< bool > m_propertiesPrint
Definition: ApplicationMgr.h:303
Gaudi::Utils::TypeNameString::name
const std::string & name() const
Definition: TypeNameString.h:49
Gaudi.Configuration.log
log
Definition: Configuration.py:28
ApplicationMgr::empty
bool empty() const override
Definition: ApplicationMgr.cpp:774
std::move
T move(T... args)
ApplicationMgr::decodeDllNameList
StatusCode decodeDllNameList()
Definition: ApplicationMgr.cpp:969
CommonMessaging< implements< IAppMgrUI, Gaudi::Interfaces::IQueueingEventProcessor, IService, IStateful, INamedInterface, IProperty > >::resetMessaging
MSG::Level resetMessaging()
Reinitialize internal states.
Definition: CommonMessaging.h:179
StatusCode::isSuccess
bool isSuccess() const
Definition: StatusCode.h:314
MSG::INFO
@ INFO
Definition: IMessageSvc.h:25
ApplicationMgr::outputLevelUpdate
void outputLevelUpdate() override
Function to call to update the outputLevel of the components (after a change in MessageSvc).
Definition: ApplicationMgr.cpp:1043
System.h
ApplicationMgr::run
StatusCode run() override
Definition: ApplicationMgr.cpp:734
ApplicationMgr::m_runable
SmartIF< IRunable > m_runable
Reference to the runable object.
Definition: ApplicationMgr.h:233
GaudiException.h
ApplicationMgr::i_startup
StatusCode i_startup()
Internal startup routine.
Definition: ApplicationMgr.cpp:121
ApplicationMgr::stop
StatusCode stop() override
Definition: ApplicationMgr.cpp:511
ApplicationMgr::m_name
std::string m_name
Name.
Definition: ApplicationMgr.h:224
System::getEnv
GAUDI_API std::string getEnv(const char *var)
get a particular environment variable (returning "UNKNOWN" if not set)
Definition: System.cpp:385
ApplicationMgr::m_messageSvcType
Gaudi::Property< std::string > m_messageSvcType
Definition: ApplicationMgr.h:219
std::vector< std::string >
std::find
T find(T... args)
PropertyHolder< CommonMessaging< implements< IAppMgrUI, Gaudi::Interfaces::IQueueingEventProcessor, IService, IStateful, INamedInterface, IProperty > > >::setProperty
StatusCode setProperty(const Gaudi::Details::PropertyBase &p)
Set the property from a property.
Definition: IProperty.h:39
GAUDI_MINOR_VERSION
#define GAUDI_MINOR_VERSION
Definition: GAUDI_VERSION.h:9
ApplicationMgr::name
const std::string & name() const override
Definition: ApplicationMgr.cpp:818
GaudiException
Definition: GaudiException.h:31
ApplicationMgr::FSMState
Gaudi::StateMachine::State FSMState() const override
Definition: ApplicationMgr.cpp:821
ApplicationMgr::sysStop
StatusCode sysStop() override
Definition: ApplicationMgr.h:105
ApplicationMgr::m_stopOnSignal
Gaudi::Property< bool > m_stopOnSignal
Property to enable/disable the "stop on signal" service.
Definition: ApplicationMgr.h:295
ServiceManager
Definition: ServiceManager.h:46
ApplicationMgr::m_stalledEventMonitoring
Gaudi::Property< bool > m_stalledEventMonitoring
Property to enable/disable the monitoring and reporting of stalled events.
Definition: ApplicationMgr.h:300
System::setEnv
GAUDI_API int setEnv(const std::string &name, const std::string &value, int overwrite=1)
Set an environment variables.
Definition: System.cpp:498
std::stringstream
STL class.
ServiceManager.h
MSG::WARNING
@ WARNING
Definition: IMessageSvc.h:25
ApplicationMgr::m_okDlls
std::vector< std::string > m_okDlls
names of successfully loaded dlls
Definition: ApplicationMgr.h:317
ApplicationMgr::createEventContext
EventContext createEventContext() override
implementation of IEventProcessor::createEventContext()
Definition: ApplicationMgr.cpp:782
AlgorithmManager.h
System::typeinfoName
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:310
ObjectFactory.h
StatusCode.h
ApplicationMgr::i_delegateToEvtProc
static auto i_delegateToEvtProc(SELF *self, PIMPL &member, std::string_view method_name, METHOD &&method, ARGS &&... args)
Helper to delegate calls to event processor implementation.
Definition: ApplicationMgr.h:321
ApplicationMgr::terminate
StatusCode terminate() override
Definition: ApplicationMgr.cpp:593
IMessageSvc.h
ApplicationMgr::executeRun
StatusCode executeRun(int evtmax) override
implementation of IEventProcessor::executeRun(int)
Definition: ApplicationMgr.cpp:793
ApplicationMgr::finalize
StatusCode finalize() override
Definition: ApplicationMgr.cpp:546
PropertyHolder< CommonMessaging< implements< IAppMgrUI, Gaudi::Interfaces::IQueueingEventProcessor, IService, IStateful, INamedInterface, IProperty > > >::bindPropertiesTo
void bindPropertiesTo(Gaudi::Interfaces::IOptionsSvc &optsSvc)
Definition: PropertyHolder.h:252
ApplicationMgr::m_jobOptionsSvcType
Gaudi::Property< std::string > m_jobOptionsSvcType
Definition: ApplicationMgr.h:221
ApplicationMgr::nextEvent
StatusCode nextEvent(int maxevt) override
Definition: ApplicationMgr.cpp:494
PropertyHolder< CommonMessaging< implements< IAppMgrUI, Gaudi::Interfaces::IQueueingEventProcessor, IService, IStateful, INamedInterface, IProperty > > >::property
Gaudi::Details::PropertyBase * property(std::string_view name) const
\fixme property and bindPropertiesTo should be protected
Definition: PropertyHolder.h:238
ApplicationMgr::createSvcNameListHandler
void createSvcNameListHandler(Gaudi::Details::PropertyBase &)
Definition: ApplicationMgr.cpp:888
AlgorithmManager
Definition: AlgorithmManager.h:41
std::vector::push_back
T push_back(T... args)
DLLClassManager
Definition: DLLClassManager.h:38
PropertyHolder< CommonMessaging< implements< IAppMgrUI, Gaudi::Interfaces::IQueueingEventProcessor, IService, IStateful, INamedInterface, IProperty > > >::getProperties
const std::vector< Gaudi::Details::PropertyBase * > & getProperties() const override
get all properties
Definition: PropertyHolder.h:222
ApplicationMgr::svcManager
SmartIF< ISvcManager > & svcManager()
Definition: ApplicationMgr.h:136
ApplicationMgr::m_dllNameList
Gaudi::Property< std::vector< std::string > > m_dllNameList
Definition: ApplicationMgr.h:250
IProperty
Definition: IProperty.h:33
GAUDI_VERSION.h
Gaudi::StateMachine::State
State
Allowed states for classes implementing the state machine (ApplicationMgr, Algorithm,...
Definition: StateMachine.h:22
SmartIF.h
ApplicationMgr::dllNameListHandler
void dllNameListHandler(Gaudi::Details::PropertyBase &theProp)
Definition: ApplicationMgr.cpp:960
Gaudi::Utils::TypeNameString
Helper class to parse a string of format "type/name".
Definition: TypeNameString.h:20
ApplicationMgr::m_returnCode
Gaudi::Property< int > m_returnCode
Property to record the error conditions occurring during the running.
Definition: ApplicationMgr.h:307
Gaudi::Time::format
std::string format(bool local, std::string spec="%c") const
Format the time using strftime.
Definition: Time.cpp:262
Gaudi::StateMachine::CONFIGURED
@ CONFIGURED
Definition: StateMachine.h:24
GaudiPython.Pythonizations.ctx
ctx
Definition: Pythonizations.py:588
StatusCode
Definition: StatusCode.h:65
gaudirun.opts
opts
Definition: gaudirun.py:336
ApplicationMgr::restart
StatusCode restart() override
Definition: ApplicationMgr.cpp:855
ApplicationMgr::configure
StatusCode configure() override
Definition: ApplicationMgr.cpp:230
IInterface::interfaceID
static const InterfaceID & interfaceID()
Return an instance of InterfaceID identifying the interface.
Definition: IInterface.h:246
DLLClassManager.h
ApplicationMgr::m_jobOptionsPostAction
Gaudi::Property< std::string > m_jobOptionsPostAction
Definition: ApplicationMgr.h:255
Gaudi::StateMachine::OFFLINE
@ OFFLINE
Definition: StateMachine.h:23
std::string::c_str
T c_str(T... args)
Gaudi::Interfaces::IQueueingEventProcessor::push
virtual void push(EventContext &&ctx)=0
Schedule the processing of an event.
Gaudi::Property::declareUpdateHandler
Details::PropertyBase & declareUpdateHandler(std::function< void(Details::PropertyBase &)> fun) override
set new callback for update
Definition: Property.h:146
ApplicationMgr::m_jobOptionsPreAction
Gaudi::Property< std::string > m_jobOptionsPreAction
Definition: ApplicationMgr.h:253
ApplicationMgr::pop
std::optional< Gaudi::Interfaces::IQueueingEventProcessor::ResultType > pop() override
Definition: ApplicationMgr.cpp:778
Gaudi::Property::value
const ValueType & value() const
Backward compatibility (.
Definition: Property.h:240
Gaudi::ReturnCode::ScheduledStop
constexpr int ScheduledStop
Definition: AppReturnCode.h:35
ApplicationMgr::m_svcLocator
SmartIF< ISvcLocator > m_svcLocator
Reference to its own service locator (must be instantiated prior to any service!)
Definition: ApplicationMgr.h:189
ApplicationMgr::m_appVersion
Gaudi::Property< std::string > m_appVersion
Definition: ApplicationMgr.h:263
ApplicationMgr::sysReinitialize
StatusCode sysReinitialize() override
Definition: ApplicationMgr.h:109
ApplicationMgr::m_jobOptionsType
Gaudi::Property< std::string > m_jobOptionsType
Definition: ApplicationMgr.h:251
ApplicationMgr::sysRestart
StatusCode sysRestart() override
Definition: ApplicationMgr.h:111
ON_DEBUG
#define ON_DEBUG
Definition: ApplicationMgr.cpp:45
ApplicationMgr::executeEvent
StatusCode executeEvent(EventContext &&ctx) override
implementation of IEventProcessor::executeEvent(void*)
Definition: ApplicationMgr.cpp:760
SmartIF< IAlgManager >
ApplicationMgr::m_runableType
Gaudi::Property< std::string > m_runableType
Definition: ApplicationMgr.h:257
compareRootHistos.retval
def retval
Definition: compareRootHistos.py:503
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:203
System::isEnvSet
GAUDI_API bool isEnvSet(const char *var)
Check if an environment variable is set or not.
Definition: System.cpp:405
ApplicationMgr::targetFSMState
Gaudi::StateMachine::State targetFSMState() const override
Definition: ApplicationMgr.cpp:823
std::map< std::string, unsigned int >
ApplicationMgr::m_topAlgNameList
Gaudi::Property< std::vector< std::string > > m_topAlgNameList
Definition: ApplicationMgr.h:208
ApplicationMgr::m_processingMgr
SmartIF< IEventProcessor > m_processingMgr
Reference to processing manager object.
Definition: ApplicationMgr.h:234
Gaudi::StateMachine::RUNNING
@ RUNNING
Definition: StateMachine.h:26
MsgStream
Definition: MsgStream.h:34
ApplicationMgr::m_svcMapping
Gaudi::Property< std::vector< std::string > > m_svcMapping
Definition: ApplicationMgr.h:228
TypeNameString.h
MSG::FATAL
@ FATAL
Definition: IMessageSvc.h:25
Gaudi::Utils::TypeNameString::type
const std::string & type() const
Definition: TypeNameString.h:48
ApplicationMgr::m_svcOptMapping
Gaudi::Property< std::vector< std::string > > m_svcOptMapping
Definition: ApplicationMgr.h:229
ApplicationMgr::decodeExtSvcNameList
StatusCode decodeExtSvcNameList()
Definition: ApplicationMgr.cpp:931
gaudiComponentHelp.properties
properties
Definition: gaudiComponentHelp.py:69
ApplicationMgr::m_extSvcNameList
Gaudi::Property< std::vector< std::string > > m_extSvcNameList
Definition: ApplicationMgr.h:245
ApplicationMgr::m_eventLoopMgr
Gaudi::Property< std::string > m_eventLoopMgr
Definition: ApplicationMgr.h:258
std::vector::rend
T rend(T... args)
StatusCode::ignore
const StatusCode & ignore() const
Allow discarding a StatusCode without warning.
Definition: StatusCode.h:139
SmartIF::as
SmartIF< IFace > as() const
return a new SmartIF instance to another interface
Definition: SmartIF.h:117
ApplicationMgr::m_extSvcCreates
Gaudi::Property< bool > m_extSvcCreates
Definition: ApplicationMgr.h:247
StatusCode::isFailure
bool isFailure() const
Definition: StatusCode.h:129
ApplicationMgr::m_createSvcNameList
Gaudi::Property< std::vector< std::string > > m_createSvcNameList
Definition: ApplicationMgr.h:278
ApplicationMgr::m_actHistory
Gaudi::Property< bool > m_actHistory
Definition: ApplicationMgr.h:264
MSG::Level
Level
Definition: IMessageSvc.h:25
ApplicationMgr::serviceLocator
SmartIF< ISvcLocator > & serviceLocator() const override
Needed to locate the message service.
Definition: ApplicationMgr.h:149
MSG::VERBOSE
@ VERBOSE
Definition: IMessageSvc.h:25
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:100
std::endl
T endl(T... args)
ApplicationMgr::decodeCreateSvcNameList
StatusCode decodeCreateSvcNameList()
Definition: ApplicationMgr.cpp:897
IRunable.h
SmartIF::get
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:86
ApplicationMgr::m_appName
Gaudi::Property< std::string > m_appName
Definition: ApplicationMgr.h:262
ProduceConsume.props
props
Definition: ProduceConsume.py:84
MSG::ALWAYS
@ ALWAYS
Definition: IMessageSvc.h:25
ApplicationMgr.h
compareRootHistos.state
def state
Definition: compareRootHistos.py:500
std::map::begin
T begin(T... args)
Time.h
ApplicationMgr
Definition: ApplicationMgr.h:57
ApplicationMgr::stopRun
StatusCode stopRun() override
implementation of IEventProcessor::stopRun()
Definition: ApplicationMgr.cpp:807
MSG::NIL
@ NIL
Definition: IMessageSvc.h:25
Gaudi::StateMachine::INITIALIZED
@ INITIALIZED
Definition: StateMachine.h:25
MSG::ERROR
@ ERROR
Definition: IMessageSvc.h:25
Gaudi::Time::current
static Time current()
Returns the current time.
Definition: Time.cpp:119
IInterface
Definition: IInterface.h:237
ApplicationMgr::evtLoopPropertyHandler
void evtLoopPropertyHandler(Gaudi::Details::PropertyBase &theProp)
Definition: ApplicationMgr.cpp:878
EventContext
Definition: EventContext.h:34
ApplicationMgr::m_queueingProcessor
SmartIF< IQueueingEventProcessor > m_queueingProcessor
Reference to a queueing processing manager object.
Definition: ApplicationMgr.h:236
ApplicationMgr::m_outputLevel
Gaudi::Property< int > m_outputLevel
Definition: ApplicationMgr.h:261
ApplicationMgr::queryInterface
StatusCode queryInterface(const InterfaceID &iid, void **pinterface) override
Definition: ApplicationMgr.cpp:95
ApplicationMgr::m_messageSvc
SmartIF< IMessageSvc > m_messageSvc
Reference to the message service.
Definition: ApplicationMgr.h:232
ApplicationMgr::m_managers
ManagersMap m_managers
Map of known component managers.
Definition: ApplicationMgr.h:178
std::string::empty
T empty(T... args)
ApplicationMgr::m_state
Gaudi::StateMachine::State m_state
Internal State.
Definition: ApplicationMgr.h:225
ApplicationMgr::sysStart
StatusCode sysStart() override
Definition: ApplicationMgr.h:103
ApplicationMgr::m_jobOptionsPath
Gaudi::Property< std::string > m_jobOptionsPath
Definition: ApplicationMgr.h:252
ApplicationMgr::m_printAlgsSequence
Gaudi::Property< bool > m_printAlgsSequence
Definition: ApplicationMgr.h:310
std::stringstream::str
T str(T... args)
System::hostName
GAUDI_API const std::string & hostName()
Host name.
Definition: System.cpp:315
ApplicationMgr::extSvcNameListHandler
void extSvcNameListHandler(Gaudi::Details::PropertyBase &theProp)
Definition: ApplicationMgr.cpp:921
std::map::end
T end(T... args)
ApplicationMgr::GoToState
StatusCode GoToState(Gaudi::StateMachine::State state, bool ignoreFailures=false)
Reach a state from current state (whichever it is) going through the correct transitions.
Definition: ApplicationMgr.cpp:648
InterfaceID
Definition: IInterface.h:39
GAUDI_MAJOR_VERSION
#define GAUDI_MAJOR_VERSION
Definition: GAUDI_VERSION.h:8
ApplicationMgr::reinitialize
StatusCode reinitialize() override
Definition: ApplicationMgr.cpp:828
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition: StatusCode.h:101
Gaudi::Interfaces::IQueueingEventProcessor::empty
virtual bool empty() const =0
Tell if the processor has events in the queues.
ApplicationMgr::m_environment
Gaudi::Property< std::map< std::string, std::string > > m_environment
Definition: ApplicationMgr.h:286
AlgorithmManager::typeAliases
AlgTypeAliasesMap & typeAliases()
Definition: AlgorithmManager.h:92
DECLARE_OBJECT_FACTORY
#define DECLARE_OBJECT_FACTORY(x)
Definition: ObjectFactory.h:25
ApplicationMgr::algManager
SmartIF< IAlgManager > & algManager()
Definition: ApplicationMgr.h:142
std::numeric_limits
Gaudi::Property< std::string >
ApplicationMgr::m_classManager
SmartIF< DLLClassManager > m_classManager
Reference to the class manager.
Definition: ApplicationMgr.h:191
ApplicationMgr::push
void push(EventContext &&ctx) override
Definition: ApplicationMgr.cpp:769
ApplicationMgr::start
StatusCode start() override
Definition: ApplicationMgr.cpp:460
ON_VERBOSE
#define ON_VERBOSE
Definition: ApplicationMgr.cpp:46
std::vector::rbegin
T rbegin(T... args)
MsgStream.h
ApplicationMgr::m_targetState
Gaudi::StateMachine::State m_targetState
Internal State.
Definition: ApplicationMgr.h:226
ApplicationMgr::initialize
StatusCode initialize() override
Definition: ApplicationMgr.cpp:399
IProperty::setProperty
StatusCode setProperty(const Gaudi::Details::PropertyBase &p)
Set the property from a property.
Definition: IProperty.h:39
GAUDI_PATCH_VERSION
#define GAUDI_PATCH_VERSION
Definition: GAUDI_VERSION.h:10