mirror of
https://github.com/avatao-content/test-tutorial-framework
synced 2024-11-14 15:47:17 +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 ast import literal_eval
|
||||||
|
from functools import partial
|
||||||
|
|
||||||
from tornado.ioloop import IOLoop
|
from tornado.ioloop import IOLoop
|
||||||
|
|
||||||
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
|
||||||
|
from tfw.components import FSMManagingEventHandler
|
||||||
from tfw.networking import MessageSender, TFWServerConnector
|
from tfw.networking import MessageSender, TFWServerConnector
|
||||||
from tfw.config import TFWENV
|
from tfw.config import TFWENV
|
||||||
from tfw.config.logs import logging
|
from tfw.config.logs import logging
|
||||||
from tao.config import TAOENV
|
from tao.config import TAOENV
|
||||||
|
|
||||||
|
from test_fsm import TestFSM
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@ -76,6 +80,11 @@ class TestCommands(TerminalCommands):
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
FiveStepTestFSM = partial(TestFSM, 5)
|
||||||
|
fsm = FSMManagingEventHandler( # TFW FSM
|
||||||
|
key='fsm',
|
||||||
|
fsm_type=FiveStepTestFSM
|
||||||
|
)
|
||||||
ide = IdeEventHandler( # Web IDE backend
|
ide = IdeEventHandler( # Web IDE backend
|
||||||
key='ide',
|
key='ide',
|
||||||
allowed_directories=[TFWENV.IDE_WD, TFWENV.WEBSERVICE_DIR],
|
allowed_directories=[TFWENV.IDE_WD, TFWENV.WEBSERVICE_DIR],
|
||||||
@ -96,7 +105,7 @@ if __name__ == '__main__':
|
|||||||
process_name='webservice',
|
process_name='webservice',
|
||||||
log_tail=2000
|
log_tail=2000
|
||||||
)
|
)
|
||||||
eventhandlers = {ide, terminal, processmanager, logmonitor}
|
eventhandlers = {ide, terminal, processmanager, logmonitor, fsm}
|
||||||
|
|
||||||
commands = TestCommands(bashrc=f'/home/{TAOENV.USER}/.bashrc')
|
commands = TestCommands(bashrc=f'/home/{TAOENV.USER}/.bashrc')
|
||||||
terminal.historymonitor.subscribe_callback(commands.callback)
|
terminal.historymonitor.subscribe_callback(commands.callback)
|
||||||
|
@ -1,17 +1,9 @@
|
|||||||
from functools import partial
|
|
||||||
|
|
||||||
from tornado.ioloop import IOLoop
|
from tornado.ioloop import IOLoop
|
||||||
|
|
||||||
from tfw.networking import TFWServer
|
from tfw.networking import TFWServer
|
||||||
from tfw.config import TFWENV
|
from tfw.config import TFWENV
|
||||||
from tfw.config.logs import logging
|
|
||||||
from test_fsm import TestFSM
|
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
FiveStepTestFSM = partial(TestFSM, 5)
|
TFWServer().listen(TFWENV.WEB_PORT)
|
||||||
TFWServer(FiveStepTestFSM).listen(TFWENV.WEB_PORT)
|
|
||||||
|
|
||||||
IOLoop.instance().start()
|
IOLoop.instance().start()
|
||||||
|
Loading…
Reference in New Issue
Block a user