[英]celery task scheduled but not executed at ETA
I have my celery configured as following:我的芹菜配置如下:
# create context tasks in celery
celery = Celery(
__name__,
# redis
backend=app.config['CELERY_RESULT_BACKEND'],
broker=app.config['CELERY_BROKER_URL'],
include=['app.celery_tasks.tasks']
)
celery.conf.timezone = 'US/Pacific'
celery.conf.broker_transport_options = {'visibility_timeout': 3600*24}
celery.conf.task_routes = {
'tasks.periodic': {
'queue': 'periodic',
'routing_key': 'tasks.periodic'
},
'tasks.generate_report': {
'queue': 'report',
'routing_key': 'tasks.generate_report'
}
}
Then I'm using this helper method to get eta for all my report tasks然后我使用这个辅助方法来获取我所有报告任务的 eta
def get_eta_time(time_d=8):
tz = timezone('US/Pacific')
ct = datetime.now(tz=tz)
eta = ct + timedelta(hours=time_d)
return eta
The thing I'm encountering is I can see the tasks are scheduled using the celery control but they are not executed when the eta arrives.我遇到的事情是我可以看到任务是使用 celery 控件安排的,但是当 eta 到达时它们没有执行。 However, when I tried to restart my celery workers, these tasks got picked up immediately.然而,当我试图重新启动我的 celery worker 时,这些任务立即得到了执行。 Is there anything I missed in my celery config?我的芹菜配置中有什么我错过的吗?
My tasks are triggered as following:我的任务触发如下:
eta = get_eta_time()
generate_report.apply_async(args=(log_location, repetition_count+1), queue='report', eta=eta)
My periodical queue works as expected, but my report queue is not making any sense to me.我的定期队列按预期工作,但我的报告队列对我没有任何意义。
Turned out to be some hardware issue.原来是一些硬件问题。 I switch to a different machine and it is working now.我切换到另一台机器,它现在正在工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.