27 lines
624 B
Python
27 lines
624 B
Python
from .config import tiktok_config
|
|
from .utils import kombu_register_json_dataclass
|
|
|
|
import celery
|
|
import redis
|
|
|
|
c = tiktok_config()
|
|
|
|
app = celery.Celery(
|
|
__name__,
|
|
broker=c.celery_broker,
|
|
result_backend=c.celery_result_backend,
|
|
accept_content=['json-dataclass'],
|
|
task_serializer='json-dataclass',
|
|
result_serializer='json-dataclass',
|
|
)
|
|
|
|
kombu_register_json_dataclass()
|
|
|
|
|
|
app.autodiscover_tasks(c.celery_imports)
|
|
|
|
redis = dict(
|
|
broker=redis.Redis(host='redis', db=int(c.celery_broker.split('/')[-1])),
|
|
result_backend=redis.Redis(host='redis', db=int(c.celery_result_backend.split('/')[-1])),
|
|
)
|