baseimage-tutorial-framework/src/event_handlers/terminado_event_handler.py

22 lines
769 B
Python

from shutil import rmtree, copytree
from event_handler_base import EventHandlerBase
from util import SupervisorMixin
from config import TERMINADO_DIR
class TerminadoEventHandler(EventHandlerBase, SupervisorMixin):
def __init__(self, anchor, process_name, zmq_context=None):
super().__init__(anchor, zmq_context)
self.working_directory = TERMINADO_DIR
self.process_name = process_name
self.setup_terminado_server()
def setup_terminado_server(self):
rmtree(self.working_directory, ignore_errors=True)
copytree('terminado_server/', self.working_directory)
self.supervisor.startProcess(self.process_name)
def handle_event(self, anchor, data_json):
raise NotImplementedError # TODO: wat do?