Skip to content
Snippets Groups Projects
Commit e1b0b8d1 authored by David Hammer's avatar David Hammer
Browse files

Adding option to skip Karabo channel output

parent bbb7cee4
No related branches found
No related tags found
2 merge requests!10DetectorAssembler: assemble with extra shape (multiple frames),!9Stacking shmem matcher
......@@ -9,6 +9,7 @@ from karabo.bound import (
KARABO_CLASSINFO,
STRING_ELEMENT,
TABLE_ELEMENT,
ChannelMetaData,
Hash,
Schema,
State,
......@@ -110,6 +111,15 @@ class ShmemTrainMatcher(TrainMatcher.TrainMatcher):
.defaultValue(False)
.reconfigurable()
.commit(),
BOOL_ELEMENT(expected)
.key("enableKaraboOutput")
.displayedName("Enable Karabo channel")
.allowedStates(State.PASSIVE)
.assignmentOptional()
.defaultValue(True)
.reconfigurable()
.commit(),
)
def initialization(self):
......@@ -125,6 +135,10 @@ class ShmemTrainMatcher(TrainMatcher.TrainMatcher):
else:
self._thread_pool = None
if not self.get("enableKaraboOutput"):
# it is set already by super by default, so only need to turn off
self.output = None
def preReconfigure(self, conf):
super().preReconfigure(conf)
if conf.has("merge") or conf.has("sources"):
......@@ -135,6 +149,11 @@ class ShmemTrainMatcher(TrainMatcher.TrainMatcher):
self._thread_pool = None
if conf["useThreadPool"]:
self._thread_pool = concurrent.futures.ThreadPoolExecutor()
if conf.has("enableKaraboOutput"):
if conf["enableKaraboOutput"]:
self.output = self._ss.getOutputChannel("output")
else:
self.output = None
def _prepare_merge_groups(self, merge):
source_group_patterns = []
......@@ -288,7 +307,19 @@ class ShmemTrainMatcher(TrainMatcher.TrainMatcher):
for source, (data, timestamp) in sources.items()
]
)
sources.update(new_sources_map)
super().on_matched_data(train_id, sources)
# karabo output
if self.output is not None:
for source, (data, timestamp) in sources.items():
self.output.write(data, ChannelMetaData(source, timestamp))
self.output.update()
# karabo bridge output
for source, (data, timestamp) in sources.items():
self.zmq_output.write(source, data, timestamp)
self.zmq_output.update()
self.info["sent"] += 1
self.info["trainId"] = train_id
self.rate_out.update()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment