write logs for inference and loader to file

This commit is contained in:
Alex Bezdieniezhnykh
2025-06-14 16:08:32 +03:00
parent 8aa2f563a4
commit 6f297c4ebf
30 changed files with 218 additions and 140 deletions
+3 -4
View File
@@ -3,7 +3,6 @@ import zmq
from threading import Thread, Event
from remote_command cimport RemoteCommand
cimport constants
import yaml
cdef class RemoteCommandHandler:
def __init__(self, int zmq_port, object on_command):
@@ -28,7 +27,7 @@ cdef class RemoteCommandHandler:
for _ in range(4): # 4 worker threads
worker = Thread(target=self._worker_loop, daemon=True)
self._workers.append(worker)
print(f'Listening to commands on port {zmq_port}...')
constants.log(f'Listening to commands on port {zmq_port}...')
cdef start(self):
self._proxy_thread.start()
@@ -40,7 +39,7 @@ cdef class RemoteCommandHandler:
zmq.proxy_steerable(self._router, self._dealer, control=self._control)
except zmq.error.ZMQError as e:
if self._shutdown_event.is_set():
print("Shutdown, exit proxy loop.")
constants.log("Shutdown, exit proxy loop.")
else:
raise
@@ -59,7 +58,7 @@ cdef class RemoteCommandHandler:
client_id, message = worker_socket.recv_multipart()
cmd = RemoteCommand.from_msgpack(<bytes> message)
cmd.client_id = client_id
constants.log(<str>f'{cmd}', client_id)
constants.log(cmd)
self._on_command(cmd)
except Exception as e:
if not self._shutdown_event.is_set():