DUNE-DAQ
DUNE Trigger and Data Acquisition software
Toggle main menu visibility
Loading...
Searching...
No Matches
dunedaq
sourcecode
daqconf
python
daqconf
enable.py
Go to the documentation of this file.
1
import
conffwk
2
import
confmodel_dal
3
4
import
os
5
import
glob
6
7
8
def
enable
(oksfile, disable, resource, session_name):
9
"""Script to enable or disable (-d) Resources from the first Session of the
10
specified OKS database file"""
11
db =
conffwk.Configuration
(
"oksconflibs:"
+ oksfile)
12
if
session_name ==
""
:
13
session_dals = db.get_dals(class_name=
"Session"
)
14
if
len(session_dals) == 0:
15
print(f
"Error could not find any Session in file {oksfile}"
)
16
return
17
session = session_dals[0]
18
else
:
19
try
:
20
session = db.get_dal(
"Session"
, session_name)
21
except
:
22
print(f
"Error could not find Session {session_name} in file {oksfile}"
)
23
return
24
disabled = session.disabled
25
for
res
in
resource:
26
try
:
27
res_dal = db.get_dal(
"Resource"
, res)
28
except
:
29
print(f
"Error could not find Resource {res} in file {oksfile}"
)
30
continue
31
32
if
disable:
33
if
res_dal
in
disabled:
34
print(
35
f
"{res} is already in disabled relationship of Session {session.id}"
36
)
37
else
:
38
# Add to the Segment's disabled list
39
print(f
"Adding {res} to disabled relationship of Session {session.id}"
)
40
disabled.append(res_dal)
41
else
:
42
if
res_dal
not
in
disabled:
43
print(f
"{res} is not in disabled relationship of Session {session.id}"
)
44
else
:
45
# Remove from the Segments disabled list
46
print(
47
f
"Removing {res} from disabled relationship of Session {session.id}"
48
)
49
disabled.remove(res_dal)
50
session.disabled = disabled
51
db.update_dal(session)
52
db.commit()
conffwk.Configuration.Configuration
Definition
Configuration.py:29
enable
Definition
enable.py:1
Generated on
for DUNE-DAQ by
1.17.0