-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path__init__.py
26 lines (22 loc) · 1.08 KB
/
__init__.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
"""AUCR mmbot blueprint plugin."""
# coding=utf-8
# If you want the model to create the a table for the database at run time, import it here in the init
import os
from aucr_app.plugins.tasks.mq import get_a_task_mq
from aucr_app.plugins.mmbot_plugin.mmbot_run import call_back
from aucr_app.plugins.mmbot_plugin.routes import mmbot_page
from aucr_app.plugins.mmbot_plugin.api.reports import mmbot_api_page
from multiprocessing import Process
def load(app):
"""Load overrides for Tasks plugin to work properly."""
app.register_blueprint(mmbot_page, url_prefix='/mmbot')
app.register_blueprint(mmbot_api_page, url_prefix='/mmbot_api')
mmbot_processor = os.environ.get('MMBOT')
tasks = "mmbot"
rabbitmq_server = os.environ.get('RABBITMQ_SERVER')
rabbitmq_username = os.environ.get('RABBITMQ_USERNAME')
rabbitmq_password = os.environ.get('RABBITMQ_PASSWORD')
if mmbot_processor:
p = Process(target=get_a_task_mq, args=(tasks, call_back, rabbitmq_server, rabbitmq_username,
rabbitmq_password))
p.start()