From 2b0ed256054c0b23ce8d6adb0b4de3b1ea87b9aa Mon Sep 17 00:00:00 2001 From: Guillermo Rodriguez Date: Sat, 24 Dec 2022 11:34:00 -0300 Subject: [PATCH] Add more logging on msg passing --- skynet/brain.py | 6 +++--- skynet/dgpu.py | 10 +++++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/skynet/brain.py b/skynet/brain.py index 6ec745c..2094faa 100644 --- a/skynet/brain.py +++ b/skynet/brain.py @@ -117,9 +117,9 @@ async def open_rpc_service(sock, dgpu_bus, db_pool, tls_whitelist, tls_key): async def dgpu_image_streamer(): nonlocal wip_reqs, fin_reqs while True: - msg = DGPUBusResponse( - **json.loads( - (await dgpu_bus.arecv()).decode())) + raw_msg = (await dgpu_bus.arecv()).decode() + logging.info(f'streamer got {len(raw_msg)} bytes.') + msg = DGPUBusResponse(**json.loads(raw_msg)) if security: msg.verify(tls_whitelist[msg.cert]) diff --git a/skynet/dgpu.py b/skynet/dgpu.py index 1186630..d40d214 100644 --- a/skynet/dgpu.py +++ b/skynet/dgpu.py @@ -119,8 +119,9 @@ async def open_dgpu_node( if ireq.upscaler == 'x4': logging.info('performing upscale...') + input_img = image.convert('RGB') up_img, _ = upscaler.enhance( - convert_from_image_to_cv2(image), outscale=4) + convert_from_image_to_cv2(input_img), outscale=4) image = convert_from_cv2_to_image(up_img) logging.info('done') @@ -238,9 +239,12 @@ async def open_dgpu_node( if security: img_resp.sign(tls_key, cert_name) + raw_msg = json.dumps(img_resp.to_dict()).encode() + # send final image - await dgpu_sock.asend( - json.dumps(img_resp.to_dict()).encode()) + logging.info('sending img back...') + await dgpu_sock.asend(raw_msg) + logging.info(f'sent {len(raw_msg)} bytes.') except KeyboardInterrupt: logging.info('interrupt caught, stopping...')