Skip to content
Snippets Groups Projects
Commit 1ffb394c authored by Vakhtang Tsulaia's avatar Vakhtang Tsulaia
Browse files

Merge branch 'add_script' into 'master'

add menu json parsing script

See merge request atlas/athena!40607
parents ea92908a 5f33b4d0
No related branches found
No related tags found
No related merge requests found
......@@ -109,6 +109,7 @@ atlas_install_scripts( scripts/generateLVL1MenuMT.py
scripts/verify_menu_config.py
scripts/test_full_menu_cf.py
scripts/generateBunchGroupSetFromOldKey.py
scripts/extract_chain_from_json.py
POST_BUILD_CMD ${ATLAS_FLAKE8} )
# Shell scripts without flake8 checking:
......
#!/usr/bin/env python
# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
import json
import pprint
import argparse
parser = argparse.ArgumentParser(description='Get the inputs for chain extraction')
parser.add_argument('--chain', dest='chain', action='store', default='',
help='What chain are we extracting')
parser.add_argument('--menu_json', dest='input_json', action='store', default='',
help='What menu are we extracting the chain from')
args = parser.parse_args()
chain = args.chain
input_json = args.input_json
the_menu = json.loads(open(input_json).read())
print("...extracting",chain,"from menu json",input_json)
if chain not in the_menu['chains']:
raise Exception("The requested chain isn't in the provided menu json, please try again.")
pprint.pprint(the_menu['chains'][chain])
print("Steps in the chain:")
for isq,seq in enumerate(the_menu['chains'][chain]['sequencers']):
if not seq:
print('step',isq+1,'is empty')
continue
else:
print('step',isq+1,'is sequence ',seq)
other_chains = []
for chain in the_menu['chains']:
if seq in the_menu['chains'][chain]['sequencers']:
other_chains += [chain]
if len(other_chains) > 0:
print (' also used in the following chains:')
pprint.pprint(other_chains)
else:
print (' is not used in any other chains.')
print (' contains algorithms/hypos:')
pprint.pprint(the_menu['sequencers'][seq])
\ No newline at end of file
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