Small modifications to DeriveUnit
Fixed init inconsitencies on DeriveUnit IO queues as well as function naming. Updated test to stream output
This commit is contained in:
2 files changed
+17
-7
No files matched your search
@@ -35,12 +35,11 @@ class DeriveUnit:
|
||||
return_signal: SignalDescriptor,
|
||||
) -> None:
|
||||
self._id: UUID = unit_uuid
|
||||
self._worker_thread: Thread | None = None
|
||||
self._process_function: Callable = processing_function
|
||||
self._return_signal: SignalDescriptor = return_signal
|
||||
self._stop_event: threading.Event = threading.Event()
|
||||
self._input_queue: Queue[list[ValueDescriptor]] = []
|
||||
self._output_queue: Queue[ValueDescriptor] = []
|
||||
self._input_queue: Queue[list[ValueDescriptor]] = Queue()
|
||||
self._output_queue: Queue[ValueDescriptor] = Queue()
|
||||
|
||||
self._num_input_args: int = 0
|
||||
self._parser_state: int = ParserState.INIT
|
||||
@@ -66,10 +65,12 @@ class DeriveUnit:
|
||||
if sig.return_annotation is not ValueDescriptor:
|
||||
raise DeriveUnitInvalidSignatureError
|
||||
|
||||
print(f"Signature validated with {self._num_input_args} input values")
|
||||
# TODO: Define and start worker thread
|
||||
self._worker_thread: Thread = Thread(
|
||||
target=self._worker_function, name=f"{self._id}_worker_thread", daemon=True
|
||||
)
|
||||
self._worker_thread.start()
|
||||
|
||||
def worker_function(self) -> None:
|
||||
def _worker_function(self) -> None:
|
||||
while not self._stop_event.is_set():
|
||||
try:
|
||||
input_args = self._input_queue.get(timeout=0.1)
|
||||
|
||||
Reference in new issue
Block a user