【问题标题】:Get list of pending Celery jobs when no workers在没有工人时获取待处理的 Celery 工作列表
【发布时间】:2020-09-11 10:16:33
【问题描述】:

我想我一定错过了什么。在我的 django 服务器上,我执行以下操作:

inspector = app.control.inspect()

for element in list:
    result = app.send_task("workerTasks.do_processing_task", args=[element, "spd"], queue="cloud")

scheduled = inspector.scheduled()
reserved = inspector.reserved()
active = inspector.active()

print("-- SCHEDULED")
print(scheduled)

print("-- RESERVED")
print(reserved)

print("-- ACTIVE")
print(active)

global_helper.execute_commands(["sudo rabbitmqctl list_queues"])

global_helper.execute_commands(["celery inspect active_queues"])

(不好意思打印,这是远程的,我还没有设置远程调试)

没有工人连接到服务器,我得到这个输出:

-- SCHEDULED
None
-- RESERVED
None
-- ACTIVE
None
     [  sudo rabbitmqctl list_queues  ]
Listing queues ...
     [  celery inspect active_queues  ]
Error: No nodes replied within time constraint.

所以看起来所有这些工具都需要工作在某个地方的工人身上。

所以我的问题是,我如何查看仍在等待工人接手的任务?

(我已验证 app.send_task 已被调用 127 次)

【问题讨论】:

    标签: python django celery


    【解决方案1】:

    Celery 不提供此功能(可能有充分的理由),因此您需要使用您的经纪人设施来找出您想知道的内容。这是RedisRabbitMQ 的方法。

    【讨论】:

      猜你喜欢
      • 2021-09-08
      • 1970-01-01
      • 2017-08-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-08-15
      • 2021-12-12
      • 1970-01-01
      相关资源
      最近更新 更多