ATLAS Offline Software
Loading...
Searching...
No Matches
python.AthHLT Namespace Reference

Classes

class  CondDB

Functions

dict[str, Any]|None get_sor_params (run_number)
dict[str, Any]|None get_eor_params_crest (run_number, str crest_server)
 get_trigconf_keys (run_number, lb_number)
 get_trigconf_keys_crest (run_number, lb_number, crest_server)
 getCACfg (jopath)
 reload_from_json (filename, suppress_args=[])

Variables

 log = logging.getLogger('athenaHLT')
dict[str, Any]|None d = get_sor_params(327265)

Function Documentation

◆ get_eor_params_crest()

dict[str, Any] | None python.AthHLT.get_eor_params_crest ( run_number,
str crest_server )

Definition at line 53 of file AthHLT.py.

53def get_eor_params_crest(run_number, crest_server:str) -> dict[str, Any] | None:
54 from TrigConfStorage.TriggerCrestUtil import TriggerCrestUtil
55 log.info('Reading EOR record for run %s from Crest', run_number)
56 return TriggerCrestUtil.getEORParams(run_number, server=crest_server)
57
58@cache

◆ get_sor_params()

dict[str, Any] | None python.AthHLT.get_sor_params ( run_number)

Definition at line 30 of file AthHLT.py.

30def get_sor_params(run_number) -> dict[str, Any] | None:
31 from CoolConvUtilities import AtlCoolLib
32
33 log.info('Reading SOR record for run %s from COOL', run_number)
34
35 cdb = CondDB(run_number)
36 dbcon = AtlCoolLib.readOpen('COOLONL_TDAQ/%s' % cdb.db_instance())
37 folder = dbcon.getFolder(cdb.sor_folder()) # type: ignore
38
39 # need to keep sor variable while using payload (cannot do the following in
40 # one single line nor overwrite sor). Otherwise: 1) GC comes into play;
41 # 2) the object is deleted; 3) since it's a shared_ptr, the internal
42 # cool::IObject also gets deleted; 4) payload is not valid any longer
43 try:
44 sor = folder.findObject(run_number << 32, 0)
45 except Exception:
46 return None # This can happen for unknown run numbers
47
48 payload = sor.payload()
49 d = {k: payload[k] for k in payload}
50 return d
51
52@cache

◆ get_trigconf_keys()

python.AthHLT.get_trigconf_keys ( run_number,
lb_number )
Read Trigger keys from COOL

Definition at line 59 of file AthHLT.py.

59def get_trigconf_keys(run_number, lb_number):
60 """Read Trigger keys from COOL"""
61
62 from TrigConfStorage.TriggerCoolUtil import TriggerCoolUtil
63 confKeys: dict[str, Any] = TriggerCoolUtil.getTrigConfKeys(run_number, lb_number)
64 confKeys['DBAlias'] = confKeys.pop('DB', None)
65 return confKeys
66
67
68@cache

◆ get_trigconf_keys_crest()

python.AthHLT.get_trigconf_keys_crest ( run_number,
lb_number,
crest_server )
Read Trigger keys from CREST

Definition at line 69 of file AthHLT.py.

69def get_trigconf_keys_crest(run_number, lb_number, crest_server):
70 """Read Trigger keys from CREST"""
71 from TrigConfStorage.TriggerCrestUtil import TriggerCrestUtil
72 log.info("Using CREST server %s", crest_server)
73 api: CrestApi = TriggerCrestUtil.getCrestApi(server=crest_server)
74 confKeys: dict[str, Any] = TriggerCrestUtil.getTrigConfKeys(run_number, lb_number, api=api)
75 confKeys['DBAlias'] = confKeys.pop('DB', None)
76 return confKeys
77

◆ getCACfg()

python.AthHLT.getCACfg ( jopath)
Return the CA Cfg function based on joboptions path.
The format is MODULE[.FNC]. If no FNC is given, 'main' will be tried.

Definition at line 78 of file AthHLT.py.

78def getCACfg(jopath):
79 """Return the CA Cfg function based on joboptions path.
80 The format is MODULE[.FNC]. If no FNC is given, 'main' will be tried."""
81
82 import importlib
83
84 sys.path.append('.') # temporarily add local directory to search path
85
86 # try to import module as given:
87 try:
88 module = importlib.import_module(jopath)
89 except ModuleNotFoundError:
90 if '.' not in jopath:
91 raise
92 # or interpret as module.fnc:
93 mod_name, fnc_name = jopath.rsplit('.', maxsplit=1)
94 module = importlib.import_module(mod_name)
95 else:
96 # if the first import worked we are using the 'main(flags)' function:
97 fnc_name = 'main'
98
99 sys.path.pop()
100
101 log.info("Loading %s.%s", module.__name__, fnc_name)
102 return getattr(module, fnc_name)
103
104

◆ reload_from_json()

python.AthHLT.reload_from_json ( filename,
suppress_args = [] )
Re-launch athenaHLT from the given json file. Optionally suppress
the list of command line args (e.g. flags).

Definition at line 105 of file AthHLT.py.

105def reload_from_json(filename, suppress_args=[]):
106 """Re-launch athenaHLT from the given json file. Optionally suppress
107 the list of command line args (e.g. flags)."""
108
109 # Remove all command line args that are not compatible with running from JSON:
110 argv = []
111 for arg_index, arg in enumerate(sys.argv):
112 if arg == '--dump-config-reload':
113 continue
114 if arg in ['--precommand', '-c', '--postcommand', '-C']:
115 continue
116 if arg_index > 0 and sys.argv[arg_index-1] in ['--precommand', '-c', '--postcommand', '-C']:
117 continue
118 if arg.startswith('--precommand') or arg.startswith('--postcommand'):
119 continue
120 if arg in suppress_args:
121 continue
122 argv.append(arg)
123
124 argv[-1] = filename
125 log.info('Restarting %s from %s ...', argv[0], argv[-1])
126 sys.stdout.flush()
127 sys.stderr.flush()
128 os.execvp(argv[0], argv)
129
130
131#
132# Testing (used as ctest)
133#

Variable Documentation

◆ d

python.AthHLT.d = get_sor_params(327265)

Definition at line 141 of file AthHLT.py.

◆ log

python.AthHLT.log = logging.getLogger('athenaHLT')

Definition at line 8 of file AthHLT.py.