DUNE-DAQ
DUNE Trigger and Data Acquisition software
Toggle main menu visibility
Loading...
Searching...
No Matches
dunedaq
sourcecode
daqconf
python
daqconf
enable_tpg.py
Go to the documentation of this file.
1
import
conffwk
2
import
confmodel_dal
3
import
appmodel_dal
4
5
import
os
6
import
glob
7
8
def
get_segment_apps
(segment):
9
apps = []
10
11
for
ss
in
segment.segments:
12
apps +=
get_segment_apps
(ss)
13
14
for
aa
in
segment.applications:
15
apps.append(aa.id)
16
17
return
apps
18
19
def
enable_tpg
(oksfile, disable, session_name):
20
"""Script to enable or disable (-d) TP generation in ReadoutApplications of the
21
specified OKS configuration"""
22
db =
conffwk.Configuration
(
"oksconflibs:"
+ oksfile)
23
if
session_name ==
""
:
24
session_dals = db.get_dals(class_name=
"Session"
)
25
if
len(session_dals) == 0:
26
print(f
"Error could not find any Session in file {oksfile}"
)
27
return
28
session = session_dals[0]
29
else
:
30
try
:
31
session = db.get_dal(
"Session"
, session_name)
32
except
:
33
print(f
"Error could not find Session {session_name} in file {oksfile}"
)
34
return
35
# disabled = session.disabled
36
segment = session.segment
37
apps =
get_segment_apps
(segment)
38
for
aa
in
apps:
39
try
:
40
roapp = db.get_dal(class_name=
"ReadoutApplication"
, uid=aa)
41
if
disable:
42
roapp.tp_generation_enabled = 0
43
roapp.ta_generation_enabled = 0
44
print(f
"Disable TP generation in {roapp.id}."
)
45
else
:
46
roapp.tp_generation_enabled = 1
47
roapp.ta_generation_enabled = 1
48
print(f
"Enable TP generation in {roapp.id}."
)
49
db.update_dal(roapp)
50
except
:
51
continue
52
53
db.commit()
conffwk.Configuration.Configuration
Definition
Configuration.py:29
enable_tpg
Definition
enable_tpg.py:1
enable_tpg.get_segment_apps
get_segment_apps(segment)
Definition
enable_tpg.py:8
Generated on
for DUNE-DAQ by
1.17.0