mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-11-23 01:01:31 +00:00
Implement uplink notifications in ProcessManagingEventHandler
This commit is contained in:
parent
b50a2e401f
commit
57bd2aec45
@ -1,5 +1,6 @@
|
|||||||
from tfw.event_handler_base import TriggerlessEventHandler
|
from tfw.event_handler_base import TriggerlessEventHandler
|
||||||
from tfw.components.mixins import SupervisorMixin
|
from tfw.components.mixins import SupervisorMixin
|
||||||
|
from tfw.networking.event_handlers.server_connector import ServerUplinkConnector
|
||||||
from tfw.config.logs import logging
|
from tfw.config.logs import logging
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -18,7 +19,10 @@ class ProcessManager(SupervisorMixin):
|
|||||||
class ProcessManagingEventHandler(TriggerlessEventHandler):
|
class ProcessManagingEventHandler(TriggerlessEventHandler):
|
||||||
def __init__(self, key, supervisor_process_name):
|
def __init__(self, key, supervisor_process_name):
|
||||||
super().__init__(key)
|
super().__init__(key)
|
||||||
|
self.key = key
|
||||||
self.processmanager = ProcessManager(supervisor_process_name)
|
self.processmanager = ProcessManager(supervisor_process_name)
|
||||||
|
self.uplink = ServerUplinkConnector()
|
||||||
|
|
||||||
def handle_event(self, key, data_json):
|
def handle_event(self, key, data_json):
|
||||||
self.processmanager(data_json['data']['command'])
|
self.processmanager(data_json['data']['command'])
|
||||||
|
self.uplink.send(self.key, {'key': self.key})
|
||||||
|
Loading…
Reference in New Issue
Block a user