我可以使用终端中的命令正常运行芹菜节拍,但是当我在aws中运行时,出现以下错误:
[2019-07-10 11:30:35,166: ERROR/MainProcess] Removing corrupted schedule file 'celerybeat-schedule': error('Bad magic number',)
Traceback (most recent call last):
File "/opt/python/run/venv/local/lib/python3.6/site-packages/kombu/utils/objects.py", line 42, in __get__
return obj.__dict__[self.__name__]
KeyError: 'scheduler'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/python/run/venv/local/lib/python3.6/site-packages/celery/beat.py", line 476, in setup_schedule
self._store = self._open_schedule()
File "/opt/python/run/venv/local/lib/python3.6/site-packages/celery/beat.py", line 466, in _open_schedule
return self.persistence.open(self.schedule_filename, writeback=True)
File "/usr/lib64/python3.6/shelve.py", line 243, in open
return DbfilenameShelf(filename, flag, protocol, writeback)
File "/usr/lib64/python3.6/shelve.py", line 227, in __init__
Shelf.__init__(self, dbm.open(filename, flag), protocol, writeback)
File "/usr/lib64/python3.6/dbm/__init__.py", line 94, in open
return mod.open(file, flag, mode)
_gdbm.error: Bad magic number
有人可以帮我理解怎么了吗?
答案 0 :(得分:1)
摘自site。
Beat需要将任务的最后运行时间存储在本地数据库文件(默认情况下命名为celerybeat-schedule)中,因此需要访问当前目录中的内容,或者可以为此文件指定一个自定义位置:
celery -A proj beat -s /home/celery/var/run/celerybeat-schedule
答案 1 :(得分:0)
我可以用
修复它pip install python3.5-gdbm
答案 2 :(得分:0)
最直接的解决方法就是:
我多年来在AWS上运行Celery beat,到目前为止还没有任何问题。