芹菜打败不工作

时间:2018-01-04 09:38:13

标签: django celery django-celery celery-task

Celery beat没有正确安排任务并冻结。

Celery配置4.1.0

CELERY_BROKER_URL = 'redis://127.0.0.1:6379'
CELERY_ACCEPT_CONTENT = ['application/json']
CELERY_RESULT_SERIALIZER = 'json'
CELERY_TASK_SERIALIZER = 'json'
CELERY_TIMEZONE = 'Asia/Kolkata'
CELERY_ACCEPT_CONTENT += ['pickle']
CELERYBEAT_SCHEDULE = {
    'testing_msg': {
        'task': 'modules.sms.tasks.testing_message',
        'schedule': crontab(minute=1),
    },
}

tasks.py

@task()
def testing_message(*args, **kwargs):
    SmsAPI().send_sms("Hello Shubham Message Time is {}".format(datetime.now().time()), "958xxxxxx")
    SmsAPI().send_sms("Hello Nishant Message Time is {}".format(datetime.now().time()), "971xxxxxx")

Celery Beat Logs

(Nishant) shubham@shuboy2014:/media/shubham/BC161A021619BDF8/Nishant Project/Project1$ celery -A config beat -l debug
raven settings
celery beat v4.1.0 (latentcall) is starting.
__    -    ... __   -        _
LocalTime -> 2018-01-04 14:57:53
Configuration ->
    . broker -> redis://127.0.0.1:6379//
    . loader -> celery.loaders.app.AppLoader
    . scheduler -> celery.beat.PersistentScheduler
    . db -> celerybeat-schedule
    . logfile -> [stderr]@%DEBUG
    . maxinterval -> 5.00 minutes (300s)
[2018-01-04 14:57:53,139: DEBUG/MainProcess] Setting default socket timeout to 30
[2018-01-04 14:57:53,139: INFO/MainProcess] beat: Starting...
[2018-01-04 14:57:53,334: DEBUG/MainProcess] Current schedule:
<ScheduleEntry: celery.backend_cleanup celery.backend_cleanup() <crontab: 0 4 * * * (m/h/d/dM/MY)>
[2018-01-04 14:57:53,334: DEBUG/MainProcess] beat: Ticking with max interval->5.00 minutes
[2018-01-04 14:57:53,336: DEBUG/MainProcess] beat: Waking up in 5.00 minutes.

任何有用的评论和答案将不胜感激。

0 个答案:

没有答案