【问题标题】:Celery - Testing - Which queue did the job go toCelery - 测试 - 工作去了哪个队列
【发布时间】:2014-03-21 21:53:55
【问题描述】:

简单的问题。当我定义了多个队列时,如何确定作业进入哪个队列。虽然我知道我说去优先级队列 - 我如何检查是否确实如此?

【问题讨论】:

    标签: celery django-celery djcelery


    【解决方案1】:

    有几种方法可以最终找出答案。虽然它正在处理执行此操作的最佳方法 就是使用celery中的工具。对于给定的 task_id 执行此操作。

    from celery.app import app_or_default
    
    app = app_or_default()
    inspect = app.control.inspect()
    pprint.pprint(inspect.query_task([task_id]))
    
    {u'celery@adeline.xxx.com':
        {u'ebe2d165-92f6-4c81-bbf5-b2644e0dbcaf':
            [u'reserved',
                {u'acknowledged': False,
                 u'args': u'[]',
                 u'delivery_info': {u'exchange': u'celery',
                                    u'priority': None,
                                    u'redelivered': False,
                                    u'routing_key': u'celery'},
                 u'hostname': u'celery@adeline.xxx.com',    
                 u'id': u'ebe2d165-92f6-4c81-bbf5-b2644e0dbcaf',
                 u'kwargs': u"{'status_ids': [5072L, 7643L]}",
                 u'name': u'apps.home.tasks.update_home_stats',
                 u'time_start': None,
                 u'worker_pid': None}]}}    
    

    delivery_info 告诉您exchange 是队列名称。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-02-18
      • 1970-01-01
      • 1970-01-01
      • 2018-07-18
      • 2012-05-24
      相关资源
      最近更新 更多