-
Notifications
You must be signed in to change notification settings - Fork 174
Expand file tree
/
Copy pathceleryconfig.py
More file actions
executable file
·26 lines (17 loc) · 900 Bytes
/
celeryconfig.py
File metadata and controls
executable file
·26 lines (17 loc) · 900 Bytes
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
26
from urllib.parse import quote_plus
from kombu.serialization import register
from bson.json_util import dumps, loads
from celery import signals
from fame.common.config import fame_config
from fame.core import fame_init
register('json_util', dumps, loads, content_type='application/json', content_encoding='utf-8')
MONGO = 'mongodb://{}:{}/{}'.format(fame_config.mongo_host, fame_config.mongo_port, fame_config.mongo_db)
if fame_config.mongo_user and fame_config.mongo_password:
MONGO = 'mongodb://{}:{}@{}:{}/{}'.format(fame_config.mongo_user, quote_plus(fame_config.mongo_password), fame_config.mongo_host, fame_config.mongo_port, fame_config.mongo_db)
broker_url = MONGO
accept_content = ['json_util']
task_serializer = 'json_util'
imports = ('fame.core.analysis', 'fame.core.repository')
def connect_to_db(**kwargs):
fame_init()
signals.worker_process_init.connect(connect_to_db)