django芹菜只调用2个apply_async任务中的1个

时间:2016-04-21 15:22:32

标签: python django celery django-celery

我需要调用以下2个apply_async任务:

escalate.apply_async((e.id), countdown=3)
escalate.apply_async((e.id), countdown=3)

我的任务实现如下:

@app.task
def escalate(id, group):

      escalation_email, created = EscalationEmail.objects.get_or_create()
      escalation_email.send()

    return 'sup email sent'

我使用以下命令运行工作:

celery -A proj worker -l info --concurrency=10

问题在于,当我看到工人时,只收到1个任务,然后只有1个成功。此外,只有1封电子邮件发送。

似乎大多数情况下第二次升级任务都会运行。

如何确保这些任务在100%的时间内可靠地启动?

1 个答案:

答案 0 :(得分:0)

问题是我没有选择一个队列来将任务与。{/ p>相关联

相关问题