简体   繁体   中英

Celery won't resume execution of a task at given ETA

I am running a Celery 4.0.2 app on Python 3.6. I produce a task like this:

eta = datetime.datetime.now() + datetime.timedelta(minutes=15)
task.apply_async(args=args, eta=eta)

The message is unacked in my broker (RabbitMQ) so basically application must have taken it. Logs from application confirm it:

11:05:04 PM worker.1 |  [2017-07-02 23:05:04,029: INFO/MainProcess] Received task: myapp.task[880af074-0bf1-4aa2-a4d0-33dd54cd97b9]  ETA:[2017-07-02 23:18:10+00:00]

Yet 23:18:10 passed and... nothing happened. Task stays unacked, application is not processing it. Why? and how to fix it?

It seems that Celery (by default) is calculating times relative to datetime.utcnow() , not datetime.now() . Try changing that and see if it fixes the problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM