-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathccdb_cpv_pedestal_dcs_fee.py
More file actions
executable file
·57 lines (44 loc) · 1.62 KB
/
ccdb_cpv_pedestal_dcs_fee.py
File metadata and controls
executable file
·57 lines (44 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/env python3
import sys
from rich.console import Console
from rich.table import Table
# import alienpy functions
try:
from alienpy.wb_api import retf_print
from alienpy.tools_nowb import PrintDict, unixtime2local
from alienpy.alien import * # nosec PYL-W0614
except Exception:
try:
from xjalienfs.wb_api import retf_print
from xjalienfs.tools_nowb import PrintDict, unixtime2local
from xjalienfs.alien import * # nosec PYL-W0614
except Exception:
print("Can't load alienpy, exiting...")
sys.exit(1)
########################################
## REQUIRED INITIAILZATION
# Enable and setup logging
setup_logging() # type: ignore
console = Console()
DCS_HOST='ali-calib-dcs.cern.ch:8083'
common_dir = 'CPV/PedestalRun/'
obj_list = [ 'FEEThresholds' ]
msg_obj_list = []
table = Table(title = f"CCDB Objects in {DCS_HOST}{common_dir}", title_justify = 'center', highlight = True, pad_edge = False, padding = 0, show_edge = True)
table.add_column("Object")
table.add_column("Run")
table.add_column("Size", justify = "right")
table.add_column("LastMod")
table.add_column("ValidTo")
table_filled = False
for obj in obj_list:
try:
rez = DO_ccdb_query(['-host', f'{DCS_HOST}', f'/{common_dir}{obj}'])
except Exception as e:
console.print(e)
break
for q in rez.ansdict['objects']:
run = q.get("runNumber", '-1')
table.add_row(q["path"].replace(common_dir,""), run, str(q["Content-Length"]), unixtime2local(q["Last-Modified"]), unixtime2local(q["Valid-Until"]))
table_filled = True
if table_filled: console.print(table)