mirror of
https://github.com/avatao-content/test-tutorial-framework
synced 2025-06-28 07:15:13 +00:00
Comply new package structure
This commit is contained in:
@ -2,8 +2,8 @@ FROM avatao/controller:debian-buster
|
||||
|
||||
USER root
|
||||
ENV PYTHONPATH="/usr/local/lib" \
|
||||
TFW_PUBLISHER_PORT=7654 \
|
||||
TFW_RECEIVER_PORT=8765 \
|
||||
TFW_PUB_PORT=7654 \
|
||||
TFW_PULL_PORT=8765 \
|
||||
TFW_AUTH_KEY="/tmp/tfw-auth.key" \
|
||||
CONTROLLER_PORT=5555
|
||||
|
||||
|
@ -4,8 +4,8 @@ import json
|
||||
from tornado.ioloop import IOLoop
|
||||
from tornado.web import RequestHandler, Application
|
||||
|
||||
from tfw.builtins import FSMAwareEventHandler
|
||||
from tfw.main import EventHandlerFactory
|
||||
from tfw.event_handlers import FSMAwareEventHandler
|
||||
from tfw.main import EventHandlerFactory, setup_signal_handlers
|
||||
|
||||
|
||||
class ControllerPostHandler(RequestHandler):
|
||||
@ -20,23 +20,18 @@ class ControllerPostHandler(RequestHandler):
|
||||
}))
|
||||
|
||||
|
||||
class ControllerEventHandler(FSMAwareEventHandler):
|
||||
def handle_event(self, message):
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
controller = ControllerEventHandler('controller')
|
||||
controller_eh = EventHandlerFactory().build(controller)
|
||||
controller_eh = EventHandlerFactory().build(
|
||||
lambda *_: None,
|
||||
event_handler_type=FSMAwareEventHandler
|
||||
)
|
||||
|
||||
application = Application([(
|
||||
f'/{os.environ["SECRET"]}',
|
||||
ControllerPostHandler,
|
||||
{'controller': controller}
|
||||
{'controller': controller_eh}
|
||||
)])
|
||||
application.listen(os.environ['CONTROLLER_PORT'])
|
||||
|
||||
try:
|
||||
IOLoop.instance().start()
|
||||
finally:
|
||||
controller.cleanup()
|
||||
setup_signal_handlers()
|
||||
IOLoop.instance().start()
|
||||
|
Reference in New Issue
Block a user