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)
 add_command (self, cmd)
 apply (self)

Public Attributes

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

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 516 of file athenaEF.py.

Constructor & Destructor Documentation

◆ __init__()

athenaEF.RuntimeOverrides.__init__ ( self)

Definition at line 522 of file athenaEF.py.

522 def __init__(self):
523 self.service_types = {} # service name -> type
524 self.create_services = [] # (name, type) to create
525 self.drop_services = [] # service names to remove
526 self.properties = {} # "Component.Property" -> value
527 self.commands = [] # Post commands to execute (--postcommand)
528

Member Function Documentation

◆ add_command()

athenaEF.RuntimeOverrides.add_command ( self,
cmd )
Schedule a Python command to be executed after configure()

Definition at line 545 of file athenaEF.py.

545 def add_command(self, cmd):
546 """Schedule a Python command to be executed after configure()"""
547 self.commands.append(cmd)
548

◆ apply()

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

Definition at line 549 of file athenaEF.py.

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

◆ create_service()

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

Definition at line 537 of file athenaEF.py.

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

◆ declare_type()

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

Definition at line 529 of file athenaEF.py.

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

◆ drop_service()

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

Definition at line 533 of file athenaEF.py.

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

◆ set()

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

Definition at line 541 of file athenaEF.py.

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

Member Data Documentation

◆ commands

list athenaEF.RuntimeOverrides.commands = []

Definition at line 527 of file athenaEF.py.

◆ create_services

list athenaEF.RuntimeOverrides.create_services = []

Definition at line 524 of file athenaEF.py.

◆ drop_services

list athenaEF.RuntimeOverrides.drop_services = []

Definition at line 525 of file athenaEF.py.

◆ properties

dict athenaEF.RuntimeOverrides.properties = {}

Definition at line 526 of file athenaEF.py.

◆ service_types

dict athenaEF.RuntimeOverrides.service_types = {}

Definition at line 523 of file athenaEF.py.


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