Revised error codes and functional PlaybackEngine

All internal and public errors have been revised (GPT 5.6 Sol) to return
more detail without horrendously long error classes, this has reduced
the number of error types but each now carries a reason and a code for
differentiation if needed

PlaybackEngine has been implemented and is functional, core mode changes
what signal descriptors are returned to avoid duplicates, the playback
engine currently discards the derived signals that would be recorded in
the DLPak and derived signals are reprocessed live

Future will require the behavior listed above to be selectable so one of
two options are possible:
A - Derived signals are reprocessed live by the relevant derive units
(current behavior
B - Derived signals are played back directly from the PlaybackEngine,
this requires turning off the routing to the live derive units to avoid
duplicate values

This will also require the option to perform offline processing with
derive units to be able to create derived signals after the fact, this
will likely incur a new 'offline' mode in the core to gate things
correctly, this will likely be useful for heavier processing that cannot
be done live, filters that require a lookahead, or more precise derived
signals using interpolated signals for higher acurracy which also brings
the ability to offline process on a fixed timebase instead of following
either input signal to the derived signal
This commit is contained in:
2026-09-13 12:26:12 +02:00
parent bbc5aac891
commit 9407bfeb79
18 changed files with 1160 additions and 178 deletions
+8 -2
View File
@@ -5,7 +5,7 @@ from uuid import uuid4
import pytest
from dynalab_core import Core
from dynalab_core.config import CoreConfig
from dynalab_core.errors import CoreStateMismatchError
from dynalab_core.errors import CoreError
from dynalab_core.protocols.endpoint import ConnectorEndpoint
from dynalab_core.protocols.packets.data import ValueDescriptor
from dynalab_core.protocols.packets.handshake import ConnectorHello
@@ -20,7 +20,7 @@ def test_core_cannot_start_twice(caplog: pytest.LogCaptureFixture) -> None:
core.start()
try:
with pytest.raises(CoreStateMismatchError):
with pytest.raises(CoreError, match="can only be started once") as raised:
core.start()
finally:
core.stop()
@@ -37,6 +37,7 @@ def test_core_cannot_start_twice(caplog: pytest.LogCaptureFixture) -> None:
)
assert rejection.levelno == logging.WARNING
assert rejection.core_state == "started"
assert raised.value.code == "invalid_state"
def test_core_input_worker_logs_failure(
@@ -87,9 +88,14 @@ def test_core_mode_is_shared_with_endpoints() -> None:
try:
assert endpoint._core_mode is core._mode
assert core.get_mode() == "realtime"
core.set_mode("playback")
assert endpoint._core_mode.value == "playback"
assert core.get_mode() == "playback"
with pytest.raises(CoreError) as raised:
core.load_playback_engine()
assert raised.value.code == "no_playback_data"
finally:
core.stop()