|
| str|None | getCrestConnection (str oracle_db) |
| |
| CrestApi | getCrestApi (str server) |
| |
| dict[str, dict[str, Any]] | getConditionsForTimestamp (str tag, *int timestamp, str server="", CrestApi|None api=None, bool get_time_type=False) |
| |
| list[dict[str, dict[str, Any]]] | getConditionsInRange (str tag, *int since, int until, str server="", CrestApi|None api=None, bool get_time_type=False) |
| |
| str | getTagTimeType (str tag, *str server="", CrestApi|None api=None) |
| |
| list[str] | getAttribs (str tag, *str server="", CrestApi|None api=None) |
| |
| dict | getPayloadFromHash (str payload_hash, *str server="", CrestApi|None api=None) |
| |
| dict[str, Any]|None | getEORParams (int run, *str server="", CrestApi|None api=None) |
| |
| list[dict[str, dict[str, Any]]] | getHLTPrescaleKeys (int run, *str server="", CrestApi|None api=None) |
| |
| list[dict[str, dict[str, Any]]] | getL1ConfigKeys (int run, *str server="", CrestApi|None api=None) |
| |
| list[dict[str, dict[str, Any]]] | getBunchGroupKey (int run, *str server="", CrestApi|None api=None) |
| |
| dict | getHLTConfigKeys (int run, *str server="", CrestApi|None api=None) |
| |
|
| None | _update_with_time_type (dict[str, Any] result, str time_type, int since) |
| |
| dict | _get_payload (payload_hash, api) |
| |
| dict | _get_payload_workaround (payload_hash, server) |
| |
| def | _get_iovs_for_run (str tag, *int run, CrestApi api) |
| |
| IovSetDto|HTTPResponse | _get_iov_for_timestamp (str tag, *int timestamp, CrestApi api) |
| |
| IovSetDto|HTTPResponse | _get_iovs_range (*int since, int until, CrestApi api, str tag) |
| |
| tuple[list[Any], dict[Any, Any]] | _get_payload_spec (str tag, CrestApi api) |
| |
Definition at line 13 of file TriggerCrestUtil.py.
◆ _get_iov_for_timestamp()
| IovSetDto | HTTPResponse python.TriggerCrestUtil.TriggerCrestUtil._get_iov_for_timestamp |
( |
str |
tag, |
|
|
*int |
timestamp, |
|
|
CrestApi |
api |
|
) |
| |
|
staticprivate |
Helper to retrieve the IOV for a given timestamp
Args:
tag (str): tag name
timestamp (int): time-stamp in format run<32+lb or time in nanoseconds since 1.1.1970
api (CrestApi): Crest API instance.
Returns:
IovSetDto: set of IOVs (of size 1)
Definition at line 369 of file TriggerCrestUtil.py.
369 def _get_iov_for_timestamp(tag: str, *, timestamp: int, api: CrestApi) -> IovSetDto | HTTPResponse:
370 """Helper to retrieve the IOV for a given timestamp
374 timestamp (int): time-stamp in format run<32+lb or time in nanoseconds since 1.1.1970
375 api (CrestApi): Crest API instance.
378 IovSetDto: set of IOVs (of size 1)
381 return api.select_iovs(tag,
"0",
str(timestamp+1), sort=
'id.since:DESC', size=1, snapshot=0)
◆ _get_iovs_for_run()
| def python.TriggerCrestUtil.TriggerCrestUtil._get_iovs_for_run |
( |
str |
tag, |
|
|
*int |
run, |
|
|
CrestApi |
api |
|
) |
| |
|
staticprivate |
Helper to retrieve all IOVs for a run
Definition at line 362 of file TriggerCrestUtil.py.
362 def _get_iovs_for_run(tag: str, *, run: int, api: CrestApi):
363 """Helper to retrieve all IOVs for a run"""
364 run_start = (run << 32) + 1
365 run_end = ((run + 1) << 32) - 1
366 return TriggerCrestUtil._get_iovs_range(since=run_start, until=run_end, api=api, tag=tag)
◆ _get_iovs_range()
| IovSetDto | HTTPResponse python.TriggerCrestUtil.TriggerCrestUtil._get_iovs_range |
( |
*int |
since, |
|
|
int |
until, |
|
|
CrestApi |
api, |
|
|
str |
tag |
|
) |
| |
|
staticprivate |
Helper to retrieve the IOV in a given range
Args:
tag (str): tag name
since (int): start of the range (either run<32+lb or time in nanoseconds since 1.1.1970, inclusive)
until (int): end of the range (either run<32+lb or time in nanoseconds since 1.1.1970, exclusive)
api (CrestApi): Crest API instance.
Returns:
IovSetDto: set of IOVs
Definition at line 384 of file TriggerCrestUtil.py.
384 def _get_iovs_range(*, since: int, until: int, api: CrestApi, tag: str) -> IovSetDto | HTTPResponse:
385 """Helper to retrieve the IOV in a given range
389 since (int): start of the range (either run<32+lb or time in nanoseconds since 1.1.1970, inclusive)
390 until (int): end of the range (either run<32+lb or time in nanoseconds since 1.1.1970, exclusive)
391 api (CrestApi): Crest API instance.
394 IovSetDto: set of IOVs
397 iovs = api.select_iovs(tag,
"0",
str(since+1), sort=
'id.since:DESC', size=1, snapshot=0)
398 if cast(int, iovs[
'size']) < 1:
399 raise RuntimeError(f
"Did not get an iov which includes the start of run {since}")
400 firstiov = cast(list, iovs[
'resources'])[0]
401 all_iovs = api.select_iovs(tag,
str(firstiov[
'since']),
str(until), sort=
'id.since:ASC', snapshot=0)
◆ _get_payload()
| dict python.TriggerCrestUtil.TriggerCrestUtil._get_payload |
( |
|
payload_hash, |
|
|
|
api |
|
) |
| |
|
staticprivate |
Definition at line 337 of file TriggerCrestUtil.py.
337 def _get_payload(payload_hash, api) -> dict:
338 return api.get_payload(hash=payload_hash).
decode(
'utf-8')
◆ _get_payload_spec()
| tuple[list[Any], dict[Any, Any]] python.TriggerCrestUtil.TriggerCrestUtil._get_payload_spec |
( |
str |
tag, |
|
|
CrestApi |
api |
|
) |
| |
|
staticprivate |
Helper to retrieve the payload spec for a given tag
Definition at line 405 of file TriggerCrestUtil.py.
405 def _get_payload_spec(tag: str, api: CrestApi) -> tuple[list[Any], dict[Any, Any]]:
406 """Helper to retrieve the payload spec for a given tag"""
407 meta: TagMetaSetDto | HTTPResponse = api.find_tag_meta(tag)
408 tag_info = cast(list, meta[
'resources'])[0][
'tag_info']
409 tag_info_dict = json.loads(tag_info)
412 for d
in tag_info_dict[
'payload_spec']:
415 return attr_list, type_dict
◆ _get_payload_workaround()
| dict python.TriggerCrestUtil.TriggerCrestUtil._get_payload_workaround |
( |
|
payload_hash, |
|
|
|
server |
|
) |
| |
|
staticprivate |
Definition at line 341 of file TriggerCrestUtil.py.
341 def _get_payload_workaround(payload_hash, server) -> dict:
344 url = f
"{server}/payloads/data"
349 preq = requests.Request(method=
'GET', url=url, params=params).prepare()
350 with requests.Session()
as session:
352 resp = session.send(preq)
353 except requests.ConnectionError
as exc:
354 raise RuntimeError(f
"Could not connect to CREST server {server}")
from exc
356 if resp.status_code != 200:
357 raise RuntimeError(f
"Query {payload_hash} to crest failed with status code {resp.status_code}")
359 return json.loads(resp.content)
◆ _update_with_time_type()
| None python.TriggerCrestUtil.TriggerCrestUtil._update_with_time_type |
( |
dict[str, Any] |
result, |
|
|
str |
time_type, |
|
|
int |
since |
|
) |
| |
|
staticprivate |
Definition at line 323 of file TriggerCrestUtil.py.
323 def _update_with_time_type(result: dict[str, Any], time_type: str, since: int) ->
None:
324 result[
'time_type'] = time_type
325 if time_type ==
'run-lumi':
327 'since_run': since >> 32,
328 'since_lb': since & 0xFFFFFFFF
330 elif time_type ==
'time':
332 'since_formatted': dt.fromtimestamp(since / 1e9)
◆ getAttribs()
| list[str] python.TriggerCrestUtil.TriggerCrestUtil.getAttribs |
( |
str |
tag, |
|
|
*str |
server = "", |
|
|
CrestApi | None |
api = None |
|
) |
| |
|
static |
list of attributes for this tag
Args:
tag (str): tag name
server (str, optional): crest server name. Only needed if api is not provided. Defaults to "".
api (CrestApi, optional): Crest API instance. Defaults to None.
Raises:
RuntimeError: if both server and api are missing
Returns:
dict: list of attributes
Definition at line 188 of file TriggerCrestUtil.py.
188 def getAttribs(tag: str, *, server: str =
"", api: CrestApi |
None =
None) -> list[str]:
189 """ list of attributes for this tag
193 server (str, optional): crest server name. Only needed if api is not provided. Defaults to "".
194 api (CrestApi, optional): Crest API instance. Defaults to None.
197 RuntimeError: if both server and api are missing
200 dict: list of attributes
202 if server==
"" and api
is None:
203 log.error(
"Need either crest_server name or crest api for retrieving the payload")
204 raise RuntimeError(
"Crest access information missing")
206 api = CrestApi(host=server)
207 attr_list, _ = TriggerCrestUtil._get_payload_spec(tag, api)
◆ getBunchGroupKey()
| list[dict[str, dict[str, Any]]] python.TriggerCrestUtil.TriggerCrestUtil.getBunchGroupKey |
( |
int |
run, |
|
|
*str |
server = "", |
|
|
CrestApi | None |
api = None |
|
) |
| |
|
static |
Definition at line 275 of file TriggerCrestUtil.py.
275 def getBunchGroupKey(run: int, *, server: str =
"", api: CrestApi |
None =
None) -> list[dict[str, dict[str, Any]]]:
277 api = CrestApi(host=server)
278 run_start = (run << 32)
279 run_end = ((run+1) << 32)-1
280 cond = TriggerCrestUtil.getConditionsInRange(
"TRIGGERLVL1BunchGroupKey-HEAD", since=run_start, until=run_end, api=api, get_time_type=
True)
282 entry.update(entry.pop(
'payload')[
'0'])
283 entry[
'key'] = entry.pop(
'Lvl1BunchGroupConfigurationKey')
◆ getConditionsForTimestamp()
| dict[str, dict[str, Any]] python.TriggerCrestUtil.TriggerCrestUtil.getConditionsForTimestamp |
( |
str |
tag, |
|
|
*int |
timestamp, |
|
|
str |
server = "", |
|
|
CrestApi | None |
api = None, |
|
|
bool |
get_time_type = False |
|
) |
| |
|
static |
Conditions data for tag at a specific timestamp
Conditions data is returned as a dict with 'since' and 'payload' keys.
The 'payload' itself is a dict of channel:'data dicts'. The 'data dict' has attribute names as
keys and the corresponding values. If get_time_type is True, also 'time_type' key is added to
each IOV dict and the since is further expanded into 'since_run' and 'since_lb' (for run/lb-based
timestamps) or 'since_formatted' (for time-based timestamps).
Args:
tag (str): The tag name
timestamp (int): The timestamp to query (either run<32+lb or time in nanoseconds since 1.1.1970)
server (str, optional): Crest server name. Only needed if api is not provided. Defaults to "".
api (_type_, optional): Crest API instance. Defaults to None.
get_time_type (bool, optional): Whether to retrieve the time type. Defaults to False.
Raises:
RuntimeError: If both server and api are missing
Returns:
dict[str, dict[str, any]]: Conditions data
Definition at line 59 of file TriggerCrestUtil.py.
59 def getConditionsForTimestamp(tag: str, *, timestamp: int, server: str =
"", api: CrestApi |
None =
None,
60 get_time_type: bool =
False) -> dict[str, dict[str, Any]]:
61 """ Conditions data for tag at a specific timestamp
63 Conditions data is returned as a dict with 'since' and 'payload' keys.
64 The 'payload' itself is a dict of channel:'data dicts'. The 'data dict' has attribute names as
65 keys and the corresponding values. If get_time_type is True, also 'time_type' key is added to
66 each IOV dict and the since is further expanded into 'since_run' and 'since_lb' (for run/lb-based
67 timestamps) or 'since_formatted' (for time-based timestamps).
70 tag (str): The tag name
71 timestamp (int): The timestamp to query (either run<32+lb or time in nanoseconds since 1.1.1970)
72 server (str, optional): Crest server name. Only needed if api is not provided. Defaults to "".
73 api (_type_, optional): Crest API instance. Defaults to None.
74 get_time_type (bool, optional): Whether to retrieve the time type. Defaults to False.
77 RuntimeError: If both server and api are missing
80 dict[str, dict[str, any]]: Conditions data
82 if server==
"" and api
is None:
83 log.error(
"Need either crest server name or crest api specified for accessing Crest")
84 raise RuntimeError(
"Crest access information missing")
86 api = CrestApi(host=server)
88 attr_list, _ = TriggerCrestUtil._get_payload_spec(tag, api)
90 iov = TriggerCrestUtil._get_iov_for_timestamp(tag, timestamp=timestamp, api=api)
93 time_type = TriggerCrestUtil.getTagTimeType(tag, api=api)
96 payload_hash: str = cast(list, iov[
'resources'])[0][
'payload_hash']
97 since: int = cast(list, iov[
'resources'])[0][
'since']
98 payload = TriggerCrestUtil.getPayloadFromHash(payload_hash, api=api)
99 for channel, data
in payload.items():
100 payload_for_iov[channel] = dict(zip(attr_list, data))
102 result: dict[str, Any] = {
104 'payload': payload_for_iov
107 TriggerCrestUtil._update_with_time_type(result, time_type, since)
◆ getConditionsInRange()
| list[dict[str, dict[str, Any]]] python.TriggerCrestUtil.TriggerCrestUtil.getConditionsInRange |
( |
str |
tag, |
|
|
*int |
since, |
|
|
int |
until, |
|
|
str |
server = "", |
|
|
CrestApi | None |
api = None, |
|
|
bool |
get_time_type = False |
|
) |
| |
|
static |
Conditions data for tag in given range
List goes over the IOVs found. For each IOV, there is a dict with 'since' and 'payload' keys.
The 'payload' itself is a dict of channel:'data dicts'. The 'data dict' has attribute names as
keys and the corresponding values. If get_time_type is True, also 'time_type' key is added to
each IOV dict and the since is further expanded into 'since_run' and 'since_lb' (for run/lb-based
timestamps) or 'since_formatted' (for time-based timestamps).
Args:
tag (str): tag name
since (int): start of the range (either run<32+lb or time in nanoseconds since 1.1.1970, inclusive)
until (int): end of the range (either run<32+lb or time in nanoseconds since 1.1.1970, exclusive)
server (str, optional): crest server name. Only needed if api is not provided. Defaults to "".
api (CrestApi, optional): Crest API instance. Defaults to None.
get_time_type (bool, optional): whether to retrieve the time type. Defaults to False.
Raises:
RuntimeError: if both server and api are missing
Returns:
list[dict[str, dict[str, any]]]: conditions data
Definition at line 112 of file TriggerCrestUtil.py.
112 def getConditionsInRange(tag: str, *, since: int, until: int, server: str =
"", api: CrestApi |
None =
None,
113 get_time_type: bool =
False) -> list[dict[str, dict[str, Any]]]:
114 """ Conditions data for tag in given range
116 List goes over the IOVs found. For each IOV, there is a dict with 'since' and 'payload' keys.
117 The 'payload' itself is a dict of channel:'data dicts'. The 'data dict' has attribute names as
118 keys and the corresponding values. If get_time_type is True, also 'time_type' key is added to
119 each IOV dict and the since is further expanded into 'since_run' and 'since_lb' (for run/lb-based
120 timestamps) or 'since_formatted' (for time-based timestamps).
124 since (int): start of the range (either run<32+lb or time in nanoseconds since 1.1.1970, inclusive)
125 until (int): end of the range (either run<32+lb or time in nanoseconds since 1.1.1970, exclusive)
126 server (str, optional): crest server name. Only needed if api is not provided. Defaults to "".
127 api (CrestApi, optional): Crest API instance. Defaults to None.
128 get_time_type (bool, optional): whether to retrieve the time type. Defaults to False.
131 RuntimeError: if both server and api are missing
134 list[dict[str, dict[str, any]]]: conditions data
136 if server==
"" and api
is None:
137 log.error(
"Need either crest server name or crest api specified for accessing Crest")
138 raise RuntimeError(
"Crest access information missing")
140 api = CrestApi(host=server)
142 attr_list, type_dict = TriggerCrestUtil._get_payload_spec(tag, api)
144 all_iovs = TriggerCrestUtil._get_iovs_range(since=since, until=until, api=api, tag=tag)
147 time_type = TriggerCrestUtil.getTagTimeType(tag, api=api)
149 result: list[dict[str, dict[str, Any]]] = []
150 for iov
in cast(Iterable, all_iovs[
'resources']):
152 payload_hash = iov[
'payload_hash']
154 payload = TriggerCrestUtil.getPayloadFromHash(payload_hash, api=api)
155 for channel, data
in payload.items():
156 payload_for_iov[channel] = dict(zip(attr_list, data))
157 entry = {
'since': since,
'payload': payload_for_iov}
159 TriggerCrestUtil._update_with_time_type(entry, time_type, since)
◆ getCrestApi()
| CrestApi python.TriggerCrestUtil.TriggerCrestUtil.getCrestApi |
( |
str |
server | ) |
|
|
static |
Crest API object
Args:
server (str): crest server name.
Returns:
CrestApi: Crest API instance.
Definition at line 47 of file TriggerCrestUtil.py.
47 def getCrestApi(server: str) -> CrestApi:
51 server (str): crest server name.
54 CrestApi: Crest API instance.
56 return CrestApi(host=server)
◆ getCrestConnection()
| str | None python.TriggerCrestUtil.TriggerCrestUtil.getCrestConnection |
( |
str |
oracle_db | ) |
|
|
static |
maps from triggerdb or triggerdb-alias to crest connection
See https://its.cern.ch/jira/browse/ATR-32030
Definition at line 16 of file TriggerCrestUtil.py.
16 def getCrestConnection(oracle_db: str) -> str |
None:
17 """maps from triggerdb or triggerdb-alias to crest connection
19 See https://its.cern.ch/jira/browse/ATR-32030
21 db_mapping: dict[str, str] = {
22 "ATLAS_CONF_TRIGGER_RUN3":
"CONF_DATA_RUN3",
23 "ATLAS_CONF_TRIGGER_MC_RUN3":
"CONF_MC_RUN3",
24 "ATLAS_CONF_TRIGGER_REPR_RUN3":
"CONF_REPR_RUN3",
25 "ATLAS_CONF_TRIGGER_RUN4":
"CONF_DATA_RUN4",
26 "ATLAS_CONF_TRIGGER_MC_RUN4":
"CONF_MC_RUN4",
27 "ATLAS_CONF_TRIGGER_REPR_RUN4":
"CONF_REPR_RUN4",
28 "ATLAS_CONF_TRIGGER_LS3_DEV":
"CONF_DEV_LS3",
29 "ATLAS_CONF_TRIGGER_LS3_L0":
"CONF_DEV_L0",
30 "ATLAS_CONF_TRIGGER_RUN2_NF":
"CONF_DATA_RUN2"
32 alias_mapping: dict[str, str] = {
33 "TRIGGERDB_RUN3":
"CONF_DATA_RUN3",
34 "TRIGGERDBREPR_RUN3":
"CONF_REPR_RUN3",
35 "TRIGGERDBMC_RUN3":
"CONF_MC_RUN3",
36 "TRIGGERDB_RUN4":
"CONF_DATA_RUN4",
37 "TRIGGERDBREPR_RUN4":
"CONF_REPR_RUN4",
38 "TRIGGERDBMC_RUN4":
"CONF_MC_RUN4",
39 "TRIGGERDBLS3_DEV":
"CONF_DEV_LS3",
40 "TRIGGERDBLS3_L0":
"CONF_DEV_L0",
41 "TRIGGERDB_RUN2_NF":
"CONF_DATA_RUN2_NF"
43 db_mapping.update(alias_mapping)
44 return db_mapping.get(oracle_db,
None)
◆ getEORParams()
| dict[str, Any] | None python.TriggerCrestUtil.TriggerCrestUtil.getEORParams |
( |
int |
run, |
|
|
*str |
server = "", |
|
|
CrestApi | None |
api = None |
|
) |
| |
|
static |
Definition at line 240 of file TriggerCrestUtil.py.
240 def getEORParams(run: int, *, server: str =
"", api: CrestApi |
None =
None) -> dict[str, Any] |
None:
242 api = CrestApi(host=server)
243 start_of_run = (run << 32)
244 cond_data = TriggerCrestUtil.getConditionsForTimestamp(
"TDAQRunCtrlEOR-HEAD", timestamp=start_of_run, api=api, get_time_type=
False)
246 log.error(
"No EOR params found for run %s", run)
248 return cond_data[
'payload'][
'0']
◆ getHLTConfigKeys()
| dict python.TriggerCrestUtil.TriggerCrestUtil.getHLTConfigKeys |
( |
int |
run, |
|
|
*str |
server = "", |
|
|
CrestApi | None |
api = None |
|
) |
| |
|
static |
Definition at line 287 of file TriggerCrestUtil.py.
287 def getHLTConfigKeys(run: int, *, server: str =
"", api: CrestApi |
None =
None) -> dict:
289 def _parse_info(run, cond):
296 confsrc = cond[
'ConfigSource'].
split(
';')
299 release = confsrc[2].
split(
',')[0] + f
",{confsrc[1]}"
301 confsrc = cond[
'ConfigSource'].
split(
',', maxsplit=1)
304 release = f
"{confsrc[2]},{confsrc[1]}"
306 "SMK": cond[
'MasterConfigurationKey'],
307 "HLTPSK": cond[
'HltPrescaleConfigurationKey'],
313 api = CrestApi(host=server)
315 run_start = (run << 32) + 1
316 cond: dict[str, dict[str, Any]] = TriggerCrestUtil.getConditionsForTimestamp(
"TRIGGERHLTHltConfigKeys-HEAD", timestamp=run_start, api=api, get_time_type=
True)
317 cond.update(cond.pop(
'payload')[
'0'])
318 return _parse_info(run, cond)
◆ getHLTPrescaleKeys()
| list[dict[str, dict[str, Any]]] python.TriggerCrestUtil.TriggerCrestUtil.getHLTPrescaleKeys |
( |
int |
run, |
|
|
*str |
server = "", |
|
|
CrestApi | None |
api = None |
|
) |
| |
|
static |
Definition at line 251 of file TriggerCrestUtil.py.
251 def getHLTPrescaleKeys(run: int, *, server: str =
"", api: CrestApi |
None =
None) -> list[dict[str, dict[str, Any]]]:
253 api = CrestApi(host=server)
254 run_start = (run << 32)
255 run_end = ((run + 1) << 32) - 1
256 cond = TriggerCrestUtil.getConditionsInRange(
"TRIGGERHLTPrescaleKey-HEAD", since=run_start, until=run_end, api=api, get_time_type=
True)
258 entry.update(entry.pop(
'payload')[
'0'])
259 entry[
'key'] = entry.pop(
'HltPrescaleKey')
◆ getL1ConfigKeys()
| list[dict[str, dict[str, Any]]] python.TriggerCrestUtil.TriggerCrestUtil.getL1ConfigKeys |
( |
int |
run, |
|
|
*str |
server = "", |
|
|
CrestApi | None |
api = None |
|
) |
| |
|
static |
Definition at line 263 of file TriggerCrestUtil.py.
263 def getL1ConfigKeys(run: int, *, server: str =
"", api: CrestApi |
None =
None) -> list[dict[str, dict[str, Any]]]:
265 api = CrestApi(host=server)
266 run_start = (run << 32)
267 run_end = ((run + 1) << 32) - 1
268 cond = TriggerCrestUtil.getConditionsInRange(
"TRIGGERLVL1Lvl1ConfigKey-HEAD", since=run_start, until=run_end, api=api, get_time_type=
True)
270 entry.update(entry.pop(
'payload')[
'0'])
271 entry[
'key'] = entry.pop(
'Lvl1PrescaleConfigurationKey')
◆ getPayloadFromHash()
| dict python.TriggerCrestUtil.TriggerCrestUtil.getPayloadFromHash |
( |
str |
payload_hash, |
|
|
*str |
server = "", |
|
|
CrestApi | None |
api = None |
|
) |
| |
|
static |
Get payload from hash
Args:
payload_hash (str): hash of the payload
server (str, optional): crest server name. Defaults to "".
api (CrestApi, optional): Crest API instance. Defaults to None.
Raises:
RuntimeError: if both server and api are missing
Returns:
dict: payload retrieved from the hash
Definition at line 211 of file TriggerCrestUtil.py.
211 def getPayloadFromHash(payload_hash: str, *, server: str =
"", api: CrestApi |
None =
None) -> dict:
212 """ Get payload from hash
215 payload_hash (str): hash of the payload
216 server (str, optional): crest server name. Defaults to "".
217 api (CrestApi, optional): Crest API instance. Defaults to None.
220 RuntimeError: if both server and api are missing
223 dict: payload retrieved from the hash
225 if server ==
"" and api
is None:
226 log.error(
"Need either crest_server name or crest api for retrieving the payload")
227 raise RuntimeError(
"Crest access information missing")
232 return TriggerCrestUtil._get_payload_workaround(payload_hash, server)
235 api = CrestApi(host=server)
236 return TriggerCrestUtil._get_payload(payload_hash, api)
◆ getTagTimeType()
| str python.TriggerCrestUtil.TriggerCrestUtil.getTagTimeType |
( |
str |
tag, |
|
|
*str |
server = "", |
|
|
CrestApi | None |
api = None |
|
) |
| |
|
static |
time type of the tag, either 'run-lumi' or 'time'
Args:
tag (str): tag name
server (str, optional): crest server name. Only needed if api is not provided. Defaults to "".
api (CrestApi, optional): Crest API instance. Defaults to None.
Raises:
RuntimeError: if both server and api are missing
Returns:
str: time type of the tag ['run-lumi' or 'time']
Definition at line 164 of file TriggerCrestUtil.py.
164 def getTagTimeType(tag: str, *, server: str =
"", api: CrestApi |
None =
None) -> str:
165 """ time type of the tag, either 'run-lumi' or 'time'
169 server (str, optional): crest server name. Only needed if api is not provided. Defaults to "".
170 api (CrestApi, optional): Crest API instance. Defaults to None.
173 RuntimeError: if both server and api are missing
176 str: time type of the tag ['run-lumi' or 'time']
178 if server==
"" and api
is None:
179 log.error(
"Need either crest_server name or crest api for retrieving the payload")
180 raise RuntimeError(
"Crest access information missing")
182 api = CrestApi(host=server)
183 tag_info = api.find_tag(tag)
184 time_type: str = tag_info[
'time_type']
The documentation for this class was generated from the following file: