mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-11-22 20:01:33 +00:00
Delegate ownership of terminado server to TerminadoEventHandler
This commit is contained in:
parent
338e690842
commit
cc2c6009dd
@ -1,16 +1,16 @@
|
|||||||
|
from tfw.components.terminado_mini_server import TerminadoMiniServer
|
||||||
from tfw.event_handler_base import TriggerlessEventHandler
|
from tfw.event_handler_base import TriggerlessEventHandler
|
||||||
from tfw.components.mixins import SupervisorMixin
|
|
||||||
from tfw.config import tfwenv
|
from tfw.config import tfwenv
|
||||||
from tfw.config.logs import logging
|
from tfw.config.logs import logging
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class TerminadoEventHandler(TriggerlessEventHandler, SupervisorMixin):
|
class TerminadoEventHandler(TriggerlessEventHandler):
|
||||||
def __init__(self, key, process_name):
|
def __init__(self, key):
|
||||||
super().__init__(key)
|
super().__init__(key)
|
||||||
self.working_directory = tfwenv.TERMINADO_DIR
|
self.working_directory = tfwenv.TERMINADO_DIR
|
||||||
self.process_name = process_name
|
self.terminado_server = TerminadoMiniServer('/terminal', tfwenv.TERMINADO_PORT, tfwenv.TERMINADO_WD, ['bash'])
|
||||||
self.start_process(self.process_name)
|
self.terminado_server.listen()
|
||||||
|
|
||||||
def handle_event(self, key, data_json):
|
def handle_event(self, key, data_json):
|
||||||
log.debug('TerminadoEventHandler received event for key {}'.format(key))
|
log.debug('TerminadoEventHandler received event for key {}'.format(key))
|
||||||
|
@ -8,7 +8,7 @@ from tfw.config import tfwenv
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
ide = SourceCodeEventHandler('webide', tfwenv.WEBIDE_WD)
|
ide = SourceCodeEventHandler('webide', tfwenv.WEBIDE_WD)
|
||||||
terminado = TerminadoEventHandler('terminado', 'terminado')
|
terminado = TerminadoEventHandler('terminado')
|
||||||
processmanager = ProcessManagingEventHandler('processmanager', ide.monitor)
|
processmanager = ProcessManagingEventHandler('processmanager', ide.monitor)
|
||||||
|
|
||||||
eventhandlers = {ide, terminado, processmanager}
|
eventhandlers = {ide, terminado, processmanager}
|
||||||
|
Loading…
Reference in New Issue
Block a user