Skip to content

Commit 65957d2

Browse files
authored
DQM Bokeh app (#150)
* Test pattern on parent key, not child one, for rejected camera displays * Adapt pattern * More clever way to find the run number with most information to initialize the DQM Bokeh app * Use OOBTree to write into ZODB. This allows more efficient write access to the DB, and reduces the needed storage by a factor 4! * Fix first run to be loaded, otherwise the Bokeh app crashes with an Out-of-Memory signal to search the most populated run --------- Co-authored-by: Jean-Philippe Lenain <[email protected]>
1 parent 47c56c5 commit 65957d2

File tree

3 files changed

+18
-19
lines changed

3 files changed

+18
-19
lines changed

src/nectarchain/dqm/bokeh_app/app_hooks.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"PED-INTEGRATION-.*",
1515
"START-TIMES",
1616
"WF-.*",
17-
".*PixTimeline-.*",
17+
".*PIXTIMELINE-.*",
1818
]
1919
TEST_PATTERN = "(?:% s)" % "|".join(NOTINDISPLAY)
2020

@@ -30,8 +30,8 @@ def get_rundata(src, runid):
3030
def make_camera_displays(db, source, runid):
3131
displays = collections.defaultdict(dict)
3232
for parentkey in db[runid].keys():
33-
for childkey in db[runid][parentkey].keys():
34-
if not re.match(TEST_PATTERN, childkey):
33+
if not re.match(TEST_PATTERN, parentkey):
34+
for childkey in db[runid][parentkey].keys():
3535
print(f"Run id {runid} Preparing plot for {parentkey}, {childkey}")
3636
displays[parentkey][childkey] = make_camera_display(
3737
source, parent_key=parentkey, child_key=childkey

src/nectarchain/dqm/bokeh_app/main.py

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ def update_camera_displays(attr, old, new):
2929
displays[k][kk].image = np.zeros(shape=constants.N_PIXELS)
3030

3131
for parentkey in db[runid].keys():
32-
for childkey in db[runid][parentkey].keys():
33-
if not re.match(TEST_PATTERN, childkey):
32+
if not re.match(TEST_PATTERN, parentkey):
33+
for childkey in db[runid][parentkey].keys():
3434
print(f"Run id {runid} Updating plot for {parentkey}, {childkey}")
3535

3636
image = new_rundata[parentkey][childkey]
@@ -56,26 +56,24 @@ def update_camera_displays(attr, old, new):
5656
# displays[parentkey][childkey].datasource.stream(image)
5757

5858

59+
print("Opening connection to ZODB")
5960
db = DQMDB(read_only=True).root
61+
print("Getting list of run numbers")
6062
runids = sorted(list(db.keys()))
6163

6264
# First, get the run id with the most populated result dictionary
63-
runid_max = runids[-1]
64-
largest = 0
65-
for runid in runids:
66-
larger = 0
67-
for k in db[runid].keys():
68-
length = len(db[runid][k])
69-
if length > larger:
70-
larger = length
71-
if larger > largest:
72-
largest = larger
73-
runid_max = runid
74-
runid = runid_max
75-
65+
# On the full DB, this takes an awful lot of time, and saturates the RAM on the host
66+
# VM (gets OoM killed)
67+
# run_dict_lengths = [len(db[r]) for r in runids]
68+
# runid = runids[np.argmax(run_dict_lengths)]
69+
runid = "NectarCAM_Run0008"
70+
print(f"We will start with run {runid}")
71+
72+
print("Defining Select")
7673
# runid_input = NumericInput(value=db.root.keys()[-1], title="NectarCAM run number")
7774
run_select = Select(value=runid, title="NectarCAM run number", options=runids)
7875

76+
print(f"Getting data for run {run_select.value}")
7977
source = get_rundata(db, run_select.value)
8078
displays = make_camera_displays(db, source, runid)
8179

src/nectarchain/dqm/db_utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import transaction
2+
from BTrees.OOBTree import OOBTree
23
from ZEO import ClientStorage
34
from ZODB import DB
45

@@ -17,7 +18,7 @@ def __init__(self, read_only=True):
1718
def insert(self, key=None, value=None):
1819
if key is not None and value is not None:
1920
try:
20-
self.root[key] = value
21+
self.root[key] = OOBTree(value)
2122
return True
2223
except AttributeError:
2324
return False

0 commit comments

Comments
 (0)