Initial offline process implementation

Implemented the initial offline processing implementation, with
dependency layer building and ordered processing

Processing is still single threaded and unoptimized so it can take some
time to complete, the next step is to move from a single threaded design
to a ThreadPoolExecutor that splits up the buffer into a set number of
chunks for processing
This commit is contained in:
h3cx committed 2026-09-27 17:45:57 +02:00
1 parent eab0718a72
commit 6b954287a4
7 files changed
+405 -22

No files matched your search

+46
View File
@@ -2,6 +2,7 @@
# Copyright (C) 2026 Association Exergie <association.exergie@gmail.com>
# SPDX-License-Identifier: GPL-3.0-or-later
from __future__ import annotations
from copy import copy
from datetime import datetime, timezone
import logging
@@ -59,6 +60,51 @@ class DLPak:
timestamp=timestamp, signals=manifest_signals, comments=""
)
def merge(self, dlpak: DLPak) -> None:
for sample in dlpak._data._samples:
self._data.append(sample[0], sample[1], sample[2])
self._data.sort()
for signal in dlpak._manifest.signals:
self._manifest.signals.append(signal)
log.debug(
"Merged %d sample(s) and %d signal(s) into DLPak",
len(dlpak._data),
len(dlpak._manifest.signals),
extra={
"event": "dlpak.merged",
"added_sample_count": len(dlpak._data),
"added_signal_count": len(dlpak._manifest.signals),
},
)
def remove_derived(self) -> None:
if self._manifest is not None:
original_sample_count = len(self._data)
remove_uuids = [
signal.id
for signal in self._manifest.signals
if signal.origin == "derived"
]
for remove_uuid in remove_uuids:
self._data.clear_uuid(remove_uuid)
self._manifest.signals = [
signal
for signal in self._manifest.signals
if signal.origin != "derived"
]
log.debug(
"Removed %d derived signal(s) and %d sample(s) from DLPak",
len(remove_uuids),
original_sample_count - len(self._data),
extra={
"event": "dlpak.derived_removed",
"removed_signal_count": len(remove_uuids),
"removed_sample_count": original_sample_count - len(self._data),
},
)
def get_all_signal_descriptors(self) -> list[SignalDescriptor]:
return copy([signal.to_pure() for signal in self._manifest.signals])