def changeJobProperties(self, clientName, propertyName, newValue): """Change the property of a client to a new value. Both client and property can be a regular expression in which case all properties matching will be changed to the new value. Note, this will only change properties that already exist in the JobOptionsCatalogue. Example: trigApp.changeJobProperties('.*', 'OutputLevel', DEBUG)""" jobOptSvc = InterfaceCast(gbl.IJobOptionsSvc)(Helper.service(gbl.Gaudi.svcLocator(), "JobOptionsSvc")) if not jobOptSvc: log.error("Cannot find JobOptionsSvc") return import re reClient = re.compile(clientName) reProp = re.compile(propertyName) ## Loop over all clients/properties for client in jobOptSvc.getClients(): for prop in jobOptSvc.getProperties(client): if reClient.match(client) and reProp.match(prop.name()): self.log.info("Changing %s.%s from '%s' to '%s'" % \ (client, prop.name(), prop.value(), newValue)) iprop = iProperty(client) setattr(iprop, prop.name(), newValue) return
def getHandle(self): # Auditor handles don't exist ... use iProperty try: from GaudiPython.Bindings import iProperty except ImportError: from gaudimodule import iProperty return iProperty(self.getJobOptName())
def getHandle(self): # iAlgTool isn't useful, unless one knows for sure that the tool exists try: from GaudiPython.Bindings import iProperty except ImportError: from gaudimodule import iProperty return iProperty(self.getJobOptName())
def setTHistSvcOutput(): """Helper to set THistSvc.Output""" ## Do this only in a function to not pollute the global namespace from TriggerJobOpts.HLTTriggerGetter import setTHistSvcOutput output = [] setTHistSvcOutput(output) setattr(iProperty("THistSvc"), "Output", output) return
# TrigDB modifier # Usage: athenaHLT.py --postcommand 'include("TriggerRelease/dbmod_BFieldAutoConfig.py")' ... # # Use DCS currents to configure magnetic field # from GaudiPython.Bindings import iProperty from AthenaCommon.Logging import logging log = logging.getLogger('dbmod_BFieldAutoConfig.py') db = 'CONDBR2' if '_run_number' in dir() and _run_number < 222222: db = 'COMP200' # Add the DCS folder (note the double-use of quotes) f = "'<db>COOLOFL_DCS/%s</db> /EXT/DCS/MAGNETS/SENSORDATA'" % db log.info("Adding folder %s to IOVDbSvc" % f) iProperty('IOVDbSvc').Folders.push_back(f) iProperty('AtlasFieldSvc').UseDCS = True
# TrigDB modifier # Usage: athenaMT/PT -C 'include("TriggerRelease/dbmod_CostMonForCAF.py")' ... # # Enable writing of cost monitoring ntuples at CAF # from GaudiPython.Bindings import iProperty isL2 = len(iProperty('TrigSteer_L2').properties()) > 0 isEF = len(iProperty('TrigSteer_EF').properties()) > 0 isHLT = len(iProperty('TrigSteer_HLT').properties()) > 0 if isL2: iProperty('TrigSteer_L2').doOperationalInfo = 1 iProperty('TrigSteer_L2.TrigCostExecL2').writeAlways = True if isEF: iProperty('TrigSteer_EF').doOperationalInfo = 1 iProperty('TrigSteer_EF.TrigCostExecEF').writeAlways = True if isHLT: iProperty('TrigSteer_HLT').doOperationalInfo = 1 iProperty('TrigSteer_HLT.TrigCostExecHLT').writeAlways = True
# TrigDB modifier # Usage: athenaMT/PT -C 'include("TriggerRelease/dbmod_setTimeout.py")' ... # # Set timeouts # from GaudiPython.Bindings import iProperty l2timeout = 10 * 1e9 # ns eftimeout = 180 * 1e9 # ns # This will work for L2 if len(iProperty('TrigSteer_L2').properties()) > 0: iProperty('TrigSteer_L2').softEventTimeout = 0.9 * l2timeout iProperty('TrigSteer_L2').hardEventTimeout = l2timeout # and this for EF if len(iProperty('TrigSteer_EF').properties()) > 0: iProperty('TrigSteer_EF').softEventTimeout = 0.9 * eftimeout iProperty('TrigSteer_Ef').hardEventTimeout = eftimeout
def __setattr__(self, attr, value): try: from GaudiPython.Bindings import iProperty except ImportError: from gaudimodule import iProperty return setattr(iProperty("StoreGateSvc", self), attr, value)
# TrigDB modifier # Usage: athenaMT/PT -C 'include("TriggerRelease/dbmod_chronoAuditor.py")' ... # # Enable ChronoStat auditor # from TrigCommon.TrigPyHelper import trigApp from GaudiPython.Bindings import iProperty trigApp.changeJobProperties('.*', 'AuditAlgorithms', True) trigApp.changeJobProperties('.*', 'AuditServices', True) trigApp.changeJobProperties('.*', 'AuditTools', True) trigApp.changeJobProperties('.*', 'AuditInitialize', True) iProperty('AuditorSvc').Auditors.push_back("'ChronoAuditor/ChronoAuditor'") iProperty('ChronoStatSvc').ChronoDestinationCout = True iProperty('ChronoStatSvc').PrintEllapsedTime = True
# TrigDB modifier # Usage: athenaMT/PT -C 'include("TriggerRelease/dbmod_nameAuditor.py")' ... # # Enable NameAuditor # from TrigCommon.TrigPyHelper import trigApp from GaudiPython.Bindings import iProperty trigApp.changeJobProperties('.*', 'AuditAlgorithms', True) trigApp.changeJobProperties('.*', 'AuditServices', True) trigApp.changeJobProperties('.*', 'AuditTools', True) trigApp.changeJobProperties('.*', 'AuditInitialize', True) iProperty('AuditorSvc').Auditors.push_back("'NameAuditor/NameAuditor'")
# Change the partition name in HLTConfigSvc to avoid collissions between # parallel running ATN tests from GaudiPython.Bindings import iProperty from TrigP1Test.PrescaleChange import partitionName prop = iProperty('HLTConfigSvc') prop.PartitionName = partitionName
# TrigDB modifier # Usage: athenaMT/PT -C 'include("TriggerRelease/dbmod_ignorePrescales.py")' ... # # Ignore prescales # from GaudiPython.Bindings import iProperty # This will work for L2 if len(iProperty('TrigSteer_L2.Lvl1Converter').properties())>0: iProperty('TrigSteer_L2.Lvl1Converter').ignorePrescales = True # and this for EF if len(iProperty('TrigSteer_EF.Lvl1Converter').properties())>0: iProperty('TrigSteer_EF.Lvl1Converter').ignorePrescales = True
def __setattr__( self, attr, value ): try: from GaudiPython.Bindings import iProperty except ImportError: from gaudimodule import iProperty return setattr( iProperty("StoreGateSvc", self), attr, value )
## Set OutputLevel in JobOptionsSvc if "-l" option was used in athenaMT/PT if logLevel[0] != "INFO": outputLevel = int(locals()[logLevel[0]]) outputLevelProp = gbl.IntegerProperty("OutputLevel", outputLevel) ## Reset message levels trigApp.service("MessageSvc", gbl.ITrigMessageSvc).resetOutputLevels() trigApp.service("MessageSvc", gbl.IMessageSvc).setOutputLevel(outputLevel) jobOptSvc = trigApp.service("JobOptionsSvc", gbl.IJobOptionsSvc) ## Set OutputLevel in JobOptionsSvc for client in jobOptSvc.getClients(): for prop in jobOptSvc.getProperties(client): if prop.name() == "OutputLevel": iProperty(client).OutputLevel = outputLevel ## For running with offline THistSvc from online DB from TrigServices.TriggerUnixStandardSetup import _Conf if not _Conf.useOnlineTHistSvc: isvcMgr = InterfaceCast(gbl.ISvcManager)(gbl.Gaudi.svcLocator()) ## Change service type from TrigMonTHistSvc to THistSvc isvcMgr.declareSvcType("THistSvc", "THistSvc") setTHistSvcOutput() if 'interactive' in dir(): PscConfig.interactive = bool(interactive) del interactive ## Some cleanup del _Conf