我安装Celery
为Windows服务。我的代码动作* .pid和芹菜日志文件到另一个目录,但三个文件(celerybeat-schedule.bak
,celerybeat-schedule.dir
,celerybeat-schedule.dat
)这我不能动弹。
我使用以下代码更改其他文件的默认路径:
command = '"{celery_path}" -A {proj_dir} beat -f "{log_path}" -l info --pidfile="{pid_path}" '.format(
celery_path=os.path.join(PYTHONSCRIPTPATH, 'celery.exe'),
proj_dir=PROJECTDIR,
# log_path_1=os.path.join(INSTDIR,'celery_2.log')),
log_path=os.path.join(tmpdir,'celery_'+cur_date_time+'.log'),
pid_path = os.path.join(tmpdir,'celerybeat_'+cur_date_time+'.pid'))
如何更改Celery Beat Service的默认路径?
如果执行了celery -A your.project.app beat --help
,它将打印出非常有用的CLI帮助,您可以在其中找到问题的解决方案- -s <path to the scheduler database file>
标志。
-s SCHEDULE, --schedule SCHEDULE
Path to the schedule database. Defaults to celerybeat-
schedule. The extension '.db' may be appended to the
filename. Default is celerybeat-schedule.
您要做的就是将时间表数据库文件的完整路径传递给Celery beat流程。例:-s C:/services/celery/celerybeat-schedule.db
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句