DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
get_session_apps.py
Go to the documentation of this file.
1import conffwk
2import confmodel
3
4import os
5import glob
6
7
8def 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
20def get_session_apps(oksfile, session_name=""):
21 """Get the apps defined in the given session"""
22 session_db = conffwk.Configuration("oksconflibs:" + oksfile)
23 if session_name == "":
24 session_dals = session_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 = 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
36 segment = session.segment
37
38 return get_segment_apps(segment)
39
40
41def get_database_apps(oksfile):
42
43 output = {}
44 session_db = conffwk.Configuration("oksconflibs:" + oksfile)
45 session_dals = session_db.get_dals(class_name="Session")
46 if len(session_dals) == 0:
47 print(f"Error could not find any Session in file {oksfile}")
48 return {}
49
50 for session in session_dals:
51 segment = session.segment
52 output[session.id] = get_segment_apps(segment)
53
54 return output
get_segment_apps(segment)