【发布时间】:2018-11-20 22:58:18
【问题描述】:
我们正在使用 Celery 4.2.1 和 Redis,并为我们的任务设置了全局软超时和硬超时。我们所有的自定义任务都旨在保持在限制范围内,但每天内置任务 backend_cleanup 任务最终都会因超时而被强制终止。
我宁愿不必为了适应内置的 Celery 任务而提高我们的全局超时。有没有办法直接设置这些内置任务的超时时间?
我找不到任何关于此的文档,甚至找不到遇到相同问题的人。
相关来源来自celery/app/builtins.py:
@connect_on_app_finalize
def add_backend_cleanup_task(app):
"""Task used to clean up expired results.
If the configured backend requires periodic cleanup this task is also
automatically configured to run every day at 4am (requires
:program:`celery beat` to be running).
"""
@app.task(name='celery.backend_cleanup', shared=False, lazy=False)
def backend_cleanup():
app.backend.cleanup()
return backend_cleanup
【问题讨论】:
标签: celery celerybeat