Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 945
srj Avatar asked Nov 05 '14 11:11

srj


People also ask

What is Django celery beat?

Using django-celery-beatThis extension enables the user to store periodic tasks in a Django database and manage the tasks using the Django Admin interface. Use the following steps to install django-celery-beat in the simpletask project.

What is celery beat?

celery beat is a scheduler. It kicks off tasks at regular intervals, which are then executed by the worker nodes available in the cluster. By default the entries are taken from the CELERYBEAT_SCHEDULE setting, but custom stores can also be used, like storing the entries in an SQL database.

What is Django celery used for?

It allows you to offload work from your Python app. Once you integrate Celery into your app, you can send time-intensive tasks to Celery's task queue. That way, your web app can continue to respond quickly to users while Celery completes expensive operations asynchronously in the background.


1 Answers

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.

like image 82
srj Avatar answered Oct 19 '22 03:10

srj