mirror of
https://github.com/avatao-content/test-tutorial-framework
synced 2024-11-15 01:47:16 +00:00
Move signal handling to new module
This commit is contained in:
parent
417a848328
commit
ef2ab5d0bf
@ -1,12 +1,10 @@
|
|||||||
import logging
|
import logging
|
||||||
from sys import stderr
|
from sys import stderr
|
||||||
from functools import partial
|
from functools import partial
|
||||||
from signal import signal, SIGTERM, SIGINT
|
|
||||||
|
|
||||||
from tornado.ioloop import IOLoop
|
from tornado.ioloop import IOLoop
|
||||||
|
|
||||||
from tfw.fsm import YamlFSM
|
from tfw.fsm import YamlFSM
|
||||||
from tfw.builtins import EventHandler
|
|
||||||
from tfw.builtins import IdeEventHandler, TerminalEventHandler, FrontendEventHandler
|
from tfw.builtins import IdeEventHandler, TerminalEventHandler, FrontendEventHandler
|
||||||
from tfw.builtins import LogMonitoringEventHandler, ProcessManagingEventHandler
|
from tfw.builtins import LogMonitoringEventHandler, ProcessManagingEventHandler
|
||||||
from tfw.builtins import DirectorySnapshottingEventHandler, FSMManagingEventHandler
|
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 MessageFSMStepsEventHandler
|
||||||
from custom_event_handlers import TerminalCallbackEventHandler, TestCommands
|
from custom_event_handlers import TerminalCallbackEventHandler, TestCommands
|
||||||
|
from signal_handling import setup_signal_handlers
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -72,12 +71,7 @@ def main():
|
|||||||
key='test'
|
key='test'
|
||||||
)
|
)
|
||||||
|
|
||||||
def stop(*_):
|
setup_signal_handlers()
|
||||||
EventHandler.stop_all_instances()
|
|
||||||
exit(0)
|
|
||||||
signal(SIGTERM, stop)
|
|
||||||
signal(SIGINT, stop)
|
|
||||||
|
|
||||||
IOLoop.instance().start()
|
IOLoop.instance().start()
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
import logging
|
import logging
|
||||||
from sys import stderr
|
from sys import stderr
|
||||||
from signal import signal, SIGTERM, SIGINT
|
|
||||||
|
|
||||||
from tornado.ioloop import IOLoop
|
from tornado.ioloop import IOLoop
|
||||||
|
|
||||||
from tfw.builtins import EventHandler
|
|
||||||
from tfw.builtins import PipeIOEventHandler
|
from tfw.builtins import PipeIOEventHandler
|
||||||
from tfw.config import TFWENV
|
from tfw.config import TFWENV
|
||||||
from tfw.logging import Log, Logger, LogFormatter, VerboseLogFormatter
|
from tfw.logging import Log, Logger, LogFormatter, VerboseLogFormatter
|
||||||
@ -15,6 +13,7 @@ from pipe_io_auxlib import (
|
|||||||
DeployPipeIOEventHandler, IdePipeIOEventHandler,
|
DeployPipeIOEventHandler, IdePipeIOEventHandler,
|
||||||
FSMPipeIOEventHandler
|
FSMPipeIOEventHandler
|
||||||
)
|
)
|
||||||
|
from signal_handling import setup_signal_handlers
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -67,12 +66,7 @@ def main():
|
|||||||
'/tmp/tfw_fsm_recv'
|
'/tmp/tfw_fsm_recv'
|
||||||
)
|
)
|
||||||
|
|
||||||
def stop(*_):
|
setup_signal_handlers()
|
||||||
EventHandler.stop_all_instances()
|
|
||||||
exit(0)
|
|
||||||
signal(SIGTERM, stop)
|
|
||||||
signal(SIGINT, stop)
|
|
||||||
|
|
||||||
IOLoop.instance().start()
|
IOLoop.instance().start()
|
||||||
|
|
||||||
|
|
||||||
|
11
solvable/src/signal_handling.py
Normal file
11
solvable/src/signal_handling.py
Normal 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)
|
Loading…
Reference in New Issue
Block a user