我想路由2个不同的Celery_BROKER_URL
我想将2种不同的芹菜broker_url用于2个不同的IP,并且特定任务应在另一个URL中进行(ex -redis://127.0.0.2:6379)。
环境文件
CELERY_TASK_TRACK_STARTED=True
CELERY_BROKER_URL="redis://127.0.0.1:6379"
芹菜.py
import os
from celery import Celery
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'engine.settings')
app = Celery('engine')
app.config_from_object('django.conf:settings')
# Enable sending the "task-sent" notification.
app.conf.task_send_sent_event=True
app.conf.database_engine_options = {'echo': True}
# load task modules from all registered Django app configs.
app.autodiscover_tasks()
@app.task(bind=True)
def debug_task(self):
print('Request: {0!r}'.format(self.request))
I want to use 2 different CELERY_BROKER_URL for 2 different IP's and specific task should go in the another URL (ex - redis://127.0.0.2:6379).
environment file
CELERY_TASK_TRACK_STARTED=True
CELERY_BROKER_URL="redis://127.0.0.1:6379"
celery.py
import os
from celery import Celery
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'engine.settings')
app = Celery('engine')
app.config_from_object('django.conf:settings')
# Enable sending the "task-sent" notification.
app.conf.task_send_sent_event=True
app.conf.database_engine_options = {'echo': True}
# load task modules from all registered Django app configs.
app.autodiscover_tasks()
@app.task(bind=True)
def debug_task(self):
print('Request: {0!r}'.format(self.request))
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论