From 62c2d793aa25e2d61c6b85d1a26d343c727b56b3 Mon Sep 17 00:00:00 2001 From: jbruce Date: Sat, 21 May 2022 10:29:18 -0400 Subject: [PATCH] adding stats api call --- kiln-controller.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/kiln-controller.py b/kiln-controller.py index 4482ba8..137c408 100755 --- a/kiln-controller.py +++ b/kiln-controller.py @@ -13,7 +13,6 @@ from gevent.pywsgi import WSGIServer from geventwebsocket.handler import WebSocketHandler from geventwebsocket import WebSocketError - try: sys.dont_write_bytecode = True import config @@ -79,6 +78,13 @@ def handle_api(): log.info("api stop command received") oven.abort_run() + # get stats during a run + if bottle.request.json['cmd'] == 'stats': + log.info("api stats command received") + if hasattr(oven,'pid'): + if hasattr(oven.pid,'pidstats'): + return json.dumps(oven.pid.pidstats) + return { "success" : True } def find_profile(wanted):