5 from AthenaCommon.Logging
import logging
6 log = logging.getLogger(
'athenaHLT')
8 from functools
import cache
23 return '/TDAQ/RunCtrl/SOR'
25 return '/TDAQ/RunCtrl/SOR_Params'
29 from CoolConvUtilities
import AtlCoolLib
31 log.info(
'Reading SOR record for run %s from COOL', run_number)
34 dbcon = AtlCoolLib.readOpen(
'COOLONL_TDAQ/%s' % cdb.db_instance())
35 folder = dbcon.getFolder(cdb.sor_folder())
42 sor = folder.findObject(run_number << 32, 0)
46 payload = sor.payload()
47 d = {k: payload[k]
for k
in payload}
53 """Read Trigger keys from COOL"""
55 from TrigConfStorage.TriggerCoolUtil
import TriggerCoolUtil
58 db = TriggerCoolUtil.GetConnection(cdb.db_instance())
59 run_range = [[run_number,run_number]]
61 d[
'SMK'] = TriggerCoolUtil.getHLTConfigKeys(db, run_range)[run_number][
'SMK']
64 for (key, firstLB, lastLB)
in keys:
65 if lb_number>=firstLB
and lb_number<=lastLB:
70 d[
'LVL1PSK'] = findKey(TriggerCoolUtil.getL1ConfigKeys(db, run_range)[run_number][
'LVL1PSK'])
71 d[
'HLTPSK'] = findKey(TriggerCoolUtil.getHLTPrescaleKeys(db, run_range)[run_number][
'HLTPSK2'])
77 """Return the CA Cfg function based on joboptions path.
78 The format is MODULE[.FNC]. If no FNC is given, 'main' will be tried."""
86 module = importlib.import_module(jopath)
87 except ModuleNotFoundError:
91 mod_name, fnc_name = jopath.rsplit(
'.', maxsplit=1)
92 module = importlib.import_module(mod_name)
99 log.info(
"Loading %s.%s", module.__name__, fnc_name)
100 return getattr(module, fnc_name)
104 """Re-launch athenaHLT from the given json file. Optionally suppress
105 the list of command line args (e.g. flags)."""
109 for arg_index, arg
in enumerate(sys.argv):
110 if arg ==
'--dump-config-reload':
112 if arg
in [
'--precommand',
'-c',
'--postcommand',
'-C']:
114 if arg_index > 0
and sys.argv[arg_index-1]
in [
'--precommand',
'-c',
'--postcommand',
'-C']:
116 if arg.startswith(
'--precommand')
or arg.startswith(
'--postcommand'):
118 if arg
in suppress_args:
123 log.info(
'Restarting %s from %s ...', argv[0], argv[-1])
126 os.execvp(argv[0], argv)
132 if __name__==
'__main__':
141 assert(d[
'DetectorMask']==
'0000000000000000c10069fffffffff7')
145 assert(d[
'DetectorMask']==281474976710647)
150 assert(d[
'SMK']==2749)
151 assert(d[
'LVL1PSK']==15186)
152 assert(d[
'HLTPSK']==17719)
156 assert(d[
'SMK']==2749)
157 assert(d[
'LVL1PSK']==23504)
158 assert(d[
'HLTPSK']==17792)