Celery 允许您在同一进程中运行 worker 和 beat(主要用于开发目的)。查看以下帮助celery worker
:
> celery worker -h
...
Embedded Beat Options:
-B, --beat Also run the celery beat periodic task scheduler. Please note that there must only be
one instance of this service. .. note:: -B is meant to be used for development
purposes. For production environment, you need to start celery beat separately.
-s SCHEDULE_FILENAME, --schedule-filename SCHEDULE_FILENAME, --schedule SCHEDULE_FILENAME
Path to the schedule database if running with the -B option. Defaults to celerybeat-
schedule. The extension ".db" may be appended to the filename. Apply optimization
profile. Supported: default, fair
--scheduler SCHEDULER
Scheduler class to use. Default is celery.beat.PersistentScheduler
因此,组合命令,包括您对django
调度程序的使用,将如下所示:
celery -A prj worker --beat --scheduler django --loglevel=info