今天我收到了一封来自 Celery 的错误电子邮件,有人可以解释一下吗?可能我该如何解决超时问题?这将非常有帮助,谢谢。
PS 尽管有这个错误,我的消息似乎已经发送,这也是正确的吗?
错误:
Task Request to Process with id 65123935-b190-4718-9ed0-fb863359f27f
raised exception:
'TimeLimitExceeded(300.0,)'
Task was called with args: (<Batch: Batch object>,) kwargs: {}.
The contents of the full traceback was:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/billiard/pool.py", line 496, in on_hard_timeout
raise TimeLimitExceeded(job._timeout)
TimeLimitExceeded: TimeLimitExceeded(300.0,)
--
Just to let you know,
py-celery at w1.ip-10-32-53-113.
任务:
class ProcessRequests(Task):
name = "Request to Process"
max_retries = 1
default_retry_delay = 3
def run(self, batch):
# Only run this task on non-scheduled tasks
if batch.status != "Scheduled":
q = Contact.objects.filter(contact_owner=batch.user)
if batch.group == None:
q = q.filter(id=batch.contact_id)
else:
q = q.filter(group=batch.group)
for e in q:
msg = Message.objects.create(
recipient_number=e.mobile,
content=batch.content,
sender=e.contact_owner,
billee=batch.user,
sender_name=batch.sender_name
)
gateway = Gateway.objects.get(pk=2)
msg.send(gateway)