from shutil import rmtree, copytree from tfw.event_handler_base import EventHandlerBase from tfw.util import SupervisorMixin from tfw.config import TERMINADO_DIR from tfw.config.logs import logging log = logging.getLogger(__name__) class TerminadoEventHandler(EventHandlerBase, SupervisorMixin): def __init__(self, anchor, process_name): super().__init__(anchor) 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.start_process() def handle_event(self, anchor, data_json): log.debug('TerminadoEventHandler received event for anchor {}'.format(anchor)) # TODO: wat do?