Skip to content
Snippets Groups Projects
Commit 731b1aaf authored by David Trattnig's avatar David Trattnig
Browse files

Engine status section.

parent 045e8d86
No related branches found
No related tags found
No related merge requests found
...@@ -25,6 +25,7 @@ import os.path ...@@ -25,6 +25,7 @@ import os.path
from os import path from os import path
from enum import Enum from enum import Enum
import meta
from modules.communication.redis.adapter import ClientRedisAdapter from modules.communication.redis.adapter import ClientRedisAdapter
...@@ -51,6 +52,7 @@ class Monitoring: ...@@ -51,6 +52,7 @@ class Monitoring:
self.config = config self.config = config
self.soundsystem = soundsystem self.soundsystem = soundsystem
self.status = dict() self.status = dict()
self.status["engine"] = dict()
self.status["soundsystem"] = dict() self.status["soundsystem"] = dict()
self.status["api"] = dict() self.status["api"] = dict()
self.status["api"]["steering"] = dict() self.status["api"]["steering"] = dict()
...@@ -62,6 +64,8 @@ class Monitoring: ...@@ -62,6 +64,8 @@ class Monitoring:
""" """
Requests the current status of all components Requests the current status of all components
""" """
self.status["engine"]["version"] = meta.__version__
self.soundsystem.enable_transaction(self.soundsystem.client) self.soundsystem.enable_transaction(self.soundsystem.client)
self.status["soundsystem"]["version"] = self.soundsystem.version() self.status["soundsystem"]["version"] = self.soundsystem.version()
self.status["soundsystem"]["active"] = self.soundsystem.is_active() self.status["soundsystem"]["active"] = self.soundsystem.is_active()
...@@ -84,11 +88,10 @@ class Monitoring: ...@@ -84,11 +88,10 @@ class Monitoring:
self.status["redis_ready"] = self.validate_redis_connection() self.status["redis_ready"] = self.validate_redis_connection()
self.status["audio_store"] = self.validate_directory(self.config.get("audiofolder")) self.status["audio_store"] = self.validate_directory(self.config.get("audiofolder"))
# Set overall status
if self.has_valid_status(): if self.has_valid_status():
self.status["engine_status"] = MonitorResponseCode.OK.value self.status["engine"]["status"] = MonitorResponseCode.OK.value
else: else:
self.status["engine_status"] = MonitorResponseCode.INVALID_STATE.value self.status["engine"]["status"] = MonitorResponseCode.INVALID_STATE.value
......
...@@ -62,8 +62,8 @@ class StartupThread(threading.Thread): ...@@ -62,8 +62,8 @@ class StartupThread(threading.Thread):
status = self.monitoring.get_status() status = self.monitoring.get_status()
self.logger.info("Status Monitor:\n%s" % json.dumps(status, indent=4)) self.logger.info("Status Monitor:\n%s" % json.dumps(status, indent=4))
if not status["engine_status"] == "OK": if not status["engine"]["status"] == "OK":
self.logger.info("Engine Status: " + SimpleUtil.red(status["engine_status"])) self.logger.info("Engine Status: " + SimpleUtil.red(status["engine"]["status"]))
raise EngineMalfunctionException raise EngineMalfunctionException
else: else:
self.logger.info("Engine Status: " + SimpleUtil.green("OK")) self.logger.info("Engine Status: " + SimpleUtil.green("OK"))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment