You are having trouble running scheduled tasks at a specified future time when using Celery and RabbitMQ.
Using Django on Heroku Server with RabbitMQ Add-in.
Problem:
Sometimes tasks do not start at all, sometimes they start, but the time at which they work is turned off by a significant margin (for example, after an hour).
An example of a task that has not been completed:
When I try to run a task with a countdown or ETA, it never runs. This is an example of an ETA task that did not start:
>>> dummy_task.apply_async(eta=datetime.datetime.now() + timedelta(seconds=60))
<AsyncResult: 03001c1c-329e-46a3-8180-b115688e1865>
Resulting Log:
2012-07-24T14: 03: 08 + 00: 00 app [scheduler.1]: [2012-07-24 10: 03: 08,909: INFO / MainProcess]
Got task from broker: events.tasks.dummy_task [910ff406-d51c-4c29-bdd1-fec1a8168c12]
eta: [2012-07-24 10: 04: 08.819528 + 00: 00]
After a minute, nothing happens. unacknowledged message countin my management console, Herobu RabbitMQ increases by one and stays there.
It works:
I made sure that the celery task is registered correctly, and that RabbitMQ is configured to perform tasks, checking that I can start the task using the delay () method.
>>> dummy_task.delay()
<AsyncResult: 1285ff04-bccc-46d9-9801-8bc9746abd1c>
Resulting Log:
2012-07-24T14: 29: 26 + 00: 00 app [worker.1]: [2012-07-24 10: 29: 26,513: INFO / MainProcess]
Got task from broker: events.tasks.dummy_task [1285ff04-bccc-46d9-9801-8bc9746abd1c]
....
2012-07-24T14: 29: 26 + 00: 00 app [worker.1]: [2012-07-24 10: 29: 26,571: INFO / MainProcess]
Task events.tasks.dummy_task [1285ff04-bccc-46d9-9801-8bc9746abd1c]
succeeded in 0.0261888504028s: None
Any help on this would be greatly appreciated. Many thanks!