mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-11-22 15:31:32 +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.components.mixins import SupervisorMixin
|
||||
from tfw.config import tfwenv
|
||||
from tfw.config.logs import logging
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class TerminadoEventHandler(TriggerlessEventHandler, SupervisorMixin):
|
||||
def __init__(self, key, process_name):
|
||||
class TerminadoEventHandler(TriggerlessEventHandler):
|
||||
def __init__(self, key):
|
||||
super().__init__(key)
|
||||
self.working_directory = tfwenv.TERMINADO_DIR
|
||||
self.process_name = process_name
|
||||
self.start_process(self.process_name)
|
||||
self.terminado_server = TerminadoMiniServer('/terminal', tfwenv.TERMINADO_PORT, tfwenv.TERMINADO_WD, ['bash'])
|
||||
self.terminado_server.listen()
|
||||
|
||||
def handle_event(self, key, data_json):
|
||||
log.debug('TerminadoEventHandler received event for key {}'.format(key))
|
||||
|
@ -8,7 +8,7 @@ from tfw.config import tfwenv
|
||||
|
||||
if __name__ == '__main__':
|
||||
ide = SourceCodeEventHandler('webide', tfwenv.WEBIDE_WD)
|
||||
terminado = TerminadoEventHandler('terminado', 'terminado')
|
||||
terminado = TerminadoEventHandler('terminado')
|
||||
processmanager = ProcessManagingEventHandler('processmanager', ide.monitor)
|
||||
|
||||
eventhandlers = {ide, terminado, processmanager}
|
||||
|
Loading…
Reference in New Issue
Block a user