在一次重启python中的celery-beat任务中,发现celery-beat启动不起来了。报错信息如下:
celery beat v4.1.0 (latentcall) is starting.
__ - ... __ - _
LocalTime -> 2018-04-11 15:04:12
Configuration ->
. broker -> redis://127.0.0.1:9736/4
. loader -> celery.loaders.app.AppLoader
. scheduler -> celery.beat.PersistentScheduler
. db -> celerybeat-schedule
. logfile -> [stderr]@%WARNING
. maxinterval -> 5.00 minutes (300s)
[2018-04-11 15:04:12,478: CRITICAL/MainProcess] beat raised exception : error('cannot add item to database',)
Traceback (most recent call last):
File "/usr/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 "/usr/local/lib/python3.6/shelve.py", line 111, in __getitem__
value = self.cache[key]
KeyError: 'entries'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/celery/beat.py", line 485, in _create_schedule
self._store[str('entries')]
File "/usr/local/lib/python3.6/shelve.py", line 113, in __getitem__
f = BytesIO(self.dict[key.encode(self.keyencoding)])
KeyError: b'entries'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/celery/apps/beat.py", line 107, in start_scheduler
service.start()
File "/usr/local/lib/python3.6/site-packages/celery/beat.py", line 549, in start
humanize_seconds(self.scheduler.max_interval))
File "/usr/local/lib/python3.6/site-packages/kombu/utils/objects.py", line 44, in __get__
value = obj.__dict__[self.__name__] = self.__get(obj)
File "/usr/local/lib/python3.6/site-packages/celery/beat.py", line 593, in scheduler
return self.get_scheduler()
File "/usr/local/lib/python3.6/site-packages/celery/beat.py", line 588, in get_scheduler
lazy=lazy,
File "/usr/local/lib/python3.6/site-packages/celery/beat.py", line 428, in __init__
Scheduler.__init__(self, *args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/celery/beat.py", line 206, in __init__
self.setup_schedule()
File "/usr/local/lib/python3.6/site-packages/celery/beat.py", line 456, in setup_schedule
self._create_schedule()
File "/usr/local/lib/python3.6/site-packages/celery/beat.py", line 489, in _create_schedule
self._store[str('entries')] = {}
File "/usr/local/lib/python3.6/shelve.py", line 125, in __setitem__
self.dict[key.encode(self.keyencoding)] = f.getvalue()
_dbm.error: cannot add item to database