19 """Simple script to create an OKS configuration file for a dataflow segment.
21 The file will automatically include the relevant schema files and
22 any other OKS files you specify.
26 "schema/confmodel/dunedaq.schema.xml",
27 "schema/appmodel/application.schema.xml",
30 res, extra_includes = find_oksincludes(include, os.path.dirname(oksfile))
32 includefiles += extra_includes
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)
45 for vhost
in db.get_dals(class_name=
"VirtualHost"):
46 hosts.append(vhost.id)
47 if vhost.id ==
"vlocalhost":
49 if "vlocalhost" not in hosts:
50 cpus = dal.ProcessingResource(
"cpus", cpu_cores=[0, 1, 2, 3])
52 phdal = dal.PhysicalHost(
"localhost", contains=[cpus])
54 host = dal.VirtualHost(
"vlocalhost", runs_on=phdal, uses=[cpus])
56 hosts.append(
"vlocalhost")
59 daqapp_control = db.get_dal(class_name=
"Service", uid=
"daqapp_control")
60 rccontroller_control = db.get_dal(class_name=
"Service", uid=
"rccontroller_control")
63 tpw_source_id = db.get_dal(
"SourceIDConf", uid=
"srcid-tp-stream-writer")
66 trigger_record_q_rule = db.get_dal(
67 class_name=
"QueueConnectionRule", uid=
"trigger-record-q-rule"
69 dfapp_qrules = [trigger_record_q_rule]
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"
76 tpset_net_rule = db.get_dal(
77 class_name=
"NetworkConnectionRule", uid=
"tpset-net-rule"
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"
83 td_trb_net_rule = db.get_dal(
84 class_name=
"NetworkConnectionRule", uid=
"td-trb-net-rule"
86 data_req_trig_net_rule = db.get_dal(
87 class_name=
"NetworkConnectionRule", uid=
"data-req-trig-net-rule"
89 data_req_hsi_net_rule = db.get_dal(
90 class_name=
"NetworkConnectionRule", uid=
"data-req-hsi-net-rule"
92 data_req_readout_net_rule = db.get_dal(
93 class_name=
"NetworkConnectionRule", uid=
"data-req-readout-net-rule"
99 data_req_hsi_net_rule,
100 data_req_readout_net_rule,
101 data_req_trig_net_rule,
107 trmon_req_net_rule = db.get_dal(
108 class_name=
"NetworkConnectionRule", uid=
"trmon-req-net-rule"
110 trigger_record_net_rule = db.get_dal(class_name=
"NetworkConnectionRule", uid=
"trigger-record-net-rule")
111 dfapp_netrules.append(trmon_req_net_rule)
112 dfapp_netrules.append(trigger_record_net_rule)
114 trmon_netrules.append(trigger_record_net_rule)
115 trigger_decision_token_q_rule = db.get_dal(class_name=
"QueueConnectionRule", uid=
"trigger-decision-token-q-rule")
116 trmon_qrules.append(trigger_decision_token_q_rule)
118 dfo_netrules = [td_dfo_net_rule, ti_net_rule, df_token_net_rule]
119 tpw_netrules = [tpset_net_rule]
121 opmon_conf = db.get_dal(class_name=
"OpMonConf", uid=
"slow-all-monitoring")
123 dfo_conf = db.get_dal(class_name=
"DFOConf", uid=
"dfoconf-01")
124 dfo = dal.DFOApplication(
127 application_name=
"daq_application",
128 exposes_service=[daqapp_control],
129 network_rules=dfo_netrules,
130 opmon_conf=opmon_conf,
135 trb_conf = db.get_dal(class_name=
"TRBConf", uid=
"trb-01")
136 dw_conf = db.get_dal(class_name=
"DataWriterConf", uid=
"dw-01")
137 dfhw = db.get_dal(class_name=
"DFHWConf", uid=
"dfhw-01")
139 for dfapp_idx
in range(n_dfapps):
140 dfapp_id = dfapp_idx + 1
143 dfapp_source_id = dal.SourceIDConf(
144 f
"srcid-df-{dfapp_id:02}", sid=dfapp_id + 1, subsystem=
"TR_Builder"
146 db.update_dal(dfapp_source_id)
148 dfapp = dal.DFApplication(
151 application_name=
"daq_application",
152 exposes_service=[daqapp_control],
153 source_id=dfapp_source_id,
154 queue_rules=dfapp_qrules,
155 network_rules=dfapp_netrules,
156 opmon_conf=opmon_conf,
158 data_writers=[dw_conf] * n_data_writers,
165 if tpwriting_enabled:
166 tpw_writer_conf = db.get_dal(
167 class_name=
"TPStreamWriterConf", uid=
"tp-stream-writer-conf"
170 tpwapp = dal.TPStreamWriterApplication(
173 application_name=
"daq_application",
174 exposes_service=[daqapp_control],
175 source_id=tpw_source_id,
176 network_rules=tpw_netrules,
177 opmon_conf=opmon_conf,
178 tp_writer=tpw_writer_conf,
180 db.update_dal(tpwapp)
181 tpwapps.append(tpwapp)
185 trmonconf = db.get_dal(class_name=
"TRMonRequestorConf", uid=
"trmr-01")
186 trmondwconf = db.get_dal(class_name=
"DataWriterConf", uid=
"tr_mon_dw-01")
188 trmonapp = dal.TRMonReqApplication(
191 application_name=
"daq_application",
192 exposes_service=[daqapp_control],
193 network_rules=trmon_netrules,
194 queue_rules=trmon_qrules,
195 opmon_conf=opmon_conf,
196 trmonreq = trmonconf,
197 data_writer = trmondwconf,
200 db.update_dal(trmonapp)
201 trmonapps.append(trmonapp)
204 fsm = db.get_dal(class_name=
"FSMconfiguration", uid=
"FSMconfiguration_noAction")
205 controller = dal.RCApplication(
207 application_name=
"drunc-controller",
210 opmon_conf=opmon_conf,
211 exposes_service=[rccontroller_control],
213 db.update_dal(controller)
216 f
"df-segment", controller=controller, applications=[dfo] + dfapps + tpwapps + trmonapps
222 except RuntimeError
as err:
223 print(
"Failed to commit Dataflow DB!")
224 print(traceback.format_exc())
234 """Simple script to create an OKS configuration file for a FakeHSI segment.
236 The file will automatically include the relevant schema files and
237 any other OKS files you specify.
243 "schema/confmodel/dunedaq.schema.xml",
244 "schema/appmodel/application.schema.xml",
245 "schema/appmodel/trigger.schema.xml",
248 res, extra_includes = find_oksincludes(include, os.path.dirname(oksfile))
250 includefiles += extra_includes
256 if not oksfile.endswith(
".data.xml"):
257 oksfile = oksfile +
".data.xml"
258 print(f
"Creating OKS database file {oksfile}")
259 db.create_db(oksfile, includefiles)
260 db.set_active(oksfile)
263 for vhost
in db.get_dals(class_name=
"VirtualHost"):
264 hosts.append(vhost.id)
265 if vhost.id ==
"vlocalhost":
267 if "vlocalhost" not in hosts:
268 cpus = dal.ProcessingResource(
"cpus", cpu_cores=[0, 1, 2, 3])
270 phdal = dal.PhysicalHost(
"localhost", contains=[cpus])
272 host = dal.VirtualHost(
"vlocalhost", runs_on=phdal, uses=[cpus])
274 hosts.append(
"vlocalhost")
277 daqapp_control = db.get_dal(class_name=
"Service", uid=
"daqapp_control")
278 rccontroller_control = db.get_dal(class_name=
"Service", uid=
"rccontroller_control")
279 dataRequests = db.get_dal(class_name=
"Service", uid=
"dataRequests")
280 hsievents = db.get_dal(class_name=
"Service", uid=
"HSIEvents")
283 hsi_source_id = db.get_dal(class_name=
"SourceIDConf", uid=
"hsi-srcid-01")
284 hsi_tc_source_id = db.get_dal(class_name=
"SourceIDConf", uid=
"hsi-tc-srcid-1")
287 hsi_dlh_queue_rule = db.get_dal(
288 class_name=
"QueueConnectionRule", uid=
"hsi-dlh-data-requests-queue-rule"
290 hsi_qrules = [hsi_dlh_queue_rule]
293 tc_net_rule = db.get_dal(class_name=
"NetworkConnectionRule", uid=
"tc-net-rule")
294 hsi_rule = db.get_dal(class_name=
"NetworkConnectionRule", uid=
"hsi-rule")
295 ts_hsi_net_rule = db.get_dal(
296 class_name=
"NetworkConnectionRule", uid=
"ts-hsi-net-rule"
298 data_req_hsi_net_rule = db.get_dal(
299 class_name=
"NetworkConnectionRule", uid=
"data-req-hsi-net-rule"
301 hsi_netrules = [hsi_rule, data_req_hsi_net_rule, ts_hsi_net_rule]
302 tc_netrules = [hsi_rule, tc_net_rule]
304 opmon_conf = db.get_dal(class_name=
"OpMonConf", uid=
"slow-all-monitoring")
305 hsi_handler = db.get_dal(class_name=
"DataHandlerConf", uid=
"def-hsi-handler")
306 fakehsi = db.get_dal(class_name=
"FakeHSIEventGeneratorConf", uid=
"fakehsi")
308 hsi = dal.FakeHSIApplication(
311 application_name=
"daq_application",
312 exposes_service=[daqapp_control],
313 source_id=hsi_source_id,
314 queue_rules=hsi_qrules,
315 network_rules=hsi_netrules,
316 opmon_conf=opmon_conf,
317 link_handler=hsi_handler,
322 hsi_to_tc_conf = db.get_dal(class_name=
"HSI2TCTranslatorConf", uid=
"hsi-to-tc-conf")
324 hsi_to_tc = dal.HSIEventToTCApplication(
327 application_name=
"daq_application",
328 exposes_service=[dataRequests, hsievents, daqapp_control],
329 source_id=hsi_tc_source_id,
330 network_rules=tc_netrules,
331 opmon_conf=opmon_conf,
332 hsevent_to_tc_conf=hsi_to_tc_conf,
334 db.update_dal(hsi_to_tc)
337 fsm = db.get_dal(class_name=
"FSMconfiguration", uid=
"FSMconfiguration_noAction")
338 controller = dal.RCApplication(
340 application_name=
"drunc-controller",
343 opmon_conf=opmon_conf,
344 exposes_service=[rccontroller_control],
346 db.update_dal(controller)
349 f
"hsi-segment", controller=controller, applications=[hsi, hsi_to_tc]
366 """Simple script to create an OKS configuration file for all
367 ReadoutApplications defined in a readout map.
369 The file will automatically include the relevant schema files and
370 any other OKS files you specify.
373 generate_readoutOKS -i hosts \
374 -i appmodel/connections.data.xml -i appmodel/moduleconfs \
375 config/np04readoutmap.data.xml readoutApps.data.xml
377 Will load hosts, connections and moduleconfs data files as well as
378 the readoutmap (config/np04readoutmap.data.xml) and write the
379 generated apps to readoutApps.data.xml.
381 generate_readoutOKS --session --segment \
382 -i appmodel/fsm -i hosts \
383 -i appmodel/connections.data.xml -i appmodel/moduleconfs \
384 config/np04readoutmap.data.xml np04readout-session.data.xml
386 Will do the same but in addition it will generate a containing
387 Segment for the apps and a containing Session for the Segment.
389 NB: Currently FSM generation is not implemented so you must include
390 an fsm file in order to generate a Segment
394 if not readoutmap.endswith(
".data.xml"):
395 readoutmap = readoutmap +
".data.xml"
397 print(f
"Readout map file {readoutmap}")
400 "schema/confmodel/dunedaq.schema.xml",
401 "schema/appmodel/application.schema.xml",
402 "schema/appmodel/trigger.schema.xml",
403 "schema/appmodel/fdmodules.schema.xml",
404 "schema/appmodel/wiec.schema.xml",
408 searchdirs = [path
for path
in os.environ[
"DUNEDAQ_DB_PATH"].split(
":")]
409 searchdirs.append(os.path.dirname(oksfile))
413 inc = inc.removesuffix(
".xml")
414 if inc.endswith(
".data"):
415 sub_dirs = [
"config",
"data"]
416 elif inc.endswith(
".schema"):
417 sub_dirs = [
"schema"]
421 for path
in searchdirs:
423 matches = glob.glob(f
"{inc}.xml", root_dir=path)
424 if len(matches) == 0:
425 for search_dir
in sub_dirs:
427 matches = glob.glob(f
"{search_dir}/{inc}.xml", root_dir=path)
428 for filename
in matches:
429 if filename
not in includefiles:
430 print(f
"Adding {filename} to include list")
431 includefiles.append(filename)
433 print(f
"{filename} already in include list")
441 for filename
in matches:
442 if filename
not in includefiles:
443 print(f
"Adding {filename} to include list")
444 includefiles.append(filename)
446 print(f
"{filename} already in include list")
451 print(f
"Error could not find include file for {inc}")
456 if not oksfile.endswith(
".data.xml"):
457 oksfile = oksfile +
".data.xml"
458 print(f
"Creating OKS database file {oksfile}")
459 db.create_db(oksfile, includefiles)
460 db.set_active(oksfile)
462 detector_connections = db.get_dals(class_name=
"DetectorToDaqConnection")
463 daqapp_control = db.get_dal(class_name=
"Service", uid=
"daqapp_control")
464 rccontroller_control = db.get_dal(class_name=
"Service", uid=
"rccontroller_control")
468 class_name=
"NetworkConnectionRule", uid=
"data-req-readout-net-rule"
472 'Expected NetworkConnectionRule "data-req-readout-net-rule" not found in input databases!'
477 for rule
in [
"tpset-net-rule",
"ts-net-rule",
"ta-net-rule"]:
478 netrules.append(db.get_dal(class_name=
"NetworkConnectionRule", uid=rule))
482 class_name=
"QueueConnectionRule", uid=
"fd-dlh-data-requests-queue-rule"
486 'Expected QueueConnectionRule "fd-dlh-data-requests-queue-rule" not found in input databases!'
494 qrules.append(db.get_dal(class_name=
"QueueConnectionRule", uid=rule))
497 if len(hosts_to_use) == 0:
498 for vhost
in db.get_dals(class_name=
"VirtualHost"):
499 if vhost.id ==
"vlocalhost":
500 hosts.append(vhost.id)
501 if "vlocalhost" not in hosts:
502 cpus = dal.ProcessingResource(
"cpus", cpu_cores=[0, 1, 2, 3])
504 phdal = dal.PhysicalHost(
"localhost", contains=[cpus])
506 host = dal.VirtualHost(
"vlocalhost", runs_on=phdal, uses=[cpus])
508 hosts.append(
"vlocalhost")
510 for vhost
in db.get_dals(class_name=
"VirtualHost"):
511 if vhost.id
in hosts_to_use:
512 hosts.append(vhost.id)
513 assert len(hosts) > 0
515 rohw = dal.RoHwConfig(f
"rohw-{detector_connections[0].id}")
518 opmon_conf = db.get_dal(class_name=
"OpMonConf", uid=
"slow-all-monitoring")
526 for connection
in detector_connections:
528 geo_id = connection.get(
"GeoId")
529 det_id = geo_id[0].detector_id
531 raise Exception(f
"Unable to determine detector ID from Hardware Map!")
533 tphandler = db.get_dal(class_name=
"DataHandlerConf", uid=
"def-tp-handler")
536 if "DAPHNEStream" in emulated_file_name:
537 linkhandler = db.get_dal(
538 class_name=
"DataHandlerConf", uid=
"def-pds-stream-link-handler"
541 class_name=
"QueueConnectionRule", uid=
"pds-stream-raw-data-rule"
544 linkhandler = db.get_dal(
545 class_name=
"DataHandlerConf", uid=
"def-pds-link-handler"
548 class_name=
"QueueConnectionRule", uid=
"pds-raw-data-rule"
552 linkhandler = db.get_dal(
553 class_name=
"DataHandlerConf", uid=
"def-link-handler"
556 class_name=
"QueueConnectionRule", uid=
"wib-eth-raw-data-rule"
559 linkhandler = db.get_dal(
560 class_name=
"DataHandlerConf", uid=
"def-tde-link-handler"
563 class_name=
"QueueConnectionRule", uid=
"tde-raw-data-rule"
566 linkhandler = db.get_dal(
567 class_name=
"DataHandlerConf", uid=
"def-crt-bern-link-handler"
570 class_name=
"QueueConnectionRule", uid=
"crt-bern-raw-data-rule"
573 linkhandler = db.get_dal(
574 class_name=
"DataHandlerConf", uid=
"def-crt-grenoble-link-handler"
577 class_name=
"QueueConnectionRule", uid=
"crt-grenoble-raw-data-rule"
580 hostnum = appnum % len(hosts)
582 host = db.get_dal(class_name=
"VirtualHost", uid=hosts[hostnum])
585 if connection.className() ==
"NetworkDetectorToDaqConnection":
586 receiver = connection.net_receiver
587 elif connection.className() ==
"FelixDetectorToDaqConnection":
588 receiver = connection.felix_receiver
591 if type(receiver).__name__ ==
"FakeDataReceiver":
594 stream_emu = db.get_dal(
595 class_name=
"StreamEmulationParameters", uid=
"stream-emu"
597 stream_emu.data_file_name = resolve_asset_file(emulated_file_name)
598 db.update_dal(stream_emu)
600 stream_emu = dal.StreamEmulationParameters(
602 data_file_name=resolve_asset_file(emulated_file_name),
603 input_file_size_limit=5777280,
605 random_population_size=100000,
606 frame_error_rate_hz=0,
607 generate_periodic_adc_pattern=
True,
608 TP_rate_per_channel=1,
610 db.update_dal(stream_emu)
612 print(
"Generating fake DataReaderConf")
613 nicrec = dal.DPDKReaderConf(
615 template_for=
"FDFakeReaderModule",
617 emulation_conf=stream_emu,
619 db.update_dal(nicrec)
621 elif type(receiver).__name__ ==
"DPDKReceiver":
623 print(
"Generating DPDKReaderConf")
624 nicrec = dal.DPDKReaderConf(
625 f
"nicrcvr-dpdk-gen", template_for=
"DPDKReaderModule"
627 db.update_dal(nicrec)
630 wm_conf = db.get_dal(
"WIBModuleConf",
"def-wib-conf")
633 'Expected WIBModuleConf "def-wib-conf" not found in input databases!'
635 if hermes_conf ==
None:
637 hermes_conf = db.get_dal(
"HermesModuleConf",
"def-hermes-conf")
640 'Expected HermesModuleConf "def-hermes-conf" not found in input databases!'
645 wiec_app = dal.WIECApplication(
646 f
"wiec-{connection.id}",
647 application_name=
"daq_application",
649 detector_connections=[connection],
650 wib_module_conf=wm_conf,
651 hermes_module_conf=hermes_conf,
652 exposes_service=[daqapp_control],
654 db.update_dal(wiec_app)
656 elif type(receiver).__name__ ==
"FelixInterface":
658 print(
"Generating Felix DataReaderConf")
659 flxcard = dal.DataReaderConf(
660 f
"flxConf-1", template_for=
"FelixReaderModule"
662 db.update_dal(flxcard)
666 f
"ReadoutGroup contains unknown interface type {type(receiver).__name__}"
673 dataRequests = db.get_dal(class_name=
"Service", uid=
"dataRequests")
674 timeSyncs = db.get_dal(class_name=
"Service", uid=
"timeSyncs")
675 triggerActivities = db.get_dal(class_name=
"Service", uid=
"triggerActivities")
676 triggerPrimitives = db.get_dal(class_name=
"Service", uid=
"triggerPrimitives")
679 readout_start = db.get_dal(class_name=
"ActionPlan", uid=
"readout-start")
680 readout_stop = db.get_dal(class_name=
"ActionPlan", uid=
"readout-stop")
682 ru = dal.ReadoutApplication(
683 f
"ru-{connection.id}",
684 application_name=
"daq_application",
686 detector_connections=[connection],
687 network_rules=netrules,
688 queue_rules=qrules + [det_q],
689 link_handler=linkhandler,
690 data_reader=datareader,
691 opmon_conf=opmon_conf,
692 tp_generation_enabled=tpg_enabled,
693 ta_generation_enabled=tpg_enabled,
695 exposes_service=[daqapp_control, dataRequests, timeSyncs],
696 action_plans=[readout_start, readout_stop],
699 ru.tp_handler = tphandler
701 tpbaseid = (appnum * 3) + 100
704 for plane
in range(1
if det_id
not in [3, 10, 11]
else 3):
705 s_id = tpbaseid + plane
706 tps_dal = dal.SourceIDConf(
707 f
"tp-srcid-{s_id}", sid=s_id, subsystem=
"Trigger"
709 db.update_dal(tps_dal)
710 tp_sources.append(tps_dal)
711 ru.tp_source_ids = tp_sources
712 ru.exposes_service += [triggerActivities, triggerPrimitives]
719 print(f
"No ReadoutApplications generated\n")
726 fsm = db.get_dal(class_name=
"FSMconfiguration", uid=
"FSMconfiguration_noAction")
727 controller = dal.RCApplication(
729 application_name=
"drunc-controller",
732 opmon_conf=opmon_conf,
733 exposes_service=[rccontroller_control],
735 db.update_dal(controller)
738 seg = dal.Segment(f
"ru-segment", controller=controller, applications=ruapps)
747 oksfile, include, generate_segment, n_streams, n_apps, det_id
749 """Simple script to create an OKS configuration file for a FakeDataProd-based readout segment.
751 The file will automatically include the relevant schema files and
752 any other OKS files you specify.
757 "schema/confmodel/dunedaq.schema.xml",
758 "schema/appmodel/application.schema.xml",
761 res, extra_includes = find_oksincludes(include, os.path.dirname(oksfile))
763 includefiles += extra_includes
769 if not oksfile.endswith(
".data.xml"):
770 oksfile = oksfile +
".data.xml"
771 print(f
"Creating OKS database file {oksfile}")
772 db.create_db(oksfile, includefiles)
773 db.set_active(oksfile)
776 for vhost
in db.get_dals(class_name=
"VirtualHost"):
777 hosts.append(vhost.id)
778 if vhost.id ==
"vlocalhost":
780 if "vlocalhost" not in hosts:
781 cpus = dal.ProcessingResource(
"cpus", cpu_cores=[0, 1, 2, 3])
783 phdal = dal.PhysicalHost(
"localhost", contains=[cpus])
785 host = dal.VirtualHost(
"vlocalhost", runs_on=phdal, uses=[cpus])
787 hosts.append(
"vlocalhost")
792 daqapp_control = db.get_dal(class_name=
"Service", uid=
"daqapp_control")
793 rccontroller_control = db.get_dal(class_name=
"Service", uid=
"rccontroller_control")
794 dataRequests = db.get_dal(class_name=
"Service", uid=
"dataRequests")
795 timeSyncs = db.get_dal(class_name=
"Service", uid=
"timeSyncs")
796 opmon_conf = db.get_dal(class_name=
"OpMonConf", uid=
"slow-all-monitoring")
799 class_name=
"NetworkConnectionRule", uid=
"data-req-readout-net-rule"
802 for rule
in [
"ts-fdp-net-rule"]:
803 netrules.append(db.get_dal(class_name=
"NetworkConnectionRule", uid=rule))
807 class_name=
"QueueConnectionRule", uid=
"fpdm-data-requests-queue-rule"
811 'Expected QueueConnectionRule "fpdm-data-requests-queue-rule" not found in input databases!'
818 qrules.append(db.get_dal(class_name=
"QueueConnectionRule", uid=rule))
826 fragment_type=
"WIBEth"
828 raise Exception(f
"FakeDataProd parameters not configured for detector ID {det_id}")
830 for appidx
in range(n_apps):
832 fakeapp = dal.FakeDataApplication(f
"fakedata_{appidx}",
834 application_name=
"daq_application",
835 exposes_service=[daqapp_control, dataRequests, timeSyncs],
837 network_rules=netrules,
838 opmon_conf=opmon_conf,)
840 for streamidx
in range(n_streams):
841 stream = dal.FakeDataProdConf(
842 f
"fakedata_{appidx}_stream_{streamidx}",
843 system_type=
"Detector_Readout",
845 time_tick_diff=time_tick_diff,
846 frame_size=frame_size,
847 response_delay=response_delay,
848 fragment_type=fragment_type,
850 db.update_dal(stream)
851 fakeapp.producers.append(stream)
852 source_id = source_id + 1
854 db.update_dal(fakeapp)
855 fakeapps.append(fakeapp)
859 fsm = db.get_dal(class_name=
"FSMconfiguration", uid=
"FSMconfiguration_noAction")
860 controller = dal.RCApplication(
862 application_name=
"drunc-controller",
863 opmon_conf=opmon_conf,
866 exposes_service=[rccontroller_control],
868 db.update_dal(controller)
872 controller=controller,
873 applications=fakeapps,
888 """Simple script to create an OKS configuration file for a trigger segment.
890 The file will automatically include the relevant schema files and
891 any other OKS files you specify.
896 "schema/confmodel/dunedaq.schema.xml",
897 "schema/appmodel/application.schema.xml",
898 "schema/appmodel/trigger.schema.xml",
901 res, extra_includes = find_oksincludes(include, os.path.dirname(oksfile))
903 includefiles += extra_includes
909 if not oksfile.endswith(
".data.xml"):
910 oksfile = oksfile +
".data.xml"
911 print(f
"Creating OKS database file {oksfile}")
912 db.create_db(oksfile, includefiles)
913 db.set_active(oksfile)
916 for vhost
in db.get_dals(class_name=
"VirtualHost"):
917 hosts.append(vhost.id)
918 if vhost.id ==
"vlocalhost":
920 if "vlocalhost" not in hosts:
921 cpus = dal.ProcessingResource(
"cpus", cpu_cores=[0, 1, 2, 3])
923 phdal = dal.PhysicalHost(
"localhost", contains=[cpus])
925 host = dal.VirtualHost(
"vlocalhost", runs_on=phdal, uses=[cpus])
927 hosts.append(
"vlocalhost")
930 daqapp_control = db.get_dal(class_name=
"Service", uid=
"daqapp_control")
931 rccontroller_control = db.get_dal(class_name=
"Service", uid=
"rccontroller_control")
932 dataRequests = db.get_dal(class_name=
"Service", uid=
"dataRequests")
933 triggerActivities = db.get_dal(class_name=
"Service", uid=
"triggerActivities")
934 triggerCandidates = db.get_dal(class_name=
"Service", uid=
"triggerCandidates")
935 triggerInhibits = db.get_dal(class_name=
"Service", uid=
"triggerInhibits")
938 mlt_source_id = db.get_dal(class_name=
"SourceIDConf", uid=
"tc-srcid-1")
939 tc_source_id = db.get_dal(class_name=
"SourceIDConf", uid=
"ta-srcid-1")
942 tc_queue_rule = db.get_dal(class_name=
"QueueConnectionRule", uid=
"tc-queue-rule")
943 td_queue_rule = db.get_dal(class_name=
"QueueConnectionRule", uid=
"td-queue-rule")
944 ta_queue_rule = db.get_dal(class_name=
"QueueConnectionRule", uid=
"ta-queue-rule")
945 mlt_qrules = [tc_queue_rule, td_queue_rule]
946 tapp_qrules = [ta_queue_rule]
949 tc_net_rule = db.get_dal(class_name=
"NetworkConnectionRule", uid=
"tc-net-rule")
950 ta_net_rule = db.get_dal(class_name=
"NetworkConnectionRule", uid=
"ta-net-rule")
951 ts_net_rule = db.get_dal(class_name=
"NetworkConnectionRule", uid=
"ts-net-rule")
952 ti_net_rule = db.get_dal(class_name=
"NetworkConnectionRule", uid=
"ti-net-rule")
953 td_dfo_net_rule = db.get_dal(
954 class_name=
"NetworkConnectionRule", uid=
"td-dfo-net-rule"
956 data_req_trig_net_rule = db.get_dal(
957 class_name=
"NetworkConnectionRule", uid=
"data-req-trig-net-rule"
963 data_req_trig_net_rule,
966 tapp_netrules = [ta_net_rule, tc_net_rule, data_req_trig_net_rule]
968 opmon_conf = db.get_dal(class_name=
"OpMonConf", uid=
"slow-all-monitoring")
969 tc_subscriber = db.get_dal(class_name=
"DataReaderConf", uid=
"tc-subscriber-1")
970 tc_handler = db.get_dal(class_name=
"DataHandlerConf", uid=
"def-tc-handler")
971 mlt_conf = db.get_dal(class_name=
"MLTConf", uid=
"def-mlt-conf")
972 random_tc_generator = db.get_dal(
973 class_name=
"RandomTCMakerConf", uid=
"random-tc-generator"
975 tc_confs = []
if hsi_enabled
else [random_tc_generator]
977 mlt = dal.MLTApplication(
980 application_name=
"daq_application",
981 exposes_service=[daqapp_control, triggerCandidates, triggerInhibits, dataRequests],
982 source_id=mlt_source_id,
983 queue_rules=mlt_qrules,
984 network_rules=mlt_netrules,
985 opmon_conf=opmon_conf,
986 data_subscriber=tc_subscriber,
987 trigger_inputs_handler=tc_handler,
989 standalone_candidate_maker_confs=tc_confs,
994 ta_subscriber = db.get_dal(class_name=
"DataReaderConf", uid=
"ta-subscriber-1")
995 ta_handler = db.get_dal(class_name=
"DataHandlerConf", uid=
"def-ta-handler")
998 tc_maker_start = db.get_dal(class_name=
"ActionPlan", uid=
"tc-maker-start")
1000 tcmaker = dal.TriggerApplication(
1003 application_name=
"daq_application",
1004 exposes_service=[daqapp_control, triggerActivities, dataRequests],
1005 source_id=tc_source_id,
1006 queue_rules=tapp_qrules,
1007 network_rules=tapp_netrules,
1008 opmon_conf=opmon_conf,
1009 data_subscriber=ta_subscriber,
1010 trigger_inputs_handler=ta_handler,
1011 action_plans=[tc_maker_start],
1013 db.update_dal(tcmaker)
1015 if generate_segment:
1016 fsm = db.get_dal(class_name=
"FSMconfiguration", uid=
"FSMconfiguration_noAction")
1017 controller = dal.RCApplication(
1019 application_name=
"drunc-controller",
1020 opmon_conf=opmon_conf,
1023 exposes_service=[rccontroller_control],
1025 db.update_dal(controller)
1029 controller=controller,
1030 applications=[mlt] + ([tcmaker]
if tpg_enabled
else []),
1043 connectivity_service_is_infrastructure_app=True,
1044 disable_connectivity_service=False,
1046 """Simple script to create an OKS configuration file for a session.
1048 The file will automatically include the relevant schema files and
1049 any other OKS files you specify.
1054 "schema/confmodel/dunedaq.schema.xml",
1055 "schema/appmodel/application.schema.xml",
1057 res, extra_includes = find_oksincludes(include, os.path.dirname(oksfile))
1059 includefiles += extra_includes
1065 if not oksfile.endswith(
".data.xml"):
1066 oksfile = oksfile +
".data.xml"
1067 print(f
"Creating OKS database file {oksfile} with includes {includefiles}")
1068 db.create_db(oksfile, includefiles)
1069 db.set_active(oksfile)
1072 for vhost
in db.get_dals(class_name=
"VirtualHost"):
1073 hosts.append(vhost.id)
1074 if vhost.id ==
"vlocalhost":
1076 if "vlocalhost" not in hosts:
1077 cpus = dal.ProcessingResource(
"cpus", cpu_cores=[0, 1, 2, 3])
1079 phdal = dal.PhysicalHost(
"localhost", contains=[cpus])
1080 db.update_dal(phdal)
1081 host = dal.VirtualHost(
"vlocalhost", runs_on=phdal, uses=[cpus])
1083 hosts.append(
"vlocalhost")
1085 fsm = db.get_dal(class_name=
"FSMconfiguration", uid=
"fsmConf-test")
1086 rccontroller_control = db.get_dal(class_name=
"Service", uid=
"rccontroller_control")
1087 controller = dal.RCApplication(
1089 application_name=
"drunc-controller",
1092 exposes_service=[rccontroller_control],
1094 db.update_dal(controller)
1096 segments = db.get_dals(class_name=
"Segment")
1098 seg = dal.Segment(f
"root-segment", controller=controller, segments=segments)
1101 detconf = db.get_dal(class_name=
"DetectorConfig", uid=
"dummy-detector")
1103 detconf.op_env = op_env
1104 db.update_dal(detconf)
1106 opmon_svc = db.get_dal(class_name=
"OpMonURI", uid=
"local-opmon-uri")
1108 trace_file_var =
None
1109 TRACE_FILE = os.getenv(
"TRACE_FILE")
1110 if TRACE_FILE
is not None:
1111 trace_file_var = dal.Variable(
1112 "session-env-trace-file", name=
"TRACE_FILE", value=TRACE_FILE
1114 db.update_dal(trace_file_var)
1116 infrastructure_applications = []
1117 if connectivity_service_is_infrastructure_app:
1118 conn_svc = db.get_dal(
1119 class_name=
"ConnectionService", uid=
"local-connection-server"
1121 infrastructure_applications.append(conn_svc)
1123 env_vars_for_local_running = db.get_dal(
1124 class_name=
"VariableSet", uid=
"local-variables"
1126 if trace_file_var
is not None:
1127 env_vars_for_local_running.append(trace_file_var)
1129 sessiondal = dal.Session(
1131 environment=env_vars_for_local_running,
1133 detector_configuration=detconf,
1134 infrastructure_applications=infrastructure_applications,
1135 opmon_uri=opmon_svc,
1138 if not disable_connectivity_service:
1139 conn_svc_cfg = db.get_dal(
1140 class_name=
"ConnectivityService", uid=
"local-connectivity-service-config"
1142 sessiondal.connectivity_service = conn_svc_cfg
1144 db.update_dal(sessiondal)