mirror of
https://github.com/avatao-content/test-tutorial-framework
synced 2024-12-05 02:31:33 +00:00
Move FSM initialization logic to event_handler_main.py
This commit is contained in:
parent
0fafa8bcfb
commit
9b3e62852d
@ -1,15 +1,19 @@
|
||||
from ast import literal_eval
|
||||
from functools import partial
|
||||
|
||||
from tornado.ioloop import IOLoop
|
||||
|
||||
from tfw.components import IdeEventHandler, TerminalEventHandler
|
||||
from tfw.components import ProcessManagingEventHandler, BashMonitor
|
||||
from tfw.components import TerminalCommands, LogMonitoringEventHandler
|
||||
from tfw.components import FSMManagingEventHandler
|
||||
from tfw.networking import MessageSender, TFWServerConnector
|
||||
from tfw.config import TFWENV
|
||||
from tfw.config.logs import logging
|
||||
from tao.config import TAOENV
|
||||
|
||||
from test_fsm import TestFSM
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -76,6 +80,11 @@ class TestCommands(TerminalCommands):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
FiveStepTestFSM = partial(TestFSM, 5)
|
||||
fsm = FSMManagingEventHandler( # TFW FSM
|
||||
key='fsm',
|
||||
fsm_type=FiveStepTestFSM
|
||||
)
|
||||
ide = IdeEventHandler( # Web IDE backend
|
||||
key='ide',
|
||||
allowed_directories=[TFWENV.IDE_WD, TFWENV.WEBSERVICE_DIR],
|
||||
@ -96,7 +105,7 @@ if __name__ == '__main__':
|
||||
process_name='webservice',
|
||||
log_tail=2000
|
||||
)
|
||||
eventhandlers = {ide, terminal, processmanager, logmonitor}
|
||||
eventhandlers = {ide, terminal, processmanager, logmonitor, fsm}
|
||||
|
||||
commands = TestCommands(bashrc=f'/home/{TAOENV.USER}/.bashrc')
|
||||
terminal.historymonitor.subscribe_callback(commands.callback)
|
||||
|
@ -1,17 +1,9 @@
|
||||
from functools import partial
|
||||
|
||||
from tornado.ioloop import IOLoop
|
||||
|
||||
from tfw.networking import TFWServer
|
||||
from tfw.config import TFWENV
|
||||
from tfw.config.logs import logging
|
||||
from test_fsm import TestFSM
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
FiveStepTestFSM = partial(TestFSM, 5)
|
||||
TFWServer(FiveStepTestFSM).listen(TFWENV.WEB_PORT)
|
||||
|
||||
TFWServer().listen(TFWENV.WEB_PORT)
|
||||
IOLoop.instance().start()
|
||||
|
Loading…
Reference in New Issue
Block a user