mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 13:16:30 +00:00
write logs for inference and loader to file
This commit is contained in:
@@ -28,7 +28,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 +40,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,11 +59,11 @@ 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(<str>f'{cmd}')
|
||||
self._on_command(cmd)
|
||||
except Exception as e:
|
||||
if not self._shutdown_event.is_set():
|
||||
constants.log(f"Worker error: {e}")
|
||||
constants.logerror(f"Worker error: {e}")
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
finally:
|
||||
@@ -72,11 +72,6 @@ cdef class RemoteCommandHandler:
|
||||
cdef send(self, bytes client_id, bytes data):
|
||||
self._router.send_multipart([client_id, data])
|
||||
|
||||
# with self._context.socket(zmq.DEALER) as socket:
|
||||
# socket.connect("inproc://backend")
|
||||
# socket.send_multipart([client_id, data])
|
||||
# # constants.log(<str>f'Sent {len(data)} bytes.', client_id)
|
||||
|
||||
cdef stop(self):
|
||||
self._shutdown_event.set()
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user