其他分享
首页 > 其他分享> > celery-demo

celery-demo

作者:互联网

celeryconfig.py

rabbitmq link

from kombu import Queue, Exchange

# 该配置文件基于celery 4.3    http://docs.celeryproject.org/en/latest/userguide/configuration.html#task-settings

broker_url = "amqp://name:passpwd@ip/voiceprint"

timezone = 'Asia/Shanghai' # 设定时间
enable_utc = True # 使用上面设定时间

task_acks_late = True
worker_prefetch_multiplier = 1
#  一次只拿取 一个任务   https://www.v2ex.com/t/343440

include = ["deal.pqueue.tasks_v2", "deal.pqueue.periodic"] # 设置需要导入的模块

# 配置队列
#   最新的rabbitMQ 支持优先级,https://blog.csdn.net/qq_18863573/article/details/53540090
task_queues = (
    Queue(name="task_process",exchange=Exchange("task_process"),routing_key="task_process",queue_arguments={"x-max-priority": 10}),
    Queue(name='single',exchange=Exchange('single')

标签:Queue,task,name,deal,Exchange,process,demo,celery
来源: https://blog.51cto.com/u_14582976/2829351