1
0
mirror of https://github.com/avatao-content/test-tutorial-framework synced 2024-11-14 16:07:18 +00:00

Move signal handling to new module

This commit is contained in:
R. Richard 2019-07-08 11:42:03 +02:00 committed by therealkrispet
parent 417a848328
commit ef2ab5d0bf
3 changed files with 15 additions and 16 deletions

View File

@ -1,12 +1,10 @@
import logging
from sys import stderr
from functools import partial
from signal import signal, SIGTERM, SIGINT
from tornado.ioloop import IOLoop
from tfw.fsm import YamlFSM
from tfw.builtins import EventHandler
from tfw.builtins import IdeEventHandler, TerminalEventHandler, FrontendEventHandler
from tfw.builtins import LogMonitoringEventHandler, ProcessManagingEventHandler
from tfw.builtins import DirectorySnapshottingEventHandler, FSMManagingEventHandler
@ -16,6 +14,7 @@ from tao.config import TAOENV
from custom_event_handlers import MessageFSMStepsEventHandler
from custom_event_handlers import TerminalCallbackEventHandler, TestCommands
from signal_handling import setup_signal_handlers
LOG = logging.getLogger(__name__)
@ -72,12 +71,7 @@ def main():
key='test'
)
def stop(*_):
EventHandler.stop_all_instances()
exit(0)
signal(SIGTERM, stop)
signal(SIGINT, stop)
setup_signal_handlers()
IOLoop.instance().start()

View File

@ -1,10 +1,8 @@
import logging
from sys import stderr
from signal import signal, SIGTERM, SIGINT
from tornado.ioloop import IOLoop
from tfw.builtins import EventHandler
from tfw.builtins import PipeIOEventHandler
from tfw.config import TFWENV
from tfw.logging import Log, Logger, LogFormatter, VerboseLogFormatter
@ -15,6 +13,7 @@ from pipe_io_auxlib import (
DeployPipeIOEventHandler, IdePipeIOEventHandler,
FSMPipeIOEventHandler
)
from signal_handling import setup_signal_handlers
LOG = logging.getLogger(__name__)
@ -67,12 +66,7 @@ def main():
'/tmp/tfw_fsm_recv'
)
def stop(*_):
EventHandler.stop_all_instances()
exit(0)
signal(SIGTERM, stop)
signal(SIGINT, stop)
setup_signal_handlers()
IOLoop.instance().start()

View File

@ -0,0 +1,11 @@
from signal import signal, SIGTERM, SIGINT
from tfw.builtins import EventHandler
def setup_signal_handlers():
def stop(*_):
EventHandler.stop_all_instances()
exit(0)
signal(SIGTERM, stop)
signal(SIGINT, stop)