Helo,我使用django-celery-beat在数据库中创建了一个定期任务
然后尝试使用下一个命令运行celery with beat
celery -A proj worker -B -l info
但是不要把任务送到芹菜上
添加调试级别日志,也许有人知道如何修复节拍。
[2018-01-21 21:09:13,118: DEBUG/MainProcess] | Worker: Starting Beat
[2018-01-21 21:09:13,120: DEBUG/MainProcess] ^-- substep ok
[2018-01-21 21:09:13,121: DEBUG/MainProcess] | Worker: Starting Hub
[2018-01-21 21:09:13,121: DEBUG/MainProcess] ^-- substep ok
[2018-01-21 21:09:13,121: DEBUG/MainProcess] | Worker: Starting Pool
[2018-01-21 21:09:13,132: INFO/Beat] beat: Starting...
[2018-01-21 21:09:13,135: DEBUG/Beat] DatabaseScheduler: initial read
[2018-01-21 21:09:13,135: INFO/Beat] Writing entries...
[2018-01-21 21:09:13,147: DEBUG/Beat] DatabaseScheduler: Fetching database schedule
[2018-01-21 21:09:13,213: DEBUG/Beat] Current schedule:
<ModelEntry: celery.backend_cleanup celery.backend_cleanup(*[], **{}) <crontab: 0 4 * * * (m/h/d/dM/MY)>>
<ModelEntry: 1 searcher.tasks.get_character_info(*{'id': 4}, **{'id': 4}) <freq: 1.00 minute>>
[2018-01-21 21:09:13,245: DEBUG/Beat] beat: Ticking with max interval->5.00 seconds
[2018-01-21 21:09:13,272: DEBUG/Beat] beat: Waking up in 5.00 seconds.
[2018-01-21 21:09:13,341: DEBUG/MainProcess] ^-- substep ok
[2018-01-21 21:09:13,342: DEBUG/MainProcess] | Worker: Starting Consumer
[2018-01-21 21:09:13,342: DEBUG/MainProcess] | Consumer: Starting Connection
[2018-01-21 21:09:13,356: INFO/MainProcess] Connected to redis://localhost:6379//
[2018-01-21 21:09:13,356: DEBUG/MainProcess] ^-- substep ok
[2018-01-21 21:09:13,356: DEBUG/MainProcess] | Consumer: Starting Events
[2018-01-21 21:09:13,367: DEBUG/MainProcess] ^-- substep ok
[2018-01-21 21:09:13,367: DEBUG/MainProcess] | Consumer: Starting Heart
[2018-01-21 21:09:13,370: DEBUG/MainProcess] ^-- substep ok
[2018-01-21 21:09:13,370: DEBUG/MainProcess] | Consumer: Starting Mingle
[2018-01-21 21:09:13,371: INFO/MainProcess] mingle: searching for neighbors
[2018-01-21 21:09:14,397: INFO/MainProcess] mingle: all alone
[2018-01-21 21:09:14,397: DEBUG/MainProcess] ^-- substep ok
[2018-01-21 21:09:14,397: DEBUG/MainProcess] | Consumer: Starting Gossip
[2018-01-21 21:09:14,399: DEBUG/MainProcess] ^-- substep ok
[2018-01-21 21:09:14,399: DEBUG/MainProcess] | Consumer: Starting Tasks
[2018-01-21 21:09:14,404: DEBUG/MainProcess] ^-- substep ok
[2018-01-21 21:09:14,404: DEBUG/MainProcess] | Consumer: Starting Control
[2018-01-21 21:09:14,407: DEBUG/MainProcess] ^-- substep ok
[2018-01-21 21:09:14,407: DEBUG/MainProcess] | Consumer: Starting event loop
[2018-01-21 21:09:14,407: DEBUG/MainProcess] | Worker: Hub.register Pool...
[2018-01-21 21:09:14,409: WARNING/MainProcess] /home/work/board/lib/python3.5/site-packages/celery/fixups/django.py:202: UserWarning: Using settings.DEBUG leads to a memory leak, never use this setting in production environments!
warnings.warn('Using settings.DEBUG leads to a memory leak, never '
[2018-01-21 21:09:14,409: INFO/MainProcess] celery@work-Lenovo-G580 ready.
[2018-01-21 21:09:14,409: DEBUG/MainProcess] basic.qos: prefetch_count->16
[2018-01-21 21:09:18,276: DEBUG/Beat] beat: Synchronizing schedule...
[2018-01-21 21:09:18,276: INFO/Beat] Writing entries...
[2018-01-21 21:09:18,280: DEBUG/Beat] beat: Waking up in 5.00 seconds.
[2018-01-21 21:09:23,286: DEBUG/Beat] beat: Waking up in 5.00 seconds.
[2018-01-21 21:09:28,290: DEBUG/Beat] beat: Waking up in 5.00 seconds.
[2018-01-21 21:09:33,298: DEBUG/Beat] beat: Waking up in 5.00 seconds.
[2018-01-21 21:09:38,301: DEBUG/Beat] beat: Waking up in 5.00 seconds.
[2018-01-21 21:09:43,308: DEBUG/Beat] beat: Waking up in 5.00 seconds.
[2018-01-21 21:09:48,314: DEBUG/Beat] beat: Waking up in 5.00 seconds.
[2018-01-21 21:09:53,318: DEBUG/Beat] beat: Waking up in 5.00 seconds.
[2018-01-21 21:09:58,322: DEBUG/Beat] beat: Waking up in 5.00 seconds.
[2018-01-21 21:10:03,329: DEBUG/Beat] beat: Waking up in 5.00 seconds.
[2018-01-21 21:10:08,336: DEBUG/Beat] beat: Waking up in 5.00 seconds.
[2018-01-21 21:10:13,342: DEBUG/Beat] beat: Waking up in 5.00 seconds.
[2018-01-21 21:10:18,345: DEBUG/Beat] beat: Waking up in 5.00 seconds.
[2018-01-21 21:10:23,349: DEBUG/Beat] beat: Waking up in 5.00 seconds.
[2018-01-21 21:10:28,357: DEBUG/Beat] beat: Waking up in 5.00 seconds.
[2018-01-21 21:10:33,364: DEBUG/Beat] beat: Waking up in 5.00 seconds.
[2018-01-21 21:10:38,370: DEBUG/Beat] beat: Waking up in 5.00 seconds.
[2018-01-21 21:10:43,379: DEBUG/Beat] beat: Waking up in 5.00 seconds.
[2018-01-21 21:10:48,386: DEBUG/Beat] beat: Waking up in 5.00 seconds.
[2018-01-21 21:10:53,395: DEBUG/Beat] beat: Waking up in 5.00 seconds.
[2018-01-21 21:10:58,401: DEBUG/Beat] beat: Waking up in 5.00 seconds.
[2018-01-21 21:11:03,409: DEBUG/Beat] beat: Waking up in 5.00 seconds.
[2018-01-21 21:11:08,416: DEBUG/Beat] beat: Waking up in 5.00 seconds.
[2018-01-21 21:11:13,422: DEBUG/Beat] beat: Waking up in 5.00 seconds.
正如你所看到的那样,1分钟过去了,节拍没有发送任何东西。
答案 0 :(得分:0)
我发现答案需要指定CELERY_TIMEZONE
到UTC