The Gaudi Framework  v38r3 (c3fc9673)
ApplicationMgr.cpp
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2024 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 "ApplicationMgr.h"
13 #include "AlgorithmManager.h"
14 #include "DLLClassManager.h"
15 #include "ServiceManager.h"
16 #include <GAUDI_VERSION.h>
19 #include <GaudiKernel/IRunable.h>
20 #include <GaudiKernel/IService.h>
21 #include <GaudiKernel/Message.h>
22 #include <GaudiKernel/MsgStream.h>
24 #include <GaudiKernel/SmartIF.h>
25 #include <GaudiKernel/StatusCode.h>
26 #include <GaudiKernel/System.h>
27 #include <GaudiKernel/Time.h>
29 #include <TError.h>
30 #include <TROOT.h>
31 #include <algorithm>
32 #include <cassert>
33 #include <ctime>
34 #include <limits>
35 #include <sstream>
36 
37 using System::getEnv;
38 using System::isEnvSet;
39 
40 #define ON_DEBUG if ( m_outputLevel <= MSG::DEBUG )
41 #define ON_VERBOSE if ( m_outputLevel <= MSG::VERBOSE )
42 
44 
45 namespace {
47  static IMessageSvc* s_messageSvcInstance{ nullptr };
49  static ErrorHandlerFunc_t s_originalRootErrorHandler{ nullptr };
50 
52  void ROOTErrorHandlerAdapter( int level, Bool_t abort, const char* location, const char* msg ) {
53  if ( s_messageSvcInstance ) {
54  // we pass the message to MessageSvc only if it is not suppressed by ROOT itself
55  if ( level >= gErrorIgnoreLevel ) {
56  // # Map ROOT level to Gaudi level:
57  // ROOT levels go from 0 to 6000 in step of 1000,
58  // kInfo is 1000 while MSG::INFO is 3, so we aim for `level / 1000 + 2`,
59  // but we have to put a cap at MSG::FATAL.
60  int msgLevel = std::min<int>( level / 1000 + 2, MSG::FATAL );
61  if ( msgLevel >= s_messageSvcInstance->outputLevel( location ) ) {
62  s_messageSvcInstance->reportMessage( Message{ location, msgLevel, msg }, msgLevel );
63  }
64  }
65  } else {
66  // If a message is sent when we do not have an IMessageSvc, let's use something else
67  if ( s_originalRootErrorHandler ) {
68  // either the original handler (if any)
69  s_originalRootErrorHandler( level, abort, location, msg );
70  } else {
71  // or some minimalistic implementation from ROOT (just not to loose the message)
72  ROOT::Internal::MinimalErrorHandler( level, abort, location, msg );
73  }
74  }
75  }
76 
77 } // namespace
78 
79 // Implementation class for the Application Manager. In this way the
80 // ApplicationMgr class is a fully insulated concrete class. Clients
81 // (main programs) will not need to re-compile if there are changes
82 // in the implementation
83 
84 //=======================================================================
85 // Constructor
86 //=======================================================================
88  // IInterface initialization
89  addRef(); // Initial count set to 1
90 
91  // Instantiate component managers
92  m_managers[IService::interfaceID().id()] = new ServiceManager( this );
93 
95 
96  // Instantiate internal services
97  // SvcLocator/Factory HAS to be already instantiated
98  m_classManager = new DLLClassManager( this );
99 
100  AlgorithmManager* algMgr = new AlgorithmManager( this );
101  m_managers[IAlgorithm::interfaceID().id()] = algMgr;
102  // m_managers[IAlgorithm::interfaceID().id()] = new HiveAlgorithmManager(this);
103 
104  // This property is not hosted in the ApplicationMgr instance
105  declareProperty( "AlgTypeAliases", algMgr->typeAliases(),
106  "Aliases of algorithm types, to replace an algorithm type for every instance" );
107 
108  // ServiceMgr Initialization loop checking
109  svcManager()->setLoopCheckEnabled( m_loopCheck );
110 
111  m_svcMapping = { "EvtDataSvc/EventDataSvc",
112  "DetDataSvc/DetectorDataSvc",
113  "HistogramSvc/HistogramDataSvc",
114  "HbookCnv::PersSvc/HbookHistSvc",
115  "RootHistCnv::PersSvc/RootHistSvc",
116  "EvtPersistencySvc/EventPersistencySvc",
117  "DetPersistencySvc/DetectorPersistencySvc",
118  "HistogramPersistencySvc/HistogramPersistencySvc" };
119 }
120 
121 //============================================================================
122 // IInterface implementation: queryInterface::addRef()
123 //============================================================================
125  if ( !ppvi ) { return StatusCode::FAILURE; }
126 
127  // try to find own/direct interfaces:
128  StatusCode sc = base_class::queryInterface( iid, ppvi );
129  if ( sc.isSuccess() ) return sc;
130 
131  // find indirect interfaces :
132  if ( ISvcLocator::interfaceID().versionMatch( iid ) ) { return serviceLocator()->queryInterface( iid, ppvi ); }
133  if ( ISvcManager::interfaceID().versionMatch( iid ) ) { return svcManager()->queryInterface( iid, ppvi ); }
134  if ( IAlgManager::interfaceID().versionMatch( iid ) ) { return algManager()->queryInterface( iid, ppvi ); }
135  if ( IClassManager::interfaceID().versionMatch( iid ) ) { return m_classManager->queryInterface( iid, ppvi ); }
136  if ( IMessageSvc::interfaceID().versionMatch( iid ) ) {
137  *ppvi = m_messageSvc.get();
138  if ( m_messageSvc ) m_messageSvc->addRef();
139  // Note that 0 can be a valid IMessageSvc pointer value (when used for
140  // MsgStream).
141  return StatusCode::SUCCESS;
142  }
143  *ppvi = nullptr;
144  return StatusCode::FAILURE;
145 }
146 
147 //============================================================================
148 // ApplicationMgr::i_startup()
149 //============================================================================
151 
152  StatusCode sc;
153 
154  // declare factories in current module
155  m_classManager->loadModule( "" ).ignore();
156 
157  // Note: we cannot use CommonMessaging methods here because MessageSvc is not there yet
158  MsgStream log( nullptr, name() );
159 
160  // Create the Message service
161  auto msgsvc = svcManager()->createService( Gaudi::Utils::TypeNameString( "MessageSvc", m_messageSvcType ) );
162  if ( !msgsvc ) {
163  log << MSG::FATAL << "Error creating MessageSvc of type " << m_messageSvcType << endmsg;
164  return StatusCode::FAILURE;
165  }
166  // Get the useful interface from Message services
167  m_messageSvc = m_svcLocator->service( "MessageSvc" );
168  if ( !m_messageSvc ) {
169  log << MSG::FATAL << "Error retrieving MessageSvc." << endmsg;
170  return StatusCode::FAILURE;
171  }
172  sc = m_messageSvc.as<IProperty>()->setProperty( "OutputLevel", m_outputLevel );
173  if ( !sc ) {
174  log << MSG::FATAL << "Error setting OutputLevel option of MessageSvc" << endmsg;
175  return sc;
176  }
178  if ( gROOT ) {
179  // if ROOT is already initialized (usually it is the case) we redirect messages to MessageSvc.
180  s_messageSvcInstance = m_messageSvc.get();
181  s_originalRootErrorHandler = SetErrorHandler( ROOTErrorHandlerAdapter );
182  } else {
183  log << MSG::WARNING
184  << "ROOT not yet initialized, we cannot override the error handler are requested "
185  "(UseMessageSvcForROOTMessages==true)"
186  << endmsg;
187  }
188  }
189 
190  auto jobsvc = svcManager()->createService( Gaudi::Utils::TypeNameString( "JobOptionsSvc", m_jobOptionsSvcType ) );
191  // Create the Job Options service
192  if ( !jobsvc ) {
193  log << MSG::FATAL << "Error creating JobOptionsSvc" << endmsg;
194  return StatusCode::FAILURE;
195  }
196 
197  auto jobOptsIProp = jobsvc.as<IProperty>();
198  if ( !jobOptsIProp ) {
199  log << MSG::FATAL << "Error locating JobOptionsSvc" << endmsg;
200  return StatusCode::FAILURE;
201  }
202  sc = jobOptsIProp->setProperty( Gaudi::Property<std::string>( "TYPE", m_jobOptionsType ) );
203  if ( !sc.isSuccess() ) {
204  log << MSG::FATAL << "Error setting TYPE option in JobOptionsSvc" << endmsg;
205  return sc;
206  }
207 
208  if ( !m_jobOptionsPreAction.empty() ) {
209  sc = jobOptsIProp->setProperty( Gaudi::Property<std::string>( "PYTHONPARAMS", m_jobOptionsPreAction ) );
210  if ( !sc.isSuccess() ) {
211  log << MSG::FATAL << "Error setting JobOptionsPreAction option in JobOptionsSvc" << endmsg;
212  return sc;
213  }
214  }
215 
216  if ( !m_jobOptionsPostAction.empty() ) {
217  sc = jobOptsIProp->setProperty( Gaudi::Property<std::string>( "PYTHONACTION", m_jobOptionsPostAction ) );
218  if ( !sc.isSuccess() ) {
219  log << MSG::FATAL << "Error setting JobOptionsPostAction option in JobOptionsSvc" << endmsg;
220  return sc;
221  }
222  }
223 
224  if ( !m_jobOptionsPath.empty() ) { // The command line takes precedence
225  sc = jobOptsIProp->setProperty( Gaudi::Property<std::string>( "PATH", m_jobOptionsPath ) );
226  if ( !sc.isSuccess() ) {
227  log << MSG::FATAL << "Error setting PATH option in JobOptionsSvc" << endmsg;
228  return sc;
229  }
230  } else if ( isEnvSet( "JOBOPTPATH" ) ) { // Otherwise the Environment JOBOPTPATH
231  sc = jobOptsIProp->setProperty( Gaudi::Property<std::string>( "PATH", getEnv( "JOBOPTPATH" ) ) );
232  if ( !sc.isSuccess() ) {
233  log << MSG::FATAL << "Error setting PATH option in JobOptionsSvc from env" << endmsg;
234  return sc;
235  }
236  } else { // Otherwise the default
237  sc = jobOptsIProp->setProperty( Gaudi::Property<std::string>( "PATH", "../options/job.opts" ) );
238  if ( !sc.isSuccess() ) {
239  log << MSG::FATAL << "Error setting PATH option in JobOptionsSvc to default" << endmsg;
240  return sc;
241  }
242  }
243  jobOptsIProp.reset();
244 
245  // Sets my default the Output Level of the Message service to be
246  // the same as this
247  auto msgSvcIProp = msgsvc.as<IProperty>();
248  msgSvcIProp->setProperty( Gaudi::Property<int>( "OutputLevel", m_outputLevel ) ).ignore();
249  msgSvcIProp.reset();
250 
251  sc = jobsvc->sysInitialize();
252  if ( !sc.isSuccess() ) {
253  log << MSG::FATAL << "Error initializing JobOptionsSvc" << endmsg;
254  return sc;
255  }
256  sc = msgsvc->sysInitialize();
257  if ( !sc.isSuccess() ) {
258  log << MSG::FATAL << "Error initializing MessageSvc" << endmsg;
259  return sc;
260  }
261 
262  // Make sure output level caches are up to date.
264 
265  return sc;
266 }
267 
268 //============================================================================
269 // IAppMgrUI implementation: ApplicationMgr::configure()
270 //============================================================================
272 
273  // Check if the state is compatible with the transition
274  MsgStream tlog( m_messageSvc, name() );
276  tlog << MSG::INFO << "Already Configured" << endmsg;
277  return StatusCode::SUCCESS;
278  }
280  tlog << MSG::FATAL << "configure: Invalid state \"" << m_state << "\"" << endmsg;
281  return StatusCode::FAILURE;
282  }
284 
285  // Reset application return code.
287 
288  StatusCode sc;
289  sc = i_startup();
290  if ( !sc.isSuccess() ) { return sc; }
291 
292  {
294  // Get my own options using the Job options service
295  if ( log.level() <= MSG::DEBUG ) log << MSG::DEBUG << "Getting my own properties" << endmsg;
296  bindPropertiesTo( serviceLocator()->getOptsSvc() );
297  }
298 
299  // Make sure that the OutputLevel is in sync
300  if ( m_outputLevel != MSG::NIL && m_messageSvc ) m_messageSvc->setOutputLevel( name(), m_outputLevel );
302 
303  // Check current outputLevel to eventually inform the MessageSvc
304  if ( m_outputLevel != MSG::NIL && !m_appName.empty() ) {
305  // Print a welcome message
307  << "=================================================================="
308  << "==================================================================" << std::endl
309  << " "
310  << " Welcome to " << m_appName.value();
311 
312  if ( !m_appVersion.empty() ) {
313  log << MSG::ALWAYS << " version " << m_appVersion.value();
314  } else {
315  log << MSG::ALWAYS << " (GaudiCoreSvc "
316  << "v" << GAUDI_MAJOR_VERSION << "r" << GAUDI_MINOR_VERSION
317 #if GAUDI_PATCH_VERSION
318  << "p" << GAUDI_PATCH_VERSION
319 #endif
320  << ")";
321  }
322 
323  // Add the host name and current time to the message
325  << " "
326  << " running on " << System::hostName() << " on " << Gaudi::Time::current().format( true ) << std::endl
327  << "=================================================================="
328  << "==================================================================" << endmsg;
329  }
330 
331  // print all own properties if the options "PropertiesPrint" is set to true
332  if ( m_propertiesPrint ) {
333  const auto& properties = getProperties();
334  log << MSG::ALWAYS << "List of ALL properties of " << System::typeinfoName( typeid( *this ) ) << "/" << this->name()
335  << " #properties = " << properties.size() << endmsg;
336  for ( const auto& property : properties ) { log << "Property ['Name': Value] = " << *property << endmsg; }
337  }
338 
339  // set the requested environment variables
340  for ( auto& var : m_environment ) {
341  const std::string& name = var.first;
342  const std::string& value = var.second;
344  const MSG::Level lvl = ( !old.empty() && ( old != "UNKNOWN" ) ) ? MSG::WARNING : MSG::DEBUG;
345  if ( m_outputLevel <= lvl ) log << lvl << "Setting " << name << " = " << value << endmsg;
346  System::setEnv( name, value );
347  }
348 
349  // Declare Service Types
350  for ( auto& j : m_svcMapping ) {
352  if ( svcManager()->declareSvcType( itm.name(), itm.type() ).isFailure() ) {
353  log << MSG::ERROR << "configure: declaring svc type:'" << j << "' failed." << endmsg;
354  return StatusCode::FAILURE;
355  } else {
356  ON_VERBOSE
357  log << MSG::VERBOSE << "declared service " << j << endmsg;
358  }
359  }
360  for ( auto& j : m_svcOptMapping ) {
362  if ( svcManager()->declareSvcType( itm.name(), itm.type() ).isFailure() ) {
363  log << MSG::ERROR << "declaring svc type:'" << j << "' failed." << endmsg;
364  return StatusCode::FAILURE;
365  }
366  }
367 
368  //--------------------------------------------------------------------------
369  // Declare other Services and Algorithms by loading DLL's
370  sc = decodeDllNameList();
371  if ( sc.isFailure() ) {
372  log << MSG::ERROR << "Failure loading declared DLL's" << endmsg;
373  return sc;
374  }
375 
376  //--------------------------------------------------------------------------
377  // Deal with the services explicitly declared by the user.
378  sc = decodeExtSvcNameList();
379  if ( sc.isFailure() ) {
380  log << MSG::ERROR << "Failure during external service association" << endmsg;
381  return sc;
382  }
383 
385  if ( sc.isFailure() ) {
386  log << MSG::ERROR << "Failure during external service creation" << endmsg;
387  return sc;
388  }
389 
390  //--------------------------------------------------------------------------
391  // Retrieve intrinsic services. If needed configure them.
392  //--------------------------------------------------------------------------
393  const Gaudi::Utils::TypeNameString evtloop_item( m_eventLoopMgr );
394  sc = svcManager()->addService( evtloop_item, ServiceManager::DEFAULT_SVC_PRIORITY * 10 );
395  if ( !sc.isSuccess() ) {
396  log << MSG::FATAL << "Error adding :" << m_eventLoopMgr << endmsg;
397  return sc;
398  } else {
399  ON_VERBOSE
400  log << MSG::VERBOSE << "added service " << evtloop_item << endmsg;
401  }
402 
403  m_runable = m_svcLocator->service( m_runableType );
404  if ( !m_runable ) {
405  log << MSG::FATAL << "Error retrieving Runable: " << m_runableType.value() << "\n Check option ApplicationMgr."
406  << m_runableType.name() << endmsg;
407  return sc;
408  }
409  m_processingMgr = m_svcLocator->service( evtloop_item );
410  if ( !m_processingMgr ) {
411  log << MSG::FATAL << "Error retrieving Processing manager: " << m_eventLoopMgr.value()
412  << "\n Check option ApplicationMgr." << m_eventLoopMgr.name() << "\n No events will be processed." << endmsg;
413  return sc;
414  }
415  // The IEventProcessor might also be an IQueueingEventProcessor
417 
418  // Establish Update Handlers for ExtSvc and DLLs Properties
422 
423  if ( m_actHistory ) {
424  // Create HistorySvc with a priority to ensure it's initialized last, finalized first
425  sc = svcManager()->addService( "HistorySvc", std::numeric_limits<int>::max() );
426  if ( sc.isFailure() ) {
427  log << MSG::FATAL << "Error adding HistorySvc" << endmsg;
428  return StatusCode::FAILURE;
429  }
430  }
431 
432  log << MSG::INFO << "Application Manager Configured successfully" << endmsg;
434  return StatusCode::SUCCESS;
435 }
436 
437 //============================================================================
438 // IAppMgrUI implementation: ApplicationMgr::initialize()
439 //============================================================================
441  StatusCode sc;
442 
444 
445  // Make sure output level caches are up to date.
447 
448  // I cannot add these services in configure() because they are coming from GaudiUtils
449  // and it messes up genconf when rebuilding it.
450  if ( m_stopOnSignal ) {
451  // Instantiate the service that schedules a stop when a signal is received
452  std::string svcname( "Gaudi::Utils::StopSignalHandler" );
453  sc = svcManager()->addService( svcname );
454  if ( sc.isFailure() ) {
455  log << MSG::INFO << "Cannot instantiate " << svcname << "signals will be ignored" << endmsg;
456  }
457  }
458 
459  if ( m_stalledEventMonitoring ) {
460  // to monitor for stalled events we inject EventWatchdogAlg as first algorithm in TopAlg
461  auto& topAlg = m_topAlgNameList.value();
462  topAlg.insert( topAlg.begin(), "Gaudi::EventWatchdogAlg" );
463  }
464 
466  log << MSG::INFO << "Already Initialized!" << endmsg;
467  return StatusCode::SUCCESS;
468  }
470  log << MSG::FATAL << "initialize: Invalid state \"" << m_state << "\"" << endmsg;
471  return StatusCode::FAILURE;
472  }
474 
475  //--------------------------------------------------------------------------
476  // Initialize the list of top Services
477  //--------------------------------------------------------------------------
478  sc = svcManager()->initialize();
479  if ( !sc.isSuccess() ) return sc;
480 
481  sc = algManager()->initialize();
482  if ( !sc.isSuccess() ) return sc;
483 
484  //--------------------------------------------------------------------------
485  // Final steps: Inform user and change internal state
486  //--------------------------------------------------------------------------
487  log << MSG::INFO << "Application Manager Initialized successfully" << endmsg;
489 
491 
492  return sc;
493 }
494 
495 //============================================================================
496 // IAppMgrUI implementation: ApplicationMgr::start()
497 //============================================================================
499 
501 
503  log << MSG::INFO << "Already Initialized!" << endmsg;
504  return StatusCode::SUCCESS;
505  }
507  log << MSG::FATAL << "start: Invalid state \"" << m_state << "\"" << endmsg;
508  return StatusCode::FAILURE;
509  }
511 
512  //--------------------------------------------------------------------------
513  // Initialize the list of top Services
514  //--------------------------------------------------------------------------
515  return m_svcLocator->service( "JobOptionsSvc" )
516  ->sysStart()
517  .andThen( [&]() { return m_messageSvc.as<IService>()->sysStart(); } )
518  .andThen( [&]() { return svcManager()->start(); } )
519  .andThen( [&]() { return algManager()->start(); } )
520  .andThen( [&]() {
521  //--------------------------------------------------------------------------
522  // Final steps: Inform user and change internal state
523  //--------------------------------------------------------------------------
524  log << MSG::INFO << "Application Manager Started successfully" << endmsg;
526  } );
527 }
528 
529 //============================================================================
530 // IAppMgrUI implementation: ApplicationMgr::nextEvent(int)
531 //============================================================================
535  log << MSG::FATAL << "nextEvent: Invalid state \"" << m_state << "\"" << endmsg;
536  return StatusCode::FAILURE;
537  }
538  if ( !m_processingMgr ) {
540  log << MSG::FATAL << "No event processing manager specified. Check option: " << m_eventLoopMgr.name() << endmsg;
541  return StatusCode::FAILURE;
542  }
543  return m_processingMgr->nextEvent( maxevt );
544 }
545 
546 //============================================================================
547 // IAppMgrUI implementation: ApplicationMgr::stop()
548 //============================================================================
550 
552 
554  log << MSG::INFO << "Already Initialized!" << endmsg;
555  return StatusCode::SUCCESS;
556  }
558  log << MSG::FATAL << "stop: Invalid state \"" << m_state << "\"" << endmsg;
559  return StatusCode::FAILURE;
560  }
562 
563  // Stop independently managed Algorithms
564  return algManager()
565  ->stop()
566  //--------------------------------------------------------------------------
567  // Stop the list of top Services
568  //--------------------------------------------------------------------------
569  .andThen( [&]() { return svcManager()->stop(); } )
570  .andThen( [&]() { return m_messageSvc.as<IService>()->sysStop(); } )
571  .andThen( [&]() { return m_svcLocator->service( "JobOptionsSvc" )->sysStop(); } )
572  //--------------------------------------------------------------------------
573  // Final steps: Inform user and change internal state
574  //--------------------------------------------------------------------------
575  .andThen( [&]() {
576  log << MSG::INFO << "Application Manager Stopped successfully" << endmsg;
578  } );
579 }
580 
581 //============================================================================
582 // IAppMgrUI implementation: ApplicationMgr::finalize()
583 //============================================================================
587  log << MSG::INFO << "Already Finalized" << endmsg;
588  return StatusCode::SUCCESS;
589  }
591  log << MSG::FATAL << "finalize: Invalid state \"" << m_state << "\"" << endmsg;
592  return StatusCode::FAILURE;
593  }
595 
596  // disable message suppression in finalize
597  m_svcLocator->service<IProperty>( "MessageSvc" )
598  ->setProperty( Gaudi::Property<bool>( "enableSuppression", false ) )
599  .ignore();
600 
601  // Finalize independently managed Algorithms
602  StatusCode sc = algManager()->finalize();
603  if ( sc.isFailure() ) {
604  log << MSG::WARNING << "Failed to finalize an algorithm." << endmsg;
606  }
607 
608  // Finalize all Services
609  sc = svcManager()->finalize();
610  if ( sc.isFailure() ) {
611  log << MSG::WARNING << "Failed to finalize a service." << endmsg;
613  }
614 
615  // svcManager()->removeService( (IService*) m_processingMgr.get() );
616  // svcManager()->removeService( (IService*) m_runable.get() );
617 
618  if ( sc.isSuccess() ) {
619  log << MSG::INFO << "Application Manager Finalized successfully" << endmsg;
620  } else {
621  log << MSG::ERROR << "Application Manager failed to finalize" << endmsg;
622  }
623 
625  return sc;
626 }
627 
628 //============================================================================
629 // IAppMgrUI implementation: ApplicationMgr::terminate()
630 //============================================================================
633 
635  log << MSG::INFO << "Already Offline" << endmsg;
636  return StatusCode::SUCCESS;
637  }
639  log << MSG::FATAL << "terminate: Invalid state \"" << m_state << "\"" << endmsg;
640  return StatusCode::FAILURE;
641  }
642  // release all Services
644 
646  log << MSG::INFO << "Application Manager Terminated successfully" << endmsg;
648  log << MSG::INFO << "Application Manager Terminated successfully with a user requested ScheduledStop" << endmsg;
649  } else {
650  log << MSG::ERROR << "Application Manager Terminated with error code " << m_returnCode.value() << endmsg;
651  }
652 
653  {
654  auto& opts = m_svcLocator->getOptsSvc();
655  // Force a disable the auditing of finalize for MessageSvc
656  opts.set( "MessageSvc.AuditFinalize", "false" );
657  // Force a disable the auditing of finalize for JobOptionsSvc
658  opts.set( "JobOptionsSvc.AuditFinalize", "false" );
659  }
660 
661  // if we have overriden it, restore the original ROOT error handler
662  if ( s_originalRootErrorHandler ) {
663  SetErrorHandler( s_originalRootErrorHandler );
664  s_originalRootErrorHandler = nullptr;
665  }
666  // make sure ROOTErrorHandlerAdapter (if in use) does not try to use the MessageSvc we are about to delete
667  s_messageSvcInstance = nullptr;
668  // finalize MessageSvc
669  auto svc = m_messageSvc.as<IService>();
670  if ( !svc ) {
671  log << MSG::ERROR << "Could not get the IService interface of the MessageSvc" << endmsg;
672  } else {
673  svc->sysFinalize().ignore();
674  svcManager()->removeService( svc ).ignore();
675  }
676 
677  // finalize JobOptionsSvc
678  svc = m_svcLocator->service( "JobOptionsSvc" );
679  if ( !svc ) {
680  log << MSG::ERROR << "Could not get the IService interface of the JobOptionsSvc" << endmsg;
681  } else {
682  svc->sysFinalize().ignore();
683  svcManager()->removeService( svc ).ignore();
684  }
685 
687  return StatusCode::SUCCESS;
688 }
689 
690 //============================================================================
691 // Reach the required state going through all the needed transitions
692 //============================================================================
695 
696  switch ( state ) {
697 
699  switch ( m_state ) {
701  return StatusCode::SUCCESS;
702  break;
704  return terminate();
705  break;
706  default: // Gaudi::StateMachine::INITIALIZED or Gaudi::StateMachine::RUNNING
708  if ( sc.isSuccess() ) { return terminate(); }
709  break;
710  }
711  break;
712 
714  switch ( m_state ) {
716  return StatusCode::SUCCESS;
717  break;
719  return configure();
720  break;
722  return finalize();
723  break;
724  default: // Gaudi::StateMachine::RUNNING
726  if ( sc.isSuccess() ) { return finalize(); }
727  break;
728  }
729  break;
730 
732  switch ( m_state ) {
734  return StatusCode::SUCCESS;
735  break;
737  return initialize();
738  break;
740  return stop();
741  break;
742  default: // Gaudi::StateMachine::OFFLINE
744  if ( sc.isSuccess() ) { return initialize(); }
745  break;
746  }
747  break;
748 
750  switch ( m_state ) {
752  return StatusCode::SUCCESS;
753  break;
755  return start();
756  break;
757  default: // Gaudi::StateMachine::OFFLINE or Gaudi::StateMachine::CONFIGURED
759  if ( sc.isSuccess() ) { return start(); }
760  break;
761  }
762  break;
763  }
764 
765  // If I get here, there has been a problem in the recursion
766 
767  if ( ignoreFailures ) {
768  // force the new state
769  m_state = state;
770  return StatusCode::SUCCESS;
771  }
772 
773  return sc;
774 }
775 
776 //============================================================================
777 // IAppMgrUI implementation: ApplicationMgr::run()
778 //============================================================================
781 
783  if ( sc.isSuccess() ) {
785  if ( m_runable != 0 ) { // loop over the events
786  sc = m_runable->run();
787  if ( !sc.isSuccess() ) { log << MSG::FATAL << "Application execution failed. Ending the job." << endmsg; }
788  } else {
789  log << MSG::FATAL << "Application has no runable object. Check option:" << m_runableType.name() << endmsg;
790  }
791  }
792  if ( sc.isSuccess() ) { // try to close cleanly
794  }
795  // either the runable failed of the stut-down
796  if ( sc.isFailure() ) { // try to close anyway (but keep the StatusCode unchanged)
798  }
799  return sc;
800 }
801 
802 //============================================================================
803 // IEventProcessor implementation: executeEvent(EventContext&&)
804 //============================================================================
807  if ( m_processingMgr ) { return m_processingMgr->executeEvent( std::move( ctx ) ); }
808  }
810  log << MSG::FATAL << "executeEvent: Invalid state \"" << FSMState() << "\"" << endmsg;
811  return StatusCode::FAILURE;
812 }
813 
816  std::move( ctx ) );
817 }
818 
819 bool ApplicationMgr::empty() const {
821 }
822 
823 std::optional<Gaudi::Interfaces::IQueueingEventProcessor::ResultType> ApplicationMgr::pop() {
825 }
826 
829  if ( m_processingMgr ) { return m_processingMgr->createEventContext(); }
830  }
832  ss << "createEventContext: Invalid state \"" << FSMState() << '"';
833  throw GaudiException( ss.str(), name(), StatusCode::FAILURE );
834 }
835 //============================================================================
836 // IEventProcessor implementation: executeRun(int)
837 //============================================================================
841  if ( m_processingMgr ) { return m_processingMgr->executeRun( evtmax ); }
842  log << MSG::WARNING << "No EventLoop Manager specified " << endmsg;
843  return StatusCode::SUCCESS;
844  }
845  log << MSG::FATAL << "executeRun: Invalid state \"" << FSMState() << "\"" << endmsg;
846  return StatusCode::FAILURE;
847 }
848 
849 //============================================================================
850 // IEventProcessor implementation: stopRun(int)
851 //============================================================================
855  if ( m_processingMgr ) { return m_processingMgr->stopRun(); }
856  log << MSG::WARNING << "No EventLoop Manager specified " << endmsg;
857  return StatusCode::SUCCESS;
858  }
859  log << MSG::FATAL << "stopRun: Invalid state \"" << FSMState() << "\"" << endmsg;
860  return StatusCode::FAILURE;
861 }
862 // Implementation of IAppMgrUI::name
863 const std::string& ApplicationMgr::name() const { return m_name; }
864 
865 // implementation of IService::state
867 // implementation of IService::state
869 
870 //============================================================================
871 // implementation of IService::reinitilaize
872 //============================================================================
876  StatusCode sc;
878  throw GaudiException( "Cannot reinitialize application if not INITIALIZED or RUNNING",
879  "ApplicationMgr::reinitialize", StatusCode::FAILURE );
880  }
882  sc = svcManager()->reinitialize();
883  if ( sc.isFailure() ) retval = sc;
884  sc = algManager()->reinitialize();
885  if ( sc.isFailure() ) retval = sc;
886 
888  if ( sc.isFailure() ) retval = sc;
889  sc = m_svcLocator->service( "JobOptionsSvc" )->sysReinitialize();
890  if ( sc.isFailure() ) retval = sc;
891 
892  log << MSG::INFO << "Application Manager Reinitialized successfully" << endmsg;
893 
894  return retval;
895 }
896 
897 //============================================================================
898 // implementation of IService::reinitiaize
899 //============================================================================
902  StatusCode sc;
904  throw GaudiException( "Cannot restart application if not RUNNING", "ApplicationMgr::restart", StatusCode::FAILURE );
905  }
906 
907  sc = svcManager()->restart();
908  if ( sc.isFailure() ) retval = sc;
909  sc = algManager()->restart();
910  if ( sc.isFailure() ) retval = sc;
911 
912  sc = m_messageSvc.as<IService>()->sysRestart();
913  if ( sc.isFailure() ) retval = sc;
914  sc = m_svcLocator->service( "JobOptionsSvc" )->sysRestart();
915  if ( sc.isFailure() ) retval = sc;
916 
917  return retval;
918 }
919 
920 //============================================================================
921 // Handle properties of the event loop manager (Top alg/Output stream list)
922 //============================================================================
924  if ( m_processingMgr ) {
925  auto props = m_processingMgr.as<IProperty>();
926  if ( props ) props->setProperty( p ).ignore();
927  }
928 }
929 
930 //============================================================================
931 // External Service List handler
932 //============================================================================
934  if ( !( decodeCreateSvcNameList() ).isSuccess() ) {
935  throw GaudiException( "Failed to create ext services", "MinimalEventLoopMgr::createSvcNameListHandler",
937  }
938 }
939 //============================================================================
940 // decodeCreateSvcNameList
941 //============================================================================
944  const auto& theNames = m_createSvcNameList.value();
945  auto it = theNames.begin();
946  auto et = theNames.end();
947  while ( result.isSuccess() && it != et ) {
948  Gaudi::Utils::TypeNameString item( *it++ );
949  if ( ( result = svcManager()->addService( item, ServiceManager::DEFAULT_SVC_PRIORITY ) ).isFailure() ) {
951  log << MSG::ERROR << "decodeCreateSvcNameList: Cannot create service " << item.type() << "/" << item.name()
952  << endmsg;
953  } else {
954  ON_DEBUG {
956  log << MSG::DEBUG << "decodeCreateSvcNameList: Created service " << item.type() << "/" << item.name() << endmsg;
957  }
958  }
959  }
960  return result;
961 }
962 
963 //============================================================================
964 // External Service List handler
965 //============================================================================
967  if ( !( decodeExtSvcNameList() ).isSuccess() ) {
968  throw GaudiException( "Failed to declare ext services", "MinimalEventLoopMgr::extSvcNameListHandler",
970  }
971 }
972 
973 //============================================================================
974 // decodeExtSvcNameList
975 //============================================================================
978 
979  const auto& theNames = m_extSvcNameList.value();
980 
981  auto it = theNames.begin();
982  auto et = theNames.end();
983  while ( result.isSuccess() && it != et ) {
984  Gaudi::Utils::TypeNameString item( *it++ );
985  if ( m_extSvcCreates ) {
986  if ( ( result = svcManager()->addService( item, ServiceManager::DEFAULT_SVC_PRIORITY ) ).isFailure() ) {
988  log << MSG::ERROR << "decodeExtSvcNameList: Cannot create service " << item.type() << "/" << item.name()
989  << endmsg;
990  }
991  } else {
992  if ( ( result = svcManager()->declareSvcType( item.name(), item.type() ) ).isFailure() ) {
994  log << MSG::ERROR << "decodeExtSvcNameList: Cannot declare service " << item.type() << "/" << item.name()
995  << endmsg;
996  }
997  }
998  }
999  return result;
1000 }
1001 
1002 //============================================================================
1003 // Dll List handler
1004 //============================================================================
1006  if ( !( decodeDllNameList() ).isSuccess() ) {
1007  throw GaudiException( "Failed to load DLLs.", "MinimalEventLoopMgr::dllNameListHandler", StatusCode::FAILURE );
1008  }
1009 }
1010 
1011 //============================================================================
1012 // decodeDllNameList
1013 //============================================================================
1015 
1018 
1019  // Clean up multiple entries from DLL list
1020  // -------------------------------------------------------------------------
1021  std::vector<std::string> newList;
1022  std::map<std::string, unsigned int> dllInList, duplicateList;
1023  {
1024  for ( const auto& it : m_dllNameList ) {
1025  if ( 0 == dllInList[it] ) {
1026  newList.push_back( it ); // first instance of this module
1027  } else {
1028  ++duplicateList[it];
1029  } // module listed multiple times
1030  ++dllInList[it]; // increment count for this module
1031  }
1032  }
1033  // m_dllNameList = newList; // update primary list to new, filtered list (do not use the
1034  // property itself otherwise we get called again infinitely)
1035  // List modules that were in there twice..
1036  ON_DEBUG if ( !duplicateList.empty() ) {
1037  log << MSG::DEBUG << "Removed duplicate entries for modules : ";
1038  for ( auto it = duplicateList.begin(); it != duplicateList.end(); ++it ) {
1039  log << it->first << "(" << 1 + it->second << ")";
1040  if ( it != --duplicateList.end() ) log << ", ";
1041  }
1042  log << endmsg;
1043  }
1044  // -------------------------------------------------------------------------
1045 
1046  const std::vector<std::string>& theNames = newList;
1047 
1048  // only load the new dlls or previously failed dlls
1049  ON_DEBUG log << MSG::DEBUG << "Loading declared DLL's" << endmsg;
1050 
1051  std::vector<std::string> successNames, failNames;
1052  for ( const auto& it : theNames ) {
1053  if ( std::find( m_okDlls.rbegin(), m_okDlls.rend(), it ) == m_okDlls.rend() ) {
1054  // found a new module name
1055  StatusCode status = m_classManager->loadModule( it );
1056  if ( status.isFailure() ) {
1057  failNames.push_back( it );
1058  result = StatusCode::FAILURE;
1059  } else {
1060  successNames.push_back( it );
1061  }
1062  }
1063  }
1064 
1065  // report back to the user and store the names of the succesfully loaded dlls
1066  if ( !successNames.empty() ) {
1067  log << MSG::INFO << "Successfully loaded modules : ";
1068  for ( auto it = successNames.begin(); it != successNames.end(); it++ ) {
1069  log << ( *it );
1070  if ( ( it + 1 ) != successNames.end() ) log << ", ";
1071  // save name
1072  m_okDlls.push_back( *it );
1073  }
1074  log << endmsg;
1075  }
1076 
1077  if ( result == StatusCode::FAILURE ) {
1078  log << MSG::WARNING << "Failed to load modules: ";
1079  for ( auto it = failNames.begin(); it != failNames.end(); it++ ) {
1080  log << ( *it );
1081  if ( ( it + 1 ) != failNames.end() ) log << ", ";
1082  }
1083  log << endmsg;
1084  }
1085  return result;
1086 }
1087 
1089  resetMessaging();
1090  for ( auto& mgrItem : m_managers ) { mgrItem.second->outputLevelUpdate(); }
1091 }
1092 
1093 namespace {
1095  void printAlgsSequencesHelper( SmartIF<IAlgManager>& algmgr, const std::string& algname, MsgStream& log,
1096  int indent ) {
1098  log << MSG::ALWAYS;
1099  for ( int i = 0; i < indent; ++i ) log << " ";
1100  log << algname << endmsg;
1101  auto prop = algmgr->algorithm<IProperty>( algname, false );
1102  if ( prop ) {
1103  // Try to get the property Members
1104  Gaudi::Property<std::vector<std::string>> p( "Members", {} );
1105  if ( prop->getProperty( &p ).isSuccess() ) {
1106  for ( auto& subalgname : p.value() ) { printAlgsSequencesHelper( algmgr, subalgname, log, indent + 1 ); }
1107  }
1108  } else {
1109  log << MSG::WARNING << "Cannot get properties of " << algname << endmsg;
1110  }
1111  }
1112 } // namespace
1113 
1116  log << MSG::ALWAYS << "****************************** Algorithm Sequence ****************************" << endmsg;
1117  for ( auto& algname : m_topAlgNameList ) { printAlgsSequencesHelper( algManager(), algname, log, 0 ); }
1118  log << MSG::ALWAYS << "******************************************************************************" << endmsg;
1119 }
ApplicationMgr::printAlgsSequences
void printAlgsSequences()
Print the sequence of algorithms that have been loaded.
Definition: ApplicationMgr.cpp:1114
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:299
IMessageSvc
Definition: IMessageSvc.h:47
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:819
std::move
T move(T... args)
ApplicationMgr::decodeDllNameList
StatusCode decodeDllNameList()
Definition: ApplicationMgr.cpp:1014
GaudiAlg.HistoUtils.location
location
Definition: HistoUtils.py:964
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:1088
System.h
ApplicationMgr::run
StatusCode run() override
Definition: ApplicationMgr.cpp:779
ApplicationMgr::m_runable
SmartIF< IRunable > m_runable
Reference to the runable object.
Definition: ApplicationMgr.h:230
GaudiException.h
ApplicationMgr::i_startup
StatusCode i_startup()
Internal startup routine.
Definition: ApplicationMgr.cpp:150
ApplicationMgr::stop
StatusCode stop() override
Definition: ApplicationMgr.cpp:549
ApplicationMgr::m_name
std::string m_name
Name.
Definition: ApplicationMgr.h:221
System::getEnv
GAUDI_API std::string getEnv(const char *var)
get a particular environment variable (returning "UNKNOWN" if not set)
Definition: System.cpp:388
ApplicationMgr::m_messageSvcType
Gaudi::Property< std::string > m_messageSvcType
Definition: ApplicationMgr.h:216
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
check_ParticleID.props
props
Definition: check_ParticleID.py:21
GAUDI_MINOR_VERSION
#define GAUDI_MINOR_VERSION
Definition: GAUDI_VERSION.h:9
ApplicationMgr::name
const std::string & name() const override
Definition: ApplicationMgr.cpp:863
GaudiException
Definition: GaudiException.h:31
ApplicationMgr::FSMState
Gaudi::StateMachine::State FSMState() const override
Definition: ApplicationMgr.cpp:866
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:292
GaudiMP.FdsRegistry.msg
msg
Definition: FdsRegistry.py:19
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:296
System::setEnv
GAUDI_API int setEnv(const std::string &name, const std::string &value, int overwrite=1)
Set an environment variables.
Definition: System.cpp:501
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:316
ApplicationMgr::createEventContext
EventContext createEventContext() override
implementation of IEventProcessor::createEventContext()
Definition: ApplicationMgr.cpp:827
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:313
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:320
ApplicationMgr::terminate
StatusCode terminate() override
Definition: ApplicationMgr.cpp:631
IMessageSvc.h
ApplicationMgr::executeRun
StatusCode executeRun(int evtmax) override
implementation of IEventProcessor::executeRun(int)
Definition: ApplicationMgr.cpp:838
ApplicationMgr::finalize
StatusCode finalize() override
Definition: ApplicationMgr.cpp:584
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:218
ApplicationMgr::nextEvent
StatusCode nextEvent(int maxevt) override
Definition: ApplicationMgr.cpp:532
ApplicationMgr::ApplicationMgr
ApplicationMgr(IInterface *=nullptr)
Definition: ApplicationMgr.cpp:87
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:933
AlgorithmManager
Definition: AlgorithmManager.h:42
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:247
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:1005
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:303
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:578
StatusCode
Definition: StatusCode.h:65
gaudirun.opts
opts
Definition: gaudirun.py:336
Message
Definition: Message.h:26
ApplicationMgr::restart
StatusCode restart() override
Definition: ApplicationMgr.cpp:900
ApplicationMgr::configure
StatusCode configure() override
Definition: ApplicationMgr.cpp:271
IInterface::interfaceID
static const InterfaceID & interfaceID()
Return an instance of InterfaceID identifying the interface.
Definition: IInterface.h:246
DLLClassManager.h
ProduceConsume.j
j
Definition: ProduceConsume.py:101
ApplicationMgr::m_jobOptionsPostAction
Gaudi::Property< std::string > m_jobOptionsPostAction
Definition: ApplicationMgr.h:252
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:250
ApplicationMgr::pop
std::optional< Gaudi::Interfaces::IQueueingEventProcessor::ResultType > pop() override
Definition: ApplicationMgr.cpp:823
Gaudi::Property::value
const ValueType & value() const
Definition: Property.h:239
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:260
ApplicationMgr::sysReinitialize
StatusCode sysReinitialize() override
Definition: ApplicationMgr.h:109
ApplicationMgr::m_jobOptionsType
Gaudi::Property< std::string > m_jobOptionsType
Definition: ApplicationMgr.h:248
ApplicationMgr::sysRestart
StatusCode sysRestart() override
Definition: ApplicationMgr.h:111
ON_DEBUG
#define ON_DEBUG
Definition: ApplicationMgr.cpp:40
ApplicationMgr::executeEvent
StatusCode executeEvent(EventContext &&ctx) override
implementation of IEventProcessor::executeEvent(void*)
Definition: ApplicationMgr.cpp:805
SmartIF< IAlgManager >
ApplicationMgr::m_runableType
Gaudi::Property< std::string > m_runableType
Definition: ApplicationMgr.h:254
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:408
ApplicationMgr::targetFSMState
Gaudi::StateMachine::State targetFSMState() const override
Definition: ApplicationMgr.cpp:868
std::map< std::string, unsigned int >
ApplicationMgr::m_topAlgNameList
Gaudi::Property< std::vector< std::string > > m_topAlgNameList
Definition: ApplicationMgr.h:208
gaudirun.level
level
Definition: gaudirun.py:364
ApplicationMgr::m_processingMgr
SmartIF< IEventProcessor > m_processingMgr
Reference to processing manager object.
Definition: ApplicationMgr.h:231
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:225
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:226
ApplicationMgr::decodeExtSvcNameList
StatusCode decodeExtSvcNameList()
Definition: ApplicationMgr.cpp:976
gaudiComponentHelp.properties
properties
Definition: gaudiComponentHelp.py:68
ApplicationMgr::m_extSvcNameList
Gaudi::Property< std::vector< std::string > > m_extSvcNameList
Definition: ApplicationMgr.h:242
ApplicationMgr::m_eventLoopMgr
Gaudi::Property< std::string > m_eventLoopMgr
Definition: ApplicationMgr.h:255
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:244
ApplicationMgr::m_useMessageSvcForROOTMessages
Gaudi::Property< bool > m_useMessageSvcForROOTMessages
Definition: ApplicationMgr.h:309
StatusCode::isFailure
bool isFailure() const
Definition: StatusCode.h:129
ApplicationMgr::m_createSvcNameList
Gaudi::Property< std::vector< std::string > > m_createSvcNameList
Definition: ApplicationMgr.h:275
ApplicationMgr::m_actHistory
Gaudi::Property< bool > m_actHistory
Definition: ApplicationMgr.h:261
MSG::Level
Level
Definition: IMessageSvc.h:25
ApplicationMgr::serviceLocator
SmartIF< ISvcLocator > & serviceLocator() const override
Needed to locate the message service.
Definition: ApplicationMgr.h:149
PropertyHolder< CommonMessaging< implements< IAppMgrUI, Gaudi::Interfaces::IQueueingEventProcessor, IService, IStateful, INamedInterface, IProperty > > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Details::PropertyBase &prop)
Declare a property.
Definition: PropertyHolder.h:106
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:942
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:259
MSG::ALWAYS
@ ALWAYS
Definition: IMessageSvc.h:25
ApplicationMgr.h
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:852
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:923
compareRootHistos.retval
retval
Definition: compareRootHistos.py:499
EventContext
Definition: EventContext.h:34
ApplicationMgr::m_queueingProcessor
SmartIF< IQueueingEventProcessor > m_queueingProcessor
Reference to a queueing processing manager object.
Definition: ApplicationMgr.h:233
ApplicationMgr::m_outputLevel
Gaudi::Property< int > m_outputLevel
Definition: ApplicationMgr.h:258
ApplicationMgr::queryInterface
StatusCode queryInterface(const InterfaceID &iid, void **pinterface) override
Definition: ApplicationMgr.cpp:124
ApplicationMgr::m_messageSvc
SmartIF< IMessageSvc > m_messageSvc
Reference to the message service.
Definition: ApplicationMgr.h:229
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:222
ApplicationMgr::sysStart
StatusCode sysStart() override
Definition: ApplicationMgr.h:103
ApplicationMgr::m_jobOptionsPath
Gaudi::Property< std::string > m_jobOptionsPath
Definition: ApplicationMgr.h:249
ApplicationMgr::m_printAlgsSequence
Gaudi::Property< bool > m_printAlgsSequence
Definition: ApplicationMgr.h:306
std::stringstream::str
T str(T... args)
System::hostName
GAUDI_API const std::string & hostName()
Host name.
Definition: System.cpp:318
ApplicationMgr::extSvcNameListHandler
void extSvcNameListHandler(Gaudi::Details::PropertyBase &theProp)
Definition: ApplicationMgr.cpp:966
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:693
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:873
ApplicationMgr::m_loopCheck
Gaudi::Property< bool > m_loopCheck
Definition: ApplicationMgr.h:286
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:283
compareRootHistos.state
state
Definition: compareRootHistos.py:496
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:814
ApplicationMgr::start
StatusCode start() override
Definition: ApplicationMgr.cpp:498
ON_VERBOSE
#define ON_VERBOSE
Definition: ApplicationMgr.cpp:41
std::vector::rbegin
T rbegin(T... args)
MsgStream.h
Message.h
ApplicationMgr::m_targetState
Gaudi::StateMachine::State m_targetState
Internal State.
Definition: ApplicationMgr.h:223
ApplicationMgr::initialize
StatusCode initialize() override
Definition: ApplicationMgr.cpp:440
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