diff --git a/README b/README index 759851432..905b80713 100644 --- a/README +++ b/README @@ -19,9 +19,9 @@ installed via apt-get/pip/easy_install in your system path. Install rabbitmq and carrot: sudo apt-get install rabbitmq-server - sudo rabbitmqctl add_user pandora password + sudo rabbitmqctl add_user pandora box sudo rabbitmqctl add_vhost /pandora - sudo rabbitmqctl set_permissions -p /pandora pandora "^pandora-.*" ".*" ".*" + sudo rabbitmqctl set_permissions -p /pandora pandora ".*" ".*" ".*" update BROKER_* settings in local_settings.py: diff --git a/etc/init/pandora-encoder.conf b/etc/init/pandora-encoding.conf similarity index 64% rename from etc/init/pandora-encoder.conf rename to etc/init/pandora-encoding.conf index 61d2ccded..1c093f04e 100644 --- a/etc/init/pandora-encoder.conf +++ b/etc/init/pandora-encoding.conf @@ -1,7 +1,7 @@ -# pandora background server +# pandora encoding daemon # -description "pandora background server" +description "pandora encoding daemon" start on runlevel [2345] stop on runlevel [!2345] @@ -10,5 +10,5 @@ respawn chdir /srv/pandora/pandora -exec /bin/su pandora -s /usr/bin/python2.6 /srv/pandora/pandora/bin/pandora-encoder +exec /bin/su pandora -s /usr/bin/python2.6 /srv/pandora/pandora/bin/pandora-encoding diff --git a/etc/init/pandora-backgroundtasks.conf b/etc/init/pandora-tasks.conf similarity index 61% rename from etc/init/pandora-backgroundtasks.conf rename to etc/init/pandora-tasks.conf index cc2955d07..25331171e 100644 --- a/etc/init/pandora-backgroundtasks.conf +++ b/etc/init/pandora-tasks.conf @@ -1,7 +1,7 @@ -# pandora background server +# pandora background tasks daemon # -description "pandora background server" +description "pandora background tasks daemon" start on runlevel [2345] stop on runlevel [!2345] @@ -10,5 +10,5 @@ respawn chdir /srv/pandora/pandora -exec /bin/su pandora -s /usr/bin/python2.6 /srv/pandora/pandora/bin/pandora-backgroundtasks +exec /bin/su pandora -s /usr/bin/python2.6 /srv/pandora/pandora/bin/pandora-tasks diff --git a/pandora/backend/management/commands/backgroundtasks.py b/pandora/backend/management/commands/backgroundtasks.py deleted file mode 100644 index 7f48849a6..000000000 --- a/pandora/backend/management/commands/backgroundtasks.py +++ /dev/null @@ -1,22 +0,0 @@ -# -*- coding: utf-8 -*- -# vi:si:et:sw=4:sts=4:ts=4 - -import os -from os.path import join, dirname, basename, splitext, exists - -from django.core.management.base import BaseCommand, CommandError -from django.conf import settings - -from ... import daemon - - -class Command(BaseCommand): - """ - listen to rabbitmq and execute background task. - """ - help = 'listen to rabbitmq and execute background task.' - args = '' - - def handle(self, **options): - daemon.run() - diff --git a/pandora/backend/views.py b/pandora/backend/views.py index 7db4ac723..5298a0748 100644 --- a/pandora/backend/views.py +++ b/pandora/backend/views.py @@ -29,7 +29,7 @@ import oxlib import models import utils -from daemon import send_bg_message +import tasks from oxuser.models import getUserJSON from oxuser.views import api_login, api_logout, api_register, api_contact, api_recover, api_preferences @@ -477,7 +477,7 @@ def api_update(request): f = models.ArchiveFile.get_or_create(archive, oshash) f.update(data) if not f.file.movie: - send_bg_message({'findMovie': f.file.id}) + task.findMovie(f.file.id) #FIXME: only add if it was not in File else: f = q[0] diff --git a/pandora/bin/pandora-encoder b/pandora/bin/pandora-encoding similarity index 88% rename from pandora/bin/pandora-encoder rename to pandora/bin/pandora-encoding index efd91dc8e..09a5d5270 100755 --- a/pandora/bin/pandora-encoder +++ b/pandora/bin/pandora-encoding @@ -17,5 +17,5 @@ sys.path.append(os.path.join(root_dir, project_module)) from django.core.management import execute_manager import settings -execute_manager(settings, ['pandora-encoder', 'encoder']) +execute_manager(settings, ['celeryd', 'celeryd', '-Q' 'encoding']) diff --git a/pandora/bin/pandora-backgroundtasks b/pandora/bin/pandora-task similarity index 88% rename from pandora/bin/pandora-backgroundtasks rename to pandora/bin/pandora-task index 2041410ca..d7738f5e0 100755 --- a/pandora/bin/pandora-backgroundtasks +++ b/pandora/bin/pandora-task @@ -17,5 +17,5 @@ sys.path.append(os.path.join(root_dir, project_module)) from django.core.management import execute_manager import settings -execute_manager(settings, ['backgroundtasks', 'backgroundtasks']) +execute_manager(settings, ['celeryd', 'celeryd', '-Q' 'default']) diff --git a/pandora/settings.py b/pandora/settings.py index 7179038c8..54a482192 100644 --- a/pandora/settings.py +++ b/pandora/settings.py @@ -5,7 +5,7 @@ import os from os.path import join SITENAME = 'Pandora' -URL = 'pandora.Oxdb.org' +URL = 'pan.do/ra' PROJECT_ROOT = os.path.normpath(os.path.dirname(__file__)) @@ -33,6 +33,7 @@ DATABASE_PORT = '' # Set to empty string for default. Not used with #CACHE_BACKEND = 'memcached://127.0.0.1:11211/' #rabbitmq connection settings +CELERY_RESULT_BACKEND = "database" BROKER_HOST = "127.0.0.1" BROKER_PORT = 5672 BROKER_USER = "pandora" @@ -106,6 +107,7 @@ INSTALLED_APPS = ( 'django_extensions', 'devserver', # 'south', + 'djcelery', 'app', 'backend', diff --git a/requirements.txt b/requirements.txt index 82d188885..18c97f97c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,7 +7,8 @@ chardet simplejson -e hg+https://django-ajax-filtered-fields.googlecode.com/hg/#egg=django-ajax-filtered-fields #rabbitmq interface -carrot +-e git+git://github.com/ask/celery.git#egg=celery +django-celery django_extensions -e bzr+http://firefogg.org/dev/python-firefogg/#egg=python-firefogg -e git+git://github.com/dcramer/django-devserver#egg=django_devserver