srj
srj

Reputation: 10121

django celery beat DBAccessError

I am running django+celery with celerybeat, and i am getting this error

.../local/lib/python2.7/site-packages/celery/beat.py", line 367, in setup_schedule
    writeback=True)
  File "/usr/lib/python2.7/shelve.py", line 239, in open
    return DbfilenameShelf(filename, flag, protocol, writeback)
  File "/usr/lib/python2.7/shelve.py", line 223, in __init__
    Shelf.__init__(self, anydbm.open(filename, flag), protocol, writeback)
  File "/usr/lib/python2.7/anydbm.py", line 85, in open
    return mod.open(file, flag, mode)
  File "/usr/lib/python2.7/dbhash.py", line 18, in open
    return bsddb.hashopen(file, flag, mode)
  File "/usr/lib/python2.7/bsddb/__init__.py", line 364, in hashopen
    d.open(file, db.DB_HASH, flags, mode)
DBAccessError: (13, 'Permission denied')
[2014-11-05 06:39:20,901: INFO/MainProcess] mingle: all alone

I used python manage.py celeryd -B to run celery beat. It seems that running the celery worker is not the issue, but the celerybeat worker is not initialising. any suggestions as to where i could find the database which celery is trying to access?

I'm running django=1.5 and django-celery==3.1.10

Upvotes: 13

Views: 5934

Answers (1)

srj
srj

Reputation: 10121

I asked too soon!

answering my own question in case anyone else face the same issue.

The issue was because I did not have write permission in the folder my django project was running.

from the documentation (http://celery.readthedocs.org/en/latest/userguide/periodic-tasks.html#starting-the-scheduler)

Beat needs to store the last run times of the tasks in a local database file (named celerybeat-schedule by default), so it needs access to write in the current directory

fixed the issue by running

python manage.py celeryd -B -s /path/to/where/i/have/write-access/celerybeat-schedule

Hope that this helps someone.

Upvotes: 24

Related Questions