Add more logging on msg passing

pull/2/head
Guillermo Rodriguez 2022-12-24 11:34:00 -03:00
parent 55781688cd
commit 2b0ed25605
No known key found for this signature in database
GPG Key ID: EC3AB66D5D83B392
2 changed files with 10 additions and 6 deletions

View File

@ -117,9 +117,9 @@ async def open_rpc_service(sock, dgpu_bus, db_pool, tls_whitelist, tls_key):
async def dgpu_image_streamer(): async def dgpu_image_streamer():
nonlocal wip_reqs, fin_reqs nonlocal wip_reqs, fin_reqs
while True: while True:
msg = DGPUBusResponse( raw_msg = (await dgpu_bus.arecv()).decode()
**json.loads( logging.info(f'streamer got {len(raw_msg)} bytes.')
(await dgpu_bus.arecv()).decode())) msg = DGPUBusResponse(**json.loads(raw_msg))
if security: if security:
msg.verify(tls_whitelist[msg.cert]) msg.verify(tls_whitelist[msg.cert])

View File

@ -119,8 +119,9 @@ async def open_dgpu_node(
if ireq.upscaler == 'x4': if ireq.upscaler == 'x4':
logging.info('performing upscale...') logging.info('performing upscale...')
input_img = image.convert('RGB')
up_img, _ = upscaler.enhance( 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) image = convert_from_cv2_to_image(up_img)
logging.info('done') logging.info('done')
@ -238,9 +239,12 @@ async def open_dgpu_node(
if security: if security:
img_resp.sign(tls_key, cert_name) img_resp.sign(tls_key, cert_name)
raw_msg = json.dumps(img_resp.to_dict()).encode()
# send final image # send final image
await dgpu_sock.asend( logging.info('sending img back...')
json.dumps(img_resp.to_dict()).encode()) await dgpu_sock.asend(raw_msg)
logging.info(f'sent {len(raw_msg)} bytes.')
except KeyboardInterrupt: except KeyboardInterrupt:
logging.info('interrupt caught, stopping...') logging.info('interrupt caught, stopping...')