mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-11-22 16:21:31 +00:00
Document LogMonitoringEventHandler
This commit is contained in:
parent
b68ceeb394
commit
ea251ef474
@ -10,6 +10,12 @@ LOG = logging.getLogger(__name__)
|
|||||||
|
|
||||||
|
|
||||||
class LogMonitoringEventHandler(EventHandlerBase, MonitorManagerMixin):
|
class LogMonitoringEventHandler(EventHandlerBase, MonitorManagerMixin):
|
||||||
|
"""
|
||||||
|
Monitors the output of a supervisor process (stdout, stderr) and
|
||||||
|
sends the results to the frontend.
|
||||||
|
|
||||||
|
Exposes API to change monitoring parameters.
|
||||||
|
"""
|
||||||
def __init__(self, key, process_name, log_tail=0):
|
def __init__(self, key, process_name, log_tail=0):
|
||||||
super().__init__(key)
|
super().__init__(key)
|
||||||
self.process_name = process_name
|
self.process_name = process_name
|
||||||
@ -30,7 +36,21 @@ class LogMonitoringEventHandler(EventHandlerBase, MonitorManagerMixin):
|
|||||||
LOG.error('IGNORING MESSAGE: Invalid message received: %s', message)
|
LOG.error('IGNORING MESSAGE: Invalid message received: %s', message)
|
||||||
|
|
||||||
def handle_process_name(self, data):
|
def handle_process_name(self, data):
|
||||||
|
"""
|
||||||
|
Changes the monitored process.
|
||||||
|
|
||||||
|
:param data: TFW message data containing keys:
|
||||||
|
|-value: name of the process to monitor
|
||||||
|
"""
|
||||||
self.set_monitor_args(data['value'], self.log_tail)
|
self.set_monitor_args(data['value'], self.log_tail)
|
||||||
|
|
||||||
def handle_log_tail(self, data):
|
def handle_log_tail(self, data):
|
||||||
|
"""
|
||||||
|
Sets tail length of the log the monitor will send
|
||||||
|
to the frontend (the monitor will send back the last
|
||||||
|
'value' characters of the log).
|
||||||
|
|
||||||
|
:param data: TFW message data containing keys:
|
||||||
|
|-value: new tail length
|
||||||
|
"""
|
||||||
self.set_monitor_args(self.process_name, data['value'])
|
self.set_monitor_args(self.process_name, data['value'])
|
||||||
|
Loading…
Reference in New Issue
Block a user