20 """Script to enable or disable (-d) TP generation in ReadoutApplications of the
21 specified OKS configuration"""
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
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()