-
Notifications
You must be signed in to change notification settings - Fork 1
/
ccdb_mft_noise.py
executable file
·47 lines (37 loc) · 1.39 KB
/
ccdb_mft_noise.py
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
#!/usr/bin/env python3
import sys
# import alienpy functions
try:
from alienpy.wb_api import PrintDict, retf_print
from alienpy.tools_nowb import unixtime2local
from alienpy.alien import * # nosec PYL-W0614
except Exception:
try:
from xjalienfs.wb_api import PrintDict, retf_print
from xjalienfs.tools_nowb import unixtime2local
from xjalienfs.alien import * # nosec PYL-W0614
except Exception:
print("Can't load alienpy, exiting...")
sys.exit(1)
from rich.console import Console
from rich.table import Table
########################################
## REQUIRED INITIAILZATION
# Enable and setup logging
setup_logging() # type: ignore
common_dir = 'MFT/Calib/'
obj_list = [ 'MFT/Calib/NoiseMap']
msg_obj_list = []
table = Table(title = f"CCDB Objects in {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")
for obj in obj_list:
rez = DO_ccdb_query([obj])
for q in rez.ansdict['objects']:
run = q.get("runNumber", '-1')
table.add_row(q["path"].replace(common_dir,""), str(run), str(q["Content-Length"]), unixtime2local(q["Last-Modified"]), unixtime2local(q["Valid-Until"]))
console = Console()
console.print(table)