DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
generate Namespace Reference

Functions

None generate_dataflow (str oksfile, list[str] include, int n_dfapps, bool tpwriting_enabled, bool generate_segment, int n_data_writers=1, bool trmon_app=False)
None generate_hsi (str oksfile, list[str] include, bool generate_segment)
None generate_readout (str readoutmap, str oksfile, list[str] include, bool generate_segment, str emulated_file_name, bool tpg_enabled=True, list[str] hosts_to_use=[])
None generate_fakedata (str oksfile, list[str] include, bool generate_segment, int n_streams, int n_apps, int det_id, str|None fragment_type=None)
None generate_trigger (str oksfile, list[str] include, bool generate_segment, bool tpg_enabled=True, bool hsi_enabled=False)
None generate_session (str oksfile, list[str] include, str session_name, str op_env, bool connectivity_service_is_infrastructure_app=True)

Function Documentation

◆ generate_dataflow()

None generate_dataflow ( str oksfile,
list[str] include,
int n_dfapps,
bool tpwriting_enabled,
bool generate_segment,
int n_data_writers = 1,
bool trmon_app = False )
Simple script to create an OKS configuration file for a dataflow segment.

  The file will automatically include the relevant schema files and
any other OKS files you specify.

Definition at line 10 of file generate.py.

18) -> None:
19 """Simple script to create an OKS configuration file for a dataflow segment.
20
21 The file will automatically include the relevant schema files and
22 any other OKS files you specify.
23 """
24
25 includefiles = [
26 "schema/confmodel/dunedaq.schema.xml",
27 "schema/appmodel/application.schema.xml",
28 ]
29
30 res, extra_includes = find_oksincludes(include, os.path.dirname(oksfile))
31 if res:
32 includefiles += extra_includes
33 else:
34 return
35
36 dal = conffwk.dal.module("generated", includefiles)
37 db = conffwk.Configuration("oksconflibs")
38 if not oksfile.endswith(".data.xml"):
39 oksfile = oksfile + ".data.xml"
40 print(f"Creating OKS database file {oksfile}")
41 db.create_db(oksfile, includefiles)
42 db.set_active(oksfile)
43
44 hosts = []
45 for vhost in db.get_dals(class_name="VirtualHost"):
46 hosts.append(vhost.id)
47 if vhost.id == "vlocalhost":
48 host = vhost
49 if "vlocalhost" not in hosts:
50 cpus = dal.HostCores("cpus", cpu_cores=[0, 1, 2, 3])
51 db.update_dal(cpus)
52 phdal = dal.PhysicalHost("localhost", contains=[cpus])
53 db.update_dal(phdal)
54 host = dal.VirtualHost("vlocalhost", runs_on=phdal, uses=[cpus])
55 db.update_dal(host)
56 hosts.append("vlocalhost")
57
58 # Services
59 daqapp_control = db.get_dal(class_name="Service", uid="daqapp_control")
60 rccontroller_control = db.get_dal(class_name="Service", uid="rccontroller_control")
61
62 # Source IDs
63 tpw_source_id = db.get_dal("SourceIDConf", uid="srcid-tp-stream-writer")
64
65 # Queue Rules
66 trigger_record_q_rule = db.get_dal(
67 class_name="QueueConnectionRule", uid="trigger-record-q-rule"
68 )
69 dfapp_qrules = [trigger_record_q_rule]
70
71 # Net Rules
72 frag_net_rule = db.get_dal(class_name="NetworkConnectionRule", uid="frag-net-rule")
73 df_token_net_rule = db.get_dal(
74 class_name="NetworkConnectionRule", uid="df-token-net-rule"
75 )
76 tpset_net_rule = db.get_dal(
77 class_name="NetworkConnectionRule", uid="tpset-net-rule"
78 )
79 ti_net_rule = db.get_dal(class_name="NetworkConnectionRule", uid="ti-net-rule")
80 td_dfo_net_rule = db.get_dal(
81 class_name="NetworkConnectionRule", uid="td-dfo-net-rule"
82 )
83 td_trb_net_rule = db.get_dal(
84 class_name="NetworkConnectionRule", uid="td-trb-net-rule"
85 )
86 data_req_trig_net_rule = db.get_dal(
87 class_name="NetworkConnectionRule", uid="data-req-trig-net-rule"
88 )
89 data_req_hsi_net_rule = db.get_dal(
90 class_name="NetworkConnectionRule", uid="data-req-hsi-net-rule"
91 )
92 data_req_readout_net_rule = db.get_dal(
93 class_name="NetworkConnectionRule", uid="data-req-readout-net-rule"
94 )
95 dfapp_netrules = [
96 td_trb_net_rule,
97 frag_net_rule,
98 df_token_net_rule,
99 data_req_hsi_net_rule,
100 data_req_readout_net_rule,
101 data_req_trig_net_rule,
102 ]
103
104 trmon_netrules = []
105 trmon_qrules = []
106 if trmon_app:
107 trmon_req_net_rule = db.get_dal(
108 class_name="NetworkConnectionRule", uid="trmon-req-net-rule"
109 )
110 trigger_record_net_rule = db.get_dal(
111 class_name="NetworkConnectionRule", uid="trigger-record-net-rule"
112 )
113 dfapp_netrules.append(trmon_req_net_rule)
114 dfapp_netrules.append(trigger_record_net_rule)
115
116 trmon_netrules.append(trigger_record_net_rule)
117 trigger_decision_token_q_rule = db.get_dal(
118 class_name="QueueConnectionRule", uid="trigger-decision-token-q-rule"
119 )
120 trmon_qrules.append(trigger_decision_token_q_rule)
121
122 dfo_netrules = [td_dfo_net_rule, ti_net_rule, df_token_net_rule]
123 tpw_netrules = [tpset_net_rule]
124
125 opmon_conf = db.get_dal(class_name="OpMonConf", uid="slow-all-monitoring")
126
127 dfo_conf = db.get_dal(class_name="DFOConf", uid="dfoconf-01")
128 dfo = dal.DFOApplication(
129 "dfo-01",
130 runs_on=host,
131 application_name="daq_application",
132 exposes_service=[daqapp_control],
133 network_rules=dfo_netrules,
134 opmon_conf=opmon_conf,
135 dfo=dfo_conf,
136 )
137 db.update_dal(dfo)
138
139 trb_conf = db.get_dal(class_name="TRBConf", uid="trb-01")
140 dw_conf = db.get_dal(class_name="DataWriterConf", uid="dw-01")
141 dfhw = db.get_dal(class_name="DFHWConf", uid="dfhw-01")
142 dfapps = []
143 for dfapp_idx in range(n_dfapps):
144 dfapp_id = dfapp_idx + 1
145
146 # Offset sids by one so that TPW sourceID can stay at 1
147 dfapp_source_id = dal.SourceIDConf(
148 f"srcid-df-{dfapp_id:02}", sid=dfapp_id + 1, subsystem="TR_Builder"
149 )
150 db.update_dal(dfapp_source_id)
151
152 dfapp = dal.DFApplication(
153 f"df-{dfapp_id:02}",
154 runs_on=host,
155 application_name="daq_application",
156 exposes_service=[daqapp_control],
157 source_id=dfapp_source_id,
158 queue_rules=dfapp_qrules,
159 network_rules=dfapp_netrules,
160 opmon_conf=opmon_conf,
161 trb=trb_conf,
162 data_writers=[dw_conf] * n_data_writers,
163 uses=dfhw,
164 )
165 db.update_dal(dfapp)
166 dfapps.append(dfapp)
167
168 tpwapps = []
169 if tpwriting_enabled:
170 tpw_writer_conf = db.get_dal(
171 class_name="TPStreamWriterConf", uid="tp-stream-writer-conf"
172 )
173
174 tpwapp = dal.TPStreamWriterApplication(
175 "tp-stream-writer",
176 runs_on=host,
177 application_name="daq_application",
178 exposes_service=[daqapp_control],
179 source_id=tpw_source_id,
180 network_rules=tpw_netrules,
181 opmon_conf=opmon_conf,
182 tp_writer=tpw_writer_conf,
183 )
184 db.update_dal(tpwapp)
185 tpwapps.append(tpwapp)
186
187 trmonapps = []
188 if trmon_app:
189 trmonconf = db.get_dal(class_name="TRMonRequestorConf", uid="trmr-01")
190 trmondwconf = db.get_dal(class_name="DataWriterConf", uid="tr_mon_dw-01")
191
192 trmonapp = dal.TRMonReqApplication(
193 "trmon-01",
194 runs_on=host,
195 application_name="daq_application",
196 exposes_service=[daqapp_control],
197 network_rules=trmon_netrules,
198 queue_rules=trmon_qrules,
199 opmon_conf=opmon_conf,
200 trmonreq=trmonconf,
201 data_writer=trmondwconf,
202 uses=dfhw,
203 )
204 db.update_dal(trmonapp)
205 trmonapps.append(trmonapp)
206
207 if generate_segment:
208 fsm = db.get_dal(class_name="FSMconfiguration", uid="FSMconfiguration_noAction")
209 controller = dal.RCApplication(
210 "df-controller",
211 application_name="drunc-controller",
212 runs_on=host,
213 fsm=fsm,
214 opmon_conf=opmon_conf,
215 exposes_service=[rccontroller_control],
216 )
217 db.update_dal(controller)
218
219 seg = dal.Segment(
220 f"df-segment",
221 controller=controller,
222 applications=[dfo] + dfapps + tpwapps + trmonapps,
223 )
224 db.update_dal(seg)
225
226 try:
227 db.commit()
228 except RuntimeError as err:
229 print("Failed to commit Dataflow DB!")
230 print(traceback.format_exc())
231 raise err
232 return
233
234
module(name, schema, other_dals=[], backend='oksconflibs', db=None)
Definition dal.py:695

◆ generate_fakedata()

None generate_fakedata ( str oksfile,
list[str] include,
bool generate_segment,
int n_streams,
int n_apps,
int det_id,
str | None fragment_type = None )
Simple script to create an OKS configuration file for a FakeDataProd-based readout segment.

  The file will automatically include the relevant schema files and
any other OKS files you specify.

Definition at line 809 of file generate.py.

817) -> None:
818 """Simple script to create an OKS configuration file for a FakeDataProd-based readout segment.
819
820 The file will automatically include the relevant schema files and
821 any other OKS files you specify.
822
823 """
824
825 includefiles = [
826 "schema/confmodel/dunedaq.schema.xml",
827 "schema/appmodel/application.schema.xml",
828 ]
829
830 res, extra_includes = find_oksincludes(include, os.path.dirname(oksfile))
831 if res:
832 includefiles += extra_includes
833 else:
834 return
835
836 dal = conffwk.dal.module("generated", includefiles)
837 db = conffwk.Configuration("oksconflibs")
838 if not oksfile.endswith(".data.xml"):
839 oksfile = oksfile + ".data.xml"
840 print(f"Creating OKS database file {oksfile}")
841 db.create_db(oksfile, includefiles)
842 db.set_active(oksfile)
843
844 hosts = []
845 for vhost in db.get_dals(class_name="VirtualHost"):
846 hosts.append(vhost.id)
847 if vhost.id == "vlocalhost":
848 host = vhost
849 if "vlocalhost" not in hosts:
850 cpus = dal.HostCores("cpus", cpu_cores=[0, 1, 2, 3])
851 db.update_dal(cpus)
852 phdal = dal.PhysicalHost("localhost", contains=[cpus])
853 db.update_dal(phdal)
854 host = dal.VirtualHost("vlocalhost", runs_on=phdal, uses=[cpus])
855 db.update_dal(host)
856 hosts.append("vlocalhost")
857
858 source_id = 0
859 fakeapps = []
860 # Services
861 daqapp_control = db.get_dal(class_name="Service", uid="daqapp_control")
862 rccontroller_control = db.get_dal(class_name="Service", uid="rccontroller_control")
863 dataRequests = db.get_dal(class_name="Service", uid="dataRequests")
864 timeSyncs = db.get_dal(class_name="Service", uid="timeSyncs")
865 opmon_conf = db.get_dal(class_name="OpMonConf", uid="slow-all-monitoring")
866 fragagg = db.get_dal(class_name="FragmentAggregatorConf", uid="frag-agg-01")
867
868 rule = db.get_dal(
869 class_name="NetworkConnectionRule", uid="data-req-readout-net-rule"
870 )
871 netrules = [rule]
872 for rule in ["ts-fdp-net-rule"]:
873 netrules.append(db.get_dal(class_name="NetworkConnectionRule", uid=rule))
874
875 try:
876 rule = db.get_dal(
877 class_name="QueueConnectionRule", uid="fpdm-data-requests-queue-rule"
878 )
879 except:
880 print(
881 'Expected QueueConnectionRule "fpdm-data-requests-queue-rule" not found in input databases!'
882 )
883 else:
884 qrules = [rule]
885 for rule in [
886 "fa-queue-rule",
887 ]:
888 qrules.append(db.get_dal(class_name="QueueConnectionRule", uid=rule))
889
890 frame_size = 0
891 if det_id == 3:
892 frame_size = 7200
893 time_tick_diff = 32 * 64
894 response_delay = 0
895 fragment_type = "WIBEth"
896 elif det_id == 2:
897 if fragment_type == "DAPHNEEthStream":
898 frame_size = 2008
899 time_tick_diff = 280
900 response_delay = 0
901 elif fragment_type == "DAPHNEEth":
902 frame_size = 1864
903 time_tick_diff = 1024
904 response_delay = 0
905 else:
906 raise Exception(
907 f"FakeDataProd fragment_type '{fragment_type}' not recognized for detector ID {det_id}; "
908 f"expected 'DAPHNEEthStream' or 'DAPHNEEth'"
909 )
910 else:
911 raise Exception(
912 f"FakeDataProd parameters not configured for detector ID {det_id}"
913 )
914
915 for appidx in range(n_apps):
916
917 fakeapp = dal.FakeDataApplication(
918 f"fakedata-{appidx}",
919 runs_on=host,
920 application_name="daq_application",
921 exposes_service=[daqapp_control, dataRequests, timeSyncs],
922 queue_rules=qrules,
923 network_rules=netrules,
924 fragment_aggregator=fragagg,
925 opmon_conf=opmon_conf,
926 )
927
928 for streamidx in range(n_streams):
929 stream = dal.FakeDataProdConf(
930 f"fakedata-{appidx}-stream-{streamidx}",
931 system_type="Detector_Readout",
932 source_id=source_id,
933 time_tick_diff=time_tick_diff,
934 frame_size=frame_size,
935 response_delay=response_delay,
936 fragment_type=fragment_type,
937 )
938 db.update_dal(stream)
939 fakeapp.producers.append(stream)
940 source_id = source_id + 1
941
942 db.update_dal(fakeapp)
943 fakeapps.append(fakeapp)
944
945 if generate_segment:
946 fsm = db.get_dal(class_name="FSMconfiguration", uid="FSMconfiguration_noAction")
947 controller = dal.RCApplication(
948 "ru-controller",
949 application_name="drunc-controller",
950 opmon_conf=opmon_conf,
951 runs_on=host,
952 fsm=fsm,
953 exposes_service=[rccontroller_control],
954 )
955 db.update_dal(controller)
956
957 seg = dal.Segment(
958 f"ru-segment",
959 controller=controller,
960 applications=fakeapps,
961 )
962 db.update_dal(seg)
963
964 db.commit()
965 return
966
967
Base class for all conffwk exceptions.

◆ generate_hsi()

None generate_hsi ( str oksfile,
list[str] include,
bool generate_segment )
Simple script to create an OKS configuration file for a FakeHSI segment.

  The file will automatically include the relevant schema files and
any other OKS files you specify.

Definition at line 235 of file generate.py.

239) -> None:
240 """Simple script to create an OKS configuration file for a FakeHSI segment.
241
242 The file will automatically include the relevant schema files and
243 any other OKS files you specify.
244
245
246 """
247
248 includefiles = [
249 "schema/confmodel/dunedaq.schema.xml",
250 "schema/appmodel/application.schema.xml",
251 "schema/appmodel/trigger.schema.xml",
252 ]
253
254 res, extra_includes = find_oksincludes(include, os.path.dirname(oksfile))
255 if res:
256 includefiles += extra_includes
257 else:
258 return
259
260 dal = conffwk.dal.module("generated", includefiles)
261 db = conffwk.Configuration("oksconflibs")
262 if not oksfile.endswith(".data.xml"):
263 oksfile = oksfile + ".data.xml"
264 print(f"Creating OKS database file {oksfile}")
265 db.create_db(oksfile, includefiles)
266 db.set_active(oksfile)
267
268 hosts = []
269 for vhost in db.get_dals(class_name="VirtualHost"):
270 hosts.append(vhost.id)
271 if vhost.id == "vlocalhost":
272 host = vhost
273 if "vlocalhost" not in hosts:
274 cpus = dal.HostCores("cpus", cpu_cores=[0, 1, 2, 3])
275 db.update_dal(cpus)
276 phdal = dal.PhysicalHost("localhost", contains=[cpus])
277 db.update_dal(phdal)
278 host = dal.VirtualHost("vlocalhost", runs_on=phdal, uses=[cpus])
279 db.update_dal(host)
280 hosts.append("vlocalhost")
281
282 # Services
283 daqapp_control = db.get_dal(class_name="Service", uid="daqapp_control")
284 rccontroller_control = db.get_dal(class_name="Service", uid="rccontroller_control")
285 dataRequests = db.get_dal(class_name="Service", uid="dataRequests")
286 hsievents = db.get_dal(class_name="Service", uid="HSIEvents")
287
288 # Source IDs
289 hsi_source_id = db.get_dal(class_name="SourceIDConf", uid="hsi-srcid-01")
290 hsi_tc_source_id = db.get_dal(class_name="SourceIDConf", uid="hsi-tc-srcid-1")
291
292 # Queue Rules
293 hsi_dlh_queue_rule = db.get_dal(
294 class_name="QueueConnectionRule", uid="hsi-dlh-data-requests-queue-rule"
295 )
296 hsi_qrules = [hsi_dlh_queue_rule]
297
298 # Net Rules
299 tc_net_rule = db.get_dal(class_name="NetworkConnectionRule", uid="tc-net-rule")
300 hsi_rule = db.get_dal(class_name="NetworkConnectionRule", uid="hsi-rule")
301 ts_hsi_net_rule = db.get_dal(
302 class_name="NetworkConnectionRule", uid="ts-hsi-net-rule"
303 )
304 data_req_hsi_net_rule = db.get_dal(
305 class_name="NetworkConnectionRule", uid="data-req-hsi-net-rule"
306 )
307 hsi_netrules = [hsi_rule, data_req_hsi_net_rule, ts_hsi_net_rule]
308 tc_netrules = [hsi_rule, tc_net_rule]
309
310 opmon_conf = db.get_dal(class_name="OpMonConf", uid="slow-all-monitoring")
311 hsi_handler = db.get_dal(class_name="DataHandlerConf", uid="def-hsi-handler")
312 fakehsi = db.get_dal(class_name="FakeHSIEventGeneratorConf", uid="fakehsi")
313
314 hsi = dal.FakeHSIApplication(
315 "hsi-01",
316 runs_on=host,
317 application_name="daq_application",
318 exposes_service=[daqapp_control],
319 source_id=hsi_source_id,
320 queue_rules=hsi_qrules,
321 network_rules=hsi_netrules,
322 opmon_conf=opmon_conf,
323 link_handler=hsi_handler,
324 generator=fakehsi,
325 )
326 db.update_dal(hsi)
327
328 hsi_to_tc_conf = db.get_dal(class_name="HSI2TCTranslatorConf", uid="hsi-to-tc-conf")
329
330 hsi_to_tc = dal.HSIEventToTCApplication(
331 "hsi-to-tc-app",
332 runs_on=host,
333 application_name="daq_application",
334 exposes_service=[dataRequests, hsievents, daqapp_control],
335 source_id=hsi_tc_source_id,
336 network_rules=tc_netrules,
337 opmon_conf=opmon_conf,
338 hsevent_to_tc_conf=hsi_to_tc_conf,
339 )
340 db.update_dal(hsi_to_tc)
341
342 if generate_segment:
343 fsm = db.get_dal(class_name="FSMconfiguration", uid="FSMconfiguration_noAction")
344 controller = dal.RCApplication(
345 "hsi-controller",
346 application_name="drunc-controller",
347 runs_on=host,
348 fsm=fsm,
349 opmon_conf=opmon_conf,
350 exposes_service=[rccontroller_control],
351 )
352 db.update_dal(controller)
353
354 seg = dal.Segment(
355 f"hsi-segment", controller=controller, applications=[hsi, hsi_to_tc]
356 )
357 db.update_dal(seg)
358
359 db.commit()
360 return
361
362

◆ generate_readout()

None generate_readout ( str readoutmap,
str oksfile,
list[str] include,
bool generate_segment,
str emulated_file_name,
bool tpg_enabled = True,
list[str] hosts_to_use = [] )
Simple script to create an OKS configuration file for all
ReadoutApplications defined in a readout map.

The file will automatically include the relevant schema files and
any other OKS files you specify.

Example:
 generate_readoutOKS -i hosts \
   -i appmodel/connections.data.xml -i appmodel/moduleconfs \
   config/np04readoutmap.data.xml readoutApps.data.xml

Will load hosts, connections and moduleconfs data files as well as
the readoutmap (config/np04readoutmap.data.xml) and write the
generated apps to readoutApps.data.xml.

 generate_readoutOKS --session --segment \
   -i appmodel/fsm -i hosts \
   -i appmodel/connections.data.xml -i appmodel/moduleconfs  \
   config/np04readoutmap.data.xml np04readout-session.data.xml

Will do the same but in addition it will generate a containing
Segment for the apps and a containing Session for the Segment.

NB: Currently FSM generation is not implemented so you must include
an fsm file in order to generate a Segment

Definition at line 363 of file generate.py.

371) -> None:
372 """Simple script to create an OKS configuration file for all
373 ReadoutApplications defined in a readout map.
374
375 The file will automatically include the relevant schema files and
376 any other OKS files you specify.
377
378 Example:
379 generate_readoutOKS -i hosts \
380 -i appmodel/connections.data.xml -i appmodel/moduleconfs \
381 config/np04readoutmap.data.xml readoutApps.data.xml
382
383 Will load hosts, connections and moduleconfs data files as well as
384 the readoutmap (config/np04readoutmap.data.xml) and write the
385 generated apps to readoutApps.data.xml.
386
387 generate_readoutOKS --session --segment \
388 -i appmodel/fsm -i hosts \
389 -i appmodel/connections.data.xml -i appmodel/moduleconfs \
390 config/np04readoutmap.data.xml np04readout-session.data.xml
391
392 Will do the same but in addition it will generate a containing
393 Segment for the apps and a containing Session for the Segment.
394
395 NB: Currently FSM generation is not implemented so you must include
396 an fsm file in order to generate a Segment
397
398 """
399
400 if not readoutmap.endswith(".data.xml"):
401 readoutmap = readoutmap + ".data.xml"
402
403 print(f"Readout map file {readoutmap}")
404
405 includefiles = (
406 [
407 "schema/confmodel/dunedaq.schema.xml",
408 "schema/appmodel/application.schema.xml",
409 "schema/appmodel/trigger.schema.xml",
410 "schema/appmodel/fdmodules.schema.xml",
411 "schema/appmodel/wiec.schema.xml",
412 ]
413 + [readoutmap]
414 if os.path.exists(readoutmap)
415 else []
416 )
417
418 searchdirs = [path for path in os.environ["DUNEDAQ_DB_PATH"].split(":")]
419 searchdirs.append(os.path.dirname(oksfile))
420 for inc in include:
421 # print (f"Searching for {inc}")
422 match = False
423 inc = inc.removesuffix(".xml")
424 if inc.endswith(".data"):
425 sub_dirs = ["config", "data"]
426 elif inc.endswith(".schema"):
427 sub_dirs = ["schema"]
428 else:
429 sub_dirs = ["*"]
430 inc = inc + "*"
431 for path in searchdirs:
432 # print (f" {path}/{inc}.xml")
433 matches = glob.glob(f"{inc}.xml", root_dir=path)
434 if len(matches) == 0:
435 for search_dir in sub_dirs:
436 # print (f" {path}/{search_dir}/{inc}.xml")
437 matches = glob.glob(f"{search_dir}/{inc}.xml", root_dir=path)
438 for filename in matches:
439 if filename not in includefiles:
440 print(f"Adding {filename} to include list")
441 includefiles.append(filename)
442 else:
443 print(f"{filename} already in include list")
444 match = True
445 break
446 if match:
447 break
448 if match:
449 break
450 else:
451 for filename in matches:
452 if filename not in includefiles:
453 print(f"Adding {filename} to include list")
454 includefiles.append(filename)
455 else:
456 print(f"{filename} already in include list")
457 match = True
458 break
459
460 if not match:
461 print(f"Error could not find include file for {inc}")
462 return
463
464 dal = conffwk.dal.module("generated", includefiles)
465 db = conffwk.Configuration("oksconflibs")
466 if not oksfile.endswith(".data.xml"):
467 oksfile = oksfile + ".data.xml"
468 print(f"Creating OKS database file {oksfile}")
469 db.create_db(oksfile, includefiles)
470 db.set_active(oksfile)
471
472 detector_connections = db.get_dals(class_name="DetectorToDaqConnection")
473 daqapp_control = db.get_dal(class_name="Service", uid="daqapp_control")
474 rccontroller_control = db.get_dal(class_name="Service", uid="rccontroller_control")
475
476 try:
477 rule = db.get_dal(
478 class_name="NetworkConnectionRule", uid="data-req-readout-net-rule"
479 )
480 except:
481 print(
482 'Expected NetworkConnectionRule "data-req-readout-net-rule" not found in input databases!'
483 )
484 else:
485 netrules = [rule]
486 # Assume we have all the other rules we need
487 for rule in ["tpset-net-rule", "ts-net-rule", "ta-net-rule"]:
488 netrules.append(db.get_dal(class_name="NetworkConnectionRule", uid=rule))
489
490 try:
491 rule = db.get_dal(
492 class_name="QueueConnectionRule", uid="fd-dlh-data-requests-queue-rule"
493 )
494 except:
495 print(
496 'Expected QueueConnectionRule "fd-dlh-data-requests-queue-rule" not found in input databases!'
497 )
498 else:
499 qrules = [rule]
500 for rule in [
501 "fa-queue-rule",
502 "tp-queue-rule",
503 ]:
504 qrules.append(db.get_dal(class_name="QueueConnectionRule", uid=rule))
505
506 hosts = []
507 if len(hosts_to_use) == 0:
508 for vhost in db.get_dals(class_name="VirtualHost"):
509 if vhost.id == "vlocalhost":
510 hosts.append(vhost.id)
511 if "vlocalhost" not in hosts:
512 cpus = dal.HostCores("cpus", cpu_cores=[0, 1, 2, 3])
513 db.update_dal(cpus)
514 phdal = dal.PhysicalHost("localhost", contains=[cpus])
515 db.update_dal(phdal)
516 host = dal.VirtualHost("vlocalhost", runs_on=phdal, uses=[cpus])
517 db.update_dal(host)
518 hosts.append("vlocalhost")
519 else:
520 for vhost in db.get_dals(class_name="VirtualHost"):
521 if vhost.id in hosts_to_use:
522 hosts.append(vhost.id)
523 assert len(hosts) > 0
524
525 rohw = dal.RoHwConfig(f"rohw-{detector_connections[0].id}")
526 db.update_dal(rohw)
527
528 opmon_conf = db.get_dal(class_name="OpMonConf", uid="slow-all-monitoring")
529 fragagg = db.get_dal(class_name="FragmentAggregatorConf", uid="frag-agg-01")
530
531 appnum = 0
532 nicrec = None
533 flxcard = None
534 wm_conf = None
535 hermes_conf = None
536 ruapps = []
537 for connection in detector_connections:
538
539 geo_id = connection.get("GeoId")
540 det_id = geo_id[0].detector_id
541 if det_id == 0:
542 raise Exception(f"Unable to determine detector ID from Hardware Map!")
543
544 tphandler = db.get_dal(class_name="DataHandlerConf", uid="def-tp-handler")
545
546 if det_id == 2:
547 if "DAPHNEStream" in emulated_file_name:
548 linkhandler = db.get_dal(
549 class_name="DataHandlerConf", uid="def-pds-stream-link-handler"
550 )
551 cb_desc = db.get_dal(
552 class_name="DataMoveCallbackDescriptor", uid="pds-stream-raw-input"
553 )
554 elif "DAPHNEEthStream" in emulated_file_name:
555 linkhandler = db.get_dal(
556 class_name="DataHandlerConf", uid="def-pds-eth-stream-link-handler"
557 )
558 cb_desc = db.get_dal(
559 class_name="DataMoveCallbackDescriptor", uid="pds-eth-stream-raw-input"
560 )
561 elif "DAPHNEEth" in emulated_file_name:
562 linkhandler = db.get_dal(
563 class_name="DataHandlerConf", uid="def-pds-eth-link-handler"
564 )
565 cb_desc = db.get_dal(
566 class_name="DataMoveCallbackDescriptor", uid="pds-eth-raw-input"
567 )
568 else:
569 linkhandler = db.get_dal(
570 class_name="DataHandlerConf", uid="def-pds-link-handler"
571 )
572 cb_desc = db.get_dal(
573 class_name="DataMoveCallbackDescriptor", uid="pds-raw-input"
574 )
575
576 elif det_id == 3 or det_id == 10:
577 linkhandler = db.get_dal(
578 class_name="DataHandlerConf", uid="def-link-handler"
579 )
580 cb_desc = db.get_dal(
581 class_name="DataMoveCallbackDescriptor", uid="wib-eth-raw-input"
582 )
583 elif det_id == 11:
584 linkhandler = db.get_dal(
585 class_name="DataHandlerConf", uid="def-tde-link-handler"
586 )
587 cb_desc = db.get_dal(
588 class_name="DataMoveCallbackDescriptor", uid="tde-raw-input"
589 )
590 elif det_id == 12:
591 linkhandler = db.get_dal(
592 class_name="DataHandlerConf", uid="def-crt-bern-link-handler"
593 )
594 # Not used, but needed for ReadoutApplication
595 cb_desc = db.get_dal(
596 class_name="DataMoveCallbackDescriptor", uid="crt-bern-raw-input"
597 )
598 elif det_id == 13:
599 linkhandler = db.get_dal(
600 class_name="DataHandlerConf", uid="def-crt-grenoble-link-handler"
601 )
602 # Not used, but needed for ReadoutApplication
603 cb_desc = db.get_dal(
604 class_name="DataMoveCallbackDescriptor", uid="crt-grenoble-raw-input"
605 )
606
607 hostnum = appnum % len(hosts)
608 # print(f"Looking up host[{hostnum}] ({hosts[hostnum]})")
609 host = db.get_dal(class_name="VirtualHost", uid=hosts[hostnum])
610
611 # Find which type of DataReceiver we need for this connection
612 if connection.className() == "NetworkDetectorToDaqConnection":
613 receiver = connection.net_receiver
614 elif connection.className() == "FelixDetectorToDaqConnection":
615 receiver = connection.felix_receiver
616
617 # Action Plans
618 readout_start = db.get_dal(class_name="ActionPlan", uid="readout-start")
619 readout_stop = db.get_dal(class_name="ActionPlan", uid="readout-stop")
620
621 # Emulated stream
622 if type(receiver).__name__ == "FakeDataReceiver":
623 if nicrec == None:
624 try:
625 stream_emu = db.get_dal(
626 class_name="StreamEmulationParameters", uid="stream-emu"
627 )
628 stream_emu.data_file_name = resolve_asset_file(emulated_file_name)
629 db.update_dal(stream_emu)
630 except:
631 stream_emu = dal.StreamEmulationParameters(
632 "stream-emu",
633 data_file_name=resolve_asset_file(emulated_file_name),
634 input_file_size_limit=5777280,
635 set_t0=True,
636 random_population_size=100000,
637 frame_error_rate_hz=0,
638 generate_periodic_adc_pattern=True,
639 TP_rate_per_channel=1,
640 )
641 db.update_dal(stream_emu)
642
643 print("Generating fake DataReaderConf")
644 nicrec = dal.DPDKReaderConf(
645 f"nicrcvr-fake-gen",
646 template_for="FDFakeReaderModule",
647 emulation_mode=1,
648 emulation_conf=stream_emu,
649 )
650 db.update_dal(nicrec)
651 datareader = nicrec
652 elif type(receiver).__name__ == "DPDKReceiver":
653 if nicrec == None:
654 print("Generating DPDKReaderConf")
655 nicrec = dal.DPDKReaderConf(
656 f"nicrcvr-dpdk-gen", template_for="DPDKReaderModule"
657 )
658 db.update_dal(nicrec)
659 if wm_conf == None:
660 try:
661 wm_conf = db.get_dal("WIBModuleConf", "def-wib-conf")
662 except:
663 print(
664 'Expected WIBModuleConf "def-wib-conf" not found in input databases!'
665 )
666 if hermes_conf == None:
667 try:
668 hermes_conf = db.get_dal("HermesModuleConf", "def-hermes-conf")
669 except:
670 print(
671 'Expected HermesModuleConf "def-hermes-conf" not found in input databases!'
672 )
673
674 datareader = nicrec
675
676 wiec_app = dal.WIECApplication(
677 f"wiec-{connection.id}",
678 application_name="daq_application",
679 runs_on=host,
680 detector_connections=[connection],
681 wib_module_conf=wm_conf,
682 hermes_module_conf=hermes_conf,
683 exposes_service=[daqapp_control],
684 )
685 db.update_dal(wiec_app)
686
687 elif type(receiver).__name__ == "FelixInterface":
688 if flxcard == None:
689 print("Generating Felix DataReaderConf")
690 flxcard = dal.DataReaderConf(
691 f"flxConf-1", template_for="FelixReaderModule"
692 )
693 db.update_dal(flxcard)
694 datareader = flxcard
695 elif type(receiver).__name__ == "FileReaderReceiver":
696 if nicrec == None:
697 try:
698 snb_files = db.get_dal(
699 class_name="SNBFileSourceParameters",
700 uid=f"snb-files-{connection.id}",
701 )
702 snb_files.data_files = [resolve_asset_file(emulated_file_name)]
703 db.update_dal(snb_files)
704 except:
705 snb_files = dal.SNBFileSourceParameters(
706 "snb-files-0",
707 data_files=[resolve_asset_file(emulated_file_name)],
708 input_buffer_size=5777280,
709 file_compression_algorithm="None",
710 )
711 db.update_dal(snb_files)
712
713 print("Generating fake DataReaderConf")
714 nicrec = dal.SNBFileReaderConf(
715 f"nicrcvr-file-reader",
716 template_for="SNBFileReaderModule",
717 emulation_mode=1,
718 snb_conf=snb_files,
719 )
720 db.update_dal(nicrec)
721 datareader = nicrec
722
723 print(f"Using SNB DataHandler")
724 linkhandler.template_for = "SNBDataHandlerModule"
725 db.update_dal(linkhandler)
726
727 readout_start = db.get_dal(class_name="ActionPlan", uid="snb-readout-start")
728 readout_stop = db.get_dal(class_name="ActionPlan", uid="snb-readout-stop")
729 else:
730 print(
731 f"ReadoutGroup contains unknown interface type {type(receiver).__name__}"
732 )
733 continue
734
735 db.commit()
736
737 # Services
738 dataRequests = db.get_dal(class_name="Service", uid="dataRequests")
739 timeSyncs = db.get_dal(class_name="Service", uid="timeSyncs")
740 triggerActivities = db.get_dal(class_name="Service", uid="triggerActivities")
741 triggerPrimitives = db.get_dal(class_name="Service", uid="triggerPrimitives")
742
743 ru = dal.ReadoutApplication(
744 f"ru-{connection.id}",
745 application_name="daq_application",
746 runs_on=host,
747 detector_connections=[connection],
748 network_rules=netrules,
749 queue_rules=qrules,
750 link_handler=linkhandler,
751 data_reader=datareader,
752 fragment_aggregator=fragagg,
753 opmon_conf=opmon_conf,
754 tp_generation_enabled=tpg_enabled,
755 ta_generation_enabled=tpg_enabled,
756 uses=rohw,
757 exposes_service=[daqapp_control, dataRequests, timeSyncs],
758 action_plans=[readout_start, readout_stop],
759 callback_desc=cb_desc,
760 )
761 if tpg_enabled:
762 ru.tp_handler = tphandler
763 tp_sources = []
764 tpbaseid = (appnum * 3) + 100
765 # 30-Apr-2025, KAB: added support for 1 "plane" of non-TPC TPs (e.g. PDS).
766 # That is compared with the usual 3 planes of TPs for TPC detectors.
767 for plane in range(1 if det_id not in [3, 10, 11] else 3):
768 s_id = tpbaseid + plane
769 tps_dal = dal.SourceIDConf(
770 f"tp-srcid-{s_id}", sid=s_id, subsystem="Trigger"
771 )
772 db.update_dal(tps_dal)
773 tp_sources.append(tps_dal)
774 ru.tp_source_ids = tp_sources
775 ru.exposes_service += [triggerActivities, triggerPrimitives]
776 appnum = appnum + 1
777 print(f"{ru=}")
778 db.update_dal(ru)
779 db.commit()
780 ruapps.append(ru)
781 if appnum == 0:
782 print(f"No ReadoutApplications generated\n")
783 return
784
785 db.commit()
786
787 if generate_segment:
788 # fsm = db.get_dal(class_name="FSMconfiguration", uid="fsmConf-test")
789 fsm = db.get_dal(class_name="FSMconfiguration", uid="FSMconfiguration_noAction")
790 controller = dal.RCApplication(
791 "ru-controller",
792 application_name="drunc-controller",
793 runs_on=host,
794 fsm=fsm,
795 opmon_conf=opmon_conf,
796 exposes_service=[rccontroller_control],
797 )
798 db.update_dal(controller)
799 db.commit()
800
801 seg = dal.Segment(f"ru-segment", controller=controller, applications=ruapps)
802 db.update_dal(seg)
803 db.commit()
804
805 db.commit()
806 return
807
808

◆ generate_session()

None generate_session ( str oksfile,
list[str] include,
str session_name,
str op_env,
bool connectivity_service_is_infrastructure_app = True )
Simple script to create an OKS configuration file for a session.

  The file will automatically include the relevant schema files and
any other OKS files you specify.

Definition at line 1144 of file generate.py.

1150) -> None:
1151 """Simple script to create an OKS configuration file for a session.
1152
1153 The file will automatically include the relevant schema files and
1154 any other OKS files you specify.
1155
1156 """
1157
1158 includefiles = [
1159 "schema/confmodel/dunedaq.schema.xml",
1160 "schema/appmodel/application.schema.xml",
1161 ]
1162 res, extra_includes = find_oksincludes(include, os.path.dirname(oksfile))
1163 if res:
1164 includefiles += extra_includes
1165 else:
1166 return
1167
1168 dal = conffwk.dal.module("generated", includefiles)
1169 db = conffwk.Configuration("oksconflibs")
1170 if not oksfile.endswith(".data.xml"):
1171 oksfile = oksfile + ".data.xml"
1172 print(f"Creating OKS database file {oksfile} with includes {includefiles}")
1173 db.create_db(oksfile, includefiles)
1174 db.set_active(oksfile)
1175
1176 hosts = []
1177 for vhost in db.get_dals(class_name="VirtualHost"):
1178 hosts.append(vhost.id)
1179 if vhost.id == "vlocalhost":
1180 host = vhost
1181 if "vlocalhost" not in hosts:
1182 cpus = dal.HostCores("cpus", cpu_cores=[0, 1, 2, 3])
1183 db.update_dal(cpus)
1184 phdal = dal.PhysicalHost("localhost", contains=[cpus])
1185 db.update_dal(phdal)
1186 host = dal.VirtualHost("vlocalhost", runs_on=phdal, uses=[cpus])
1187 db.update_dal(host)
1188 hosts.append("vlocalhost")
1189
1190 opmon_conf = db.get_dal(class_name="OpMonConf", uid="slow-all-monitoring")
1191
1192 fsm = db.get_dal(class_name="FSMconfiguration", uid="fsmConf-test")
1193 rccontroller_control = db.get_dal(class_name="Service", uid="root-rccontroller_control")
1194 controller = dal.RCApplication(
1195 "root-controller",
1196 application_name="drunc-controller",
1197 runs_on=host,
1198 fsm=fsm,
1199 opmon_conf=opmon_conf,
1200 exposes_service=[rccontroller_control],
1201 )
1202 db.update_dal(controller)
1203
1204 segments = db.get_dals(class_name="Segment")
1205
1206 seg = dal.Segment(f"root-segment", controller=controller, segments=segments)
1207 db.update_dal(seg)
1208
1209 detconf = db.get_dal(class_name="DetectorConfig", uid="dummy-detector")
1210
1211 detconf.op_env = op_env
1212 db.update_dal(detconf)
1213
1214 opmon_svc = db.get_dal(class_name="OpMonURI", uid="local-opmon-uri")
1215
1216 trace_file_var = None
1217 TRACE_FILE = os.getenv("TRACE_FILE")
1218 if TRACE_FILE is not None:
1219 trace_file_var = dal.Variable(
1220 "session-env-trace-file", name="TRACE_FILE", value=TRACE_FILE
1221 )
1222 db.update_dal(trace_file_var)
1223
1224 infrastructure_applications = []
1225 if connectivity_service_is_infrastructure_app:
1226 conn_svc = db.get_dal(
1227 class_name="ConnectionService", uid="local-connection-server"
1228 )
1229 infrastructure_applications.append(conn_svc)
1230
1231 env_vars_for_local_running = db.get_dal(
1232 class_name="VariableSet", uid="local-variables"
1233 ).contains
1234 if trace_file_var is not None:
1235 env_vars_for_local_running.append(trace_file_var)
1236
1237 sessiondal = dal.Session(
1238 session_name,
1239 environment=env_vars_for_local_running,
1240 segment=seg,
1241 detector_configuration=detconf,
1242 infrastructure_applications=infrastructure_applications,
1243 opmon_uri=opmon_svc,
1244 )
1245
1246 # 13-Aug-2026, KAB & ELF: removed the conditional execution of the following
1247 # few lines based on the 'disable_connectivity_service' function argument.
1248 # We believe that the ConnSvc config should always be added to the OKS Session
1249 # when we generate a DAQ configuration with this function.
1250 conn_svc_cfg = db.get_dal(
1251 class_name="ConnectivityService", uid="local-connectivity-service-config"
1252 )
1253 sessiondal.connectivity_service = conn_svc_cfg
1254
1255 db.update_dal(sessiondal)
1256
1257 db.commit()
1258 return

◆ generate_trigger()

None generate_trigger ( str oksfile,
list[str] include,
bool generate_segment,
bool tpg_enabled = True,
bool hsi_enabled = False )
Simple script to create an OKS configuration file for a trigger segment.

  The file will automatically include the relevant schema files and
any other OKS files you specify.

Definition at line 968 of file generate.py.

974) -> None:
975 """Simple script to create an OKS configuration file for a trigger segment.
976
977 The file will automatically include the relevant schema files and
978 any other OKS files you specify.
979
980 """
981
982 includefiles = [
983 "schema/confmodel/dunedaq.schema.xml",
984 "schema/appmodel/application.schema.xml",
985 "schema/appmodel/trigger.schema.xml",
986 ]
987
988 res, extra_includes = find_oksincludes(include, os.path.dirname(oksfile))
989 if res:
990 includefiles += extra_includes
991 else:
992 return
993
994 dal = conffwk.dal.module("generated", includefiles)
995 db = conffwk.Configuration("oksconflibs")
996 if not oksfile.endswith(".data.xml"):
997 oksfile = oksfile + ".data.xml"
998 print(f"Creating OKS database file {oksfile}")
999 db.create_db(oksfile, includefiles)
1000 db.set_active(oksfile)
1001
1002 hosts = []
1003 for vhost in db.get_dals(class_name="VirtualHost"):
1004 hosts.append(vhost.id)
1005 if vhost.id == "vlocalhost":
1006 host = vhost
1007 if "vlocalhost" not in hosts:
1008 cpus = dal.HostCores("cpus", cpu_cores=[0, 1, 2, 3])
1009 db.update_dal(cpus)
1010 phdal = dal.PhysicalHost("localhost", contains=[cpus])
1011 db.update_dal(phdal)
1012 host = dal.VirtualHost("vlocalhost", runs_on=phdal, uses=[cpus])
1013 db.update_dal(host)
1014 hosts.append("vlocalhost")
1015
1016 # Services
1017 daqapp_control = db.get_dal(class_name="Service", uid="daqapp_control")
1018 rccontroller_control = db.get_dal(class_name="Service", uid="rccontroller_control")
1019 dataRequests = db.get_dal(class_name="Service", uid="dataRequests")
1020 triggerActivities = db.get_dal(class_name="Service", uid="triggerActivities")
1021 triggerCandidates = db.get_dal(class_name="Service", uid="triggerCandidates")
1022 triggerInhibits = db.get_dal(class_name="Service", uid="triggerInhibits")
1023
1024 # Source IDs
1025 mlt_source_id = db.get_dal(class_name="SourceIDConf", uid="tc-srcid-1")
1026 tc_source_id = db.get_dal(class_name="SourceIDConf", uid="ta-srcid-1")
1027
1028 # Queue Rules
1029 tc_queue_rule = db.get_dal(class_name="QueueConnectionRule", uid="tc-queue-rule")
1030 td_queue_rule = db.get_dal(class_name="QueueConnectionRule", uid="td-queue-rule")
1031 ta_queue_rule = db.get_dal(class_name="QueueConnectionRule", uid="ta-queue-rule")
1032 mlt_qrules = [tc_queue_rule, td_queue_rule]
1033 tapp_qrules = [ta_queue_rule]
1034
1035 # Net Rules
1036 tc_net_rule = db.get_dal(class_name="NetworkConnectionRule", uid="tc-net-rule")
1037 ta_net_rule = db.get_dal(class_name="NetworkConnectionRule", uid="ta-net-rule")
1038 ts_net_rule = db.get_dal(class_name="NetworkConnectionRule", uid="ts-net-rule")
1039 ti_net_rule = db.get_dal(class_name="NetworkConnectionRule", uid="ti-net-rule")
1040 td_dfo_net_rule = db.get_dal(
1041 class_name="NetworkConnectionRule", uid="td-dfo-net-rule"
1042 )
1043 data_req_trig_net_rule = db.get_dal(
1044 class_name="NetworkConnectionRule", uid="data-req-trig-net-rule"
1045 )
1046 mlt_netrules = [
1047 tc_net_rule,
1048 ti_net_rule,
1049 td_dfo_net_rule,
1050 data_req_trig_net_rule,
1051 ts_net_rule,
1052 ]
1053 tapp_netrules = [ta_net_rule, tc_net_rule, data_req_trig_net_rule]
1054
1055 opmon_conf = db.get_dal(class_name="OpMonConf", uid="slow-all-monitoring")
1056 tc_subscriber = db.get_dal(class_name="DataReaderConf", uid="tc-subscriber-1")
1057 tc_handler = db.get_dal(class_name="DataHandlerConf", uid="def-tc-handler")
1058 mlt_conf = db.get_dal(class_name="MLTConf", uid="def-mlt-conf")
1059 random_tc_generator = db.get_dal(
1060 class_name="RandomTCMakerConf", uid="random-tc-generator"
1061 )
1062 tc_confs = []
1063
1064 try:
1065 fixedtime_tc_generator = db.get_dal(
1066 class_name="FixedTimeTCMakerModuleConf",
1067 uid="ft-trig-conf",
1068 )
1069 print(
1070 f"FixedTimeTCMakerModule has been configured, excluding random triggers and HSI"
1071 )
1072 tc_confs = [fixedtime_tc_generator]
1073 except:
1074 pass # No FixedTimeTCMaker
1075 if not hsi_enabled and len(tc_confs) == 0:
1076 tc_confs = [random_tc_generator]
1077
1078 mlt = dal.MLTApplication(
1079 "mlt",
1080 runs_on=host,
1081 application_name="daq_application",
1082 exposes_service=[
1083 daqapp_control,
1084 triggerCandidates,
1085 triggerInhibits,
1086 dataRequests,
1087 ],
1088 source_id=mlt_source_id,
1089 queue_rules=mlt_qrules,
1090 network_rules=mlt_netrules,
1091 opmon_conf=opmon_conf,
1092 data_subscriber=tc_subscriber,
1093 trigger_inputs_handler=tc_handler,
1094 mlt_conf=mlt_conf,
1095 standalone_candidate_maker_confs=tc_confs,
1096 )
1097 db.update_dal(mlt)
1098
1099 if tpg_enabled:
1100 ta_subscriber = db.get_dal(class_name="DataReaderConf", uid="ta-subscriber-1")
1101 ta_handler = db.get_dal(class_name="DataHandlerConf", uid="def-ta-handler")
1102
1103 # Action Plans
1104 tc_maker_start = db.get_dal(class_name="ActionPlan", uid="tc-maker-start")
1105
1106 tcmaker = dal.TriggerApplication(
1107 "tc-maker-1",
1108 runs_on=host,
1109 application_name="daq_application",
1110 exposes_service=[daqapp_control, triggerActivities, dataRequests],
1111 source_id=tc_source_id,
1112 queue_rules=tapp_qrules,
1113 network_rules=tapp_netrules,
1114 opmon_conf=opmon_conf,
1115 data_subscriber=ta_subscriber,
1116 trigger_inputs_handler=ta_handler,
1117 action_plans=[tc_maker_start],
1118 )
1119 db.update_dal(tcmaker)
1120
1121 if generate_segment:
1122 fsm = db.get_dal(class_name="FSMconfiguration", uid="FSMconfiguration_noAction")
1123 controller = dal.RCApplication(
1124 "trg-controller",
1125 application_name="drunc-controller",
1126 opmon_conf=opmon_conf,
1127 runs_on=host,
1128 fsm=fsm,
1129 exposes_service=[rccontroller_control],
1130 )
1131 db.update_dal(controller)
1132
1133 seg = dal.Segment(
1134 f"trg-segment",
1135 controller=controller,
1136 applications=[mlt] + ([tcmaker] if tpg_enabled else []),
1137 )
1138 db.update_dal(seg)
1139
1140 db.commit()
1141 return
1142
1143