ATLAS Offline Software
Loading...
Searching...
No Matches
athenaEF.RuntimeOverrides Class Reference
Collaboration diagram for athenaEF.RuntimeOverrides:

Public Member Functions

 __init__ (self)
 declare_type (self, name, type_)
 drop_service (self, name)
 create_service (self, name, type_=None)
 set (self, key, value)
 apply (self)

Public Attributes

dict service_types = {}
list create_services = []
list drop_services = []
dict properties = {}

Detailed Description

Changes applied to the configuration after ApplicationMgr::configure() and before initialize(). 
Built entirely in main() from the command line and applied once in ConfigRunner.run(), adding a new override is a single line.
NB: we bypass the ComponentAccumulator. They must not end up in the generated JobOptions.

Definition at line 519 of file athenaEF.py.

Constructor & Destructor Documentation

◆ __init__()

athenaEF.RuntimeOverrides.__init__ ( self)

Definition at line 525 of file athenaEF.py.

525 def __init__(self):
526 self.service_types = {} # service name -> type
527 self.create_services = [] # (name, type) to create
528 self.drop_services = [] # service names to remove
529 self.properties = {} # "Component.Property" -> value
530

Member Function Documentation

◆ apply()

athenaEF.RuntimeOverrides.apply ( self)
Apply all overrides.

Definition at line 547 of file athenaEF.py.

547 def apply(self):
548 """Apply all overrides."""
549 from GaudiPython import InterfaceCast, gbl
550 from GaudiPython.Bindings import iProperty
551
552 if self.service_types or self.create_services or self.drop_services:
553 svcMgr = InterfaceCast(gbl.ISvcManager)(gbl.Gaudi.svcLocator())
554 for name, type_ in self.service_types.items():
555 log.info("Configuring %s under the name %s", type_, name)
556 svcMgr.declareSvcType(name, type_)
557 for name, type_ in self.create_services:
558 # For services not listed in the configuration.
559 if svcMgr.addService(gbl.Gaudi.Utils.TypeNameString(f"{type_}/{name}")).isSuccess():
560 log.info("Created service %s/%s", type_, name)
561 else:
562 log.error("Failed to create service %s/%s", type_, name)
563 for name in self.drop_services:
564 # Services are instantiated by configure(), they have to be taken out before initialize().
565 if svcMgr.removeService(name).isSuccess():
566 log.info("Removed service %s", name)
567 else:
568 log.debug("Service %s not present, nothing to remove", name)
569
570 for key, value in self.properties.items():
571 component, _, prop = key.rpartition('.')
572 log.info("Overriding %s.%s = %s (from command line)", component, prop, value)
573 setattr(iProperty(component), prop, value)
574
575

◆ create_service()

athenaEF.RuntimeOverrides.create_service ( self,
name,
type_ = None )
Schedule the creation of a service the configuration does not list

Definition at line 539 of file athenaEF.py.

539 def create_service(self, name, type_=None):
540 """Schedule the creation of a service the configuration does not list"""
541 self.create_services.append((name, type_ or name))
542

◆ declare_type()

athenaEF.RuntimeOverrides.declare_type ( self,
name,
type_ )
Schedule the service registered as 'name' to be of type 'type_'

Definition at line 531 of file athenaEF.py.

531 def declare_type(self, name, type_):
532 """Schedule the service registered as 'name' to be of type 'type_'"""
533 self.service_types[name] = type_
534

◆ drop_service()

athenaEF.RuntimeOverrides.drop_service ( self,
name )
Schedule the removal of a service already created by configure()

Definition at line 535 of file athenaEF.py.

535 def drop_service(self, name):
536 """Schedule the removal of a service already created by configure()"""
537 self.drop_services.append(name)
538

◆ set()

athenaEF.RuntimeOverrides.set ( self,
key,
value )
Schedule 'Component.Property' = value

Definition at line 543 of file athenaEF.py.

543 def set(self, key, value):
544 """Schedule 'Component.Property' = value"""
545 self.properties[key] = value
546
STL class.

Member Data Documentation

◆ create_services

list athenaEF.RuntimeOverrides.create_services = []

Definition at line 527 of file athenaEF.py.

◆ drop_services

list athenaEF.RuntimeOverrides.drop_services = []

Definition at line 528 of file athenaEF.py.

◆ properties

dict athenaEF.RuntimeOverrides.properties = {}

Definition at line 529 of file athenaEF.py.

◆ service_types

dict athenaEF.RuntimeOverrides.service_types = {}

Definition at line 526 of file athenaEF.py.


The documentation for this class was generated from the following file: