[ckan-changes] commit/ckan: kindly: [task] make paster command and update supervisor to follow
Bitbucket
commits-noreply at bitbucket.org
Wed Nov 9 20:18:45 UTC 2011
1 new commit in ckan:
https://bitbucket.org/okfn/ckan/changeset/c35d368a8d05/
changeset: c35d368a8d05
branch: feature-1371-task-status-logic-layer
user: kindly
date: 2011-11-09 21:18:04
summary: [task] make paster command and update supervisor to follow
affected #: 4 files
diff -r dd577a02dfc8016b04262502b03a267a1225ee0f -r c35d368a8d054fd36fa78049abbda92dc0f2fdde ckan/config/celery-supervisor.conf
--- a/ckan/config/celery-supervisor.conf
+++ b/ckan/config/celery-supervisor.conf
@@ -5,18 +5,13 @@
; symlink or copy this file to /etc/supervisr/conf.d
; change the path/to/virtualenv below to the virtualenv ckan is in.
+
[program:celery]
-; Path to executable, should be path to ckans virtural environment.
-command=/path/to/virtualenv/bin/celeryd --loglevel=INFO
+; Full Path to executable, should be path to virtural environment,
+; Full path to config file too.
-; THIS IS NEEDED IF YOU WANT TO RUN CELERY FROM A VIRTUAL ENVIRONMENT
-; It is the same as doing source bin/activate
-environment=PATH="/path/to/virtualenv/bin"
+command=/path/to/pyenv/bin/paster --plugin=ckan celeryd --config=/path/to/config/testing.ini
-; Path that is changed to from start. Recomend that you put your
-; celeryconfig.py in this directory too.
-
-directory=/path/to/virtualenv/bin
; user that owns virtual environment.
user=ckan
diff -r dd577a02dfc8016b04262502b03a267a1225ee0f -r c35d368a8d054fd36fa78049abbda92dc0f2fdde ckan/config/celeryconfig.py
--- a/ckan/config/celeryconfig.py
+++ /dev/null
@@ -1,19 +0,0 @@
-## Example celery config
-
-## It is recommended that this file be put in the /path/to/virtualenv/lib directory. This way it will definitely get picked up by ckan and the deamons.
-
-#Broker can be whatever you like but can be ckan database too.
-BROKER_BACKEND = "sqlalchemy"
-BROKER_HOST = "postgres://ckan:pass@localhost/ckan.net"
-
-
-#Results backend should be the same as where the ckan database is.
-CELERY_RESULT_DBURI = "postgres://ckan:pass@localhost/ckan.net"
-CELERY_RESULT_BACKEND = "database"
-CELERY_RESULT_SERIALIZER = 'json'
-CELERY_TASK_SERIALIZER = 'json'
-
-
-
-#Inports of all the tasks you need. TODO add extension point to add these.
-CELERY_IMPORTS = ('ckanext.archiver.tasks', 'ckanext.webstorer.tasks')
diff -r dd577a02dfc8016b04262502b03a267a1225ee0f -r c35d368a8d054fd36fa78049abbda92dc0f2fdde ckan/lib/cli.py
--- a/ckan/lib/cli.py
+++ b/ckan/lib/cli.py
@@ -540,6 +540,21 @@
user.delete()
model.repo.commit_and_remove()
print('Deleted user: %s' % username)
+
+class Celery(CkanCommand):
+ '''Run celery deamon
+
+ Usage:
+ celeryd
+ '''
+ min_args = 0
+ summary = __doc__.split('\n')[0]
+ usage = __doc__
+
+ def command(self):
+ os.environ['CKAN_CONFIG'] = os.path.abspath(self.options.config)
+ from ckan.lib.celery_app import celery
+ celery.worker_main(argv=['celeryd', '--loglevel=INFO'])
class Ratings(CkanCommand):
diff -r dd577a02dfc8016b04262502b03a267a1225ee0f -r c35d368a8d054fd36fa78049abbda92dc0f2fdde setup.py
--- a/setup.py
+++ b/setup.py
@@ -63,6 +63,7 @@
notify = ckan.lib.cli:Notification
rights = ckan.lib.authztool:RightsCommand
roles = ckan.lib.authztool:RolesCommand
+ celeryd = ckan.lib.cli:Celery
[console_scripts]
ckan-admin = bin.ckan_admin:Command
Repository URL: https://bitbucket.org/okfn/ckan/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the ckan-changes
mailing list