mirror of
https://github.com/avatao-content/test-tutorial-framework
synced 2024-11-15 01:17:16 +00:00
Merge branch 'pipeio'
This commit is contained in:
commit
5a8edb7b8a
@ -1,9 +1,10 @@
|
|||||||
from ast import literal_eval
|
from ast import literal_eval
|
||||||
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 import YamlFSM, FSMAwareEventHandler
|
from tfw import YamlFSM, FSMAwareEventHandler, EventHandlerBase
|
||||||
from tfw.components import IdeEventHandler, TerminalEventHandler
|
from tfw.components import IdeEventHandler, TerminalEventHandler
|
||||||
from tfw.components import ProcessManagingEventHandler, BashMonitor
|
from tfw.components import ProcessManagingEventHandler, BashMonitor
|
||||||
from tfw.components import TerminalCommands, LogMonitoringEventHandler
|
from tfw.components import TerminalCommands, LogMonitoringEventHandler
|
||||||
@ -136,9 +137,12 @@ if __name__ == '__main__':
|
|||||||
# Example terminal command callback
|
# Example terminal command callback
|
||||||
terminal.historymonitor.subscribe_callback(cenator)
|
terminal.historymonitor.subscribe_callback(cenator)
|
||||||
|
|
||||||
try:
|
event_handlers = EventHandlerBase.get_local_instances()
|
||||||
IOLoop.instance().start()
|
def cleanup(sig, frame):
|
||||||
finally:
|
for eh in event_handlers:
|
||||||
eventhandlers = {fsm, ide, terminal, processmanager, logmonitor, message_fsm_steps}
|
|
||||||
for eh in eventhandlers:
|
|
||||||
eh.cleanup()
|
eh.cleanup()
|
||||||
|
exit(0)
|
||||||
|
signal(SIGTERM, cleanup)
|
||||||
|
signal(SIGINT, cleanup)
|
||||||
|
|
||||||
|
IOLoop.instance().start()
|
||||||
|
24
solvable/src/pipe_io_main.py
Normal file
24
solvable/src/pipe_io_main.py
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
from signal import signal, SIGTERM, SIGINT
|
||||||
|
|
||||||
|
from tornado.ioloop import IOLoop
|
||||||
|
|
||||||
|
from tfw import EventHandlerBase
|
||||||
|
from tfw.components import PipeIOEventHandler
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
pipe_io = PipeIOEventHandler(
|
||||||
|
'',
|
||||||
|
'/tmp/tfw_send',
|
||||||
|
'/tmp/tfw_recv'
|
||||||
|
)
|
||||||
|
|
||||||
|
event_handlers = EventHandlerBase.get_local_instances()
|
||||||
|
def cleanup(sig, frame):
|
||||||
|
for eh in event_handlers:
|
||||||
|
eh.cleanup()
|
||||||
|
exit(0)
|
||||||
|
signal(SIGTERM, cleanup)
|
||||||
|
signal(SIGINT, cleanup)
|
||||||
|
|
||||||
|
IOLoop.instance().start()
|
4
solvable/supervisor/pipe_io_main.conf
Normal file
4
solvable/supervisor/pipe_io_main.conf
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
[program:pipe_io_main]
|
||||||
|
user=root
|
||||||
|
directory=%(ENV_TFW_EHMAIN_DIR)s
|
||||||
|
command=python3 pipe_io_main.py
|
Loading…
Reference in New Issue
Block a user