DUNE-DAQ
DUNE Trigger and Data Acquisition software
Toggle main menu visibility
Loading...
Searching...
No Matches
dunedaq
sourcecode
daqconf
python
daqconf
rename_session.py
Go to the documentation of this file.
1
import
conffwk
2
import
copy
3
4
def
rename_session
(
5
oksfile: str, output_name: str, session_name: str |
None
=
None
6
) ->
None
:
7
"""Script to rename the session (first session if multiple and not specified)"""
8
9
db =
conffwk.Configuration
(
'oksconflibs:'
+oksfile)
10
11
if
session_name
is
not
None
:
12
try
:
13
session = db.get_dal(
"Session"
,session_name)
14
except
:
15
print(f
"Error could not find Session {session_name} in file {oksfile}"
)
16
return
17
else
:
18
sessions = db.get_dals(
"Session"
)
19
if
len(sessions)==0:
20
print(f
"Error in {oksfile}: no sessions found."
)
21
return
22
if
len(sessions)>1:
23
print(f
"{oksfile} found {len(sessions)}. Will change name of first ({sessions[0].id})"
)
24
session = sessions[0]
25
26
new_session = copy.copy(session)
27
setattr(new_session,
"id"
,output_name)
28
29
db.add_dal(new_session)
30
db.destroy_dal(session)
31
32
db.commit()
conffwk.Configuration.Configuration
Definition
Configuration.py:29
rename_session
Definition
rename_session.py:1
Generated on
for DUNE-DAQ by
1.17.0