Skip to content
Snippets Groups Projects
Commit 7416ce46 authored by Walter Lampl's avatar Walter Lampl
Browse files

Merge branch 'menumt_newjo' into 'master'

TriggerMenuMT: Fix JSON generation during CI tests

Closes ATR-20096

See merge request atlas/athena!25257
parents fd225f6e 1ddc2645
No related branches found
No related tags found
No related merge requests found
# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration # Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
import json
from AthenaCommon.Logging import logging from AthenaCommon.Logging import logging
__log = logging.getLogger( 'HLTMenuJSON.py' ) __log = logging.getLogger( 'HLTMenuJSON.py' )
...@@ -26,35 +27,34 @@ def __generateJSON( chainDicts, sequences, menuName ): ...@@ -26,35 +27,34 @@ def __generateJSON( chainDicts, sequences, menuName ):
"streams": streamDicts } "streams": streamDicts }
menuDict["chains"].append( chainDict ) menuDict["chains"].append( chainDict )
counter += 1 counter += 1
__log.info( "Menu name:" + menuName ) from AthenaCommon.AppMgr import release_metadata
with open( menuName+'.json', 'w' ) as fp: fileName = "HLTmenu_%s_%s.json" % (menuName, release_metadata()['release'])
import json
__log.info( "Writing trigger menu to %s", fileName )
with open( fileName, 'w' ) as fp:
json.dump( menuDict, fp, indent=4, sort_keys=True ) json.dump( menuDict, fp, indent=4, sort_keys=True )
def generateJSON( allStepsSequence ): def generateJSON( allStepsSequence ):
__log.info("Generating HLT JSON config in the rec-ex-common job") __log.info("Generating HLT JSON config in the rec-ex-common job")
from TriggerJobOpts.TriggerFlags import TriggerFlags from TriggerJobOpts.TriggerFlags import TriggerFlags
from TriggerMenuMT.HLTMenuConfig.Menu.TriggerConfigHLT import TriggerConfigHLT from TriggerMenuMT.HLTMenuConfig.Menu.TriggerConfigHLT import TriggerConfigHLT
triggerConfigHLT = TriggerConfigHLT.currentTriggerConfig() triggerConfigHLT = TriggerConfigHLT.currentTriggerConfig()
import os
return __generateJSON( triggerConfigHLT.allChainDicts, None, "HLTmenu_"+os.getenv( "AtlasVersion" ) + "." + TriggerFlags.triggerMenuSetup() ) return __generateJSON( triggerConfigHLT.allChainDicts, None, TriggerFlags.triggerMenuSetup() )
def generateJSON_newJO( allStepsSequence ): def generateJSON_newJO( allStepsSequence ):
__log.info("Generating HLT JSON config in the new JO") __log.info("Generating HLT JSON config in the new JO")
from AthenaConfiguration.AllConfigFlags import ConfigFlags from AthenaConfiguration.AllConfigFlags import ConfigFlags
from TriggerMenuMT.HLTMenuConfig.Menu import DictFromChainName from TriggerMenuMT.HLTMenuConfig.Menu import DictFromChainName
decoder = DictFromChainName.DictFromChainName() decoder = DictFromChainName.DictFromChainName()
chainDicts = [] chainDicts = []
#TODO, once we move to New JO, it is likely there will be a repository with all chains #TODO, once we move to New JO, it is likely there will be a repository with all chains
#we shoudl switch to use it then #we should switch to use it then
for name, cfgFlag in list( ConfigFlags._flagdict.iteritems() ): for name, cfgFlag in list( ConfigFlags._flagdict.iteritems() ):
if 'Trigger.menu.' in name: if 'Trigger.menu.' in name:
for chain in ConfigFlags._get( name ): for chain in ConfigFlags._get( name ):
chainDicts.append( decoder.getChainDict( chain ) ) chainDicts.append( decoder.getChainDict( chain ) )
import os return __generateJSON( chainDicts, None, ConfigFlags.Trigger.triggerMenuSetup )
return __generateJSON( chainDicts, None, "HLTmenu_"+os.getenv( "AtlasVersion" ) + "." + ConfigFlags.Trigger.triggerMenuSetup )
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment