use celery routers from gvacommon
This commit is contained in:
parent
70045771c9
commit
672a3bb622
3 changed files with 4 additions and 22 deletions
|
@ -1,6 +1,8 @@
|
||||||
Changelog
|
Changelog
|
||||||
=========
|
=========
|
||||||
|
|
||||||
|
* :support:`-` use celery routers from gvacommon
|
||||||
|
|
||||||
* :release:`0.1.3 <2014-12-26>`
|
* :release:`0.1.3 <2014-12-26>`
|
||||||
* :support:`-` add celery routing for file server tasks
|
* :support:`-` add celery routing for file server tasks
|
||||||
|
|
||||||
|
|
|
@ -291,8 +291,8 @@ CELERY_RESULT_BACKEND = 'amqp'
|
||||||
CELERY_RESULT_PERSISTENT = True
|
CELERY_RESULT_PERSISTENT = True
|
||||||
CELERY_TASK_RESULT_EXPIRES = None
|
CELERY_TASK_RESULT_EXPIRES = None
|
||||||
CELERY_ROUTES = (
|
CELERY_ROUTES = (
|
||||||
'osusers.tasks.LdapRouter',
|
'gvacommon.celeryrouters.LdapRouter',
|
||||||
'osusers.tasks.FileRouter',
|
'gvacommon.celeryrouters.FileRouter',
|
||||||
)
|
)
|
||||||
CELERY_ACCEPT_CONTENT = ['pickle', 'yaml', 'json']
|
CELERY_ACCEPT_CONTENT = ['pickle', 'yaml', 'json']
|
||||||
CELERY_TASK_SERAILIZER = 'json'
|
CELERY_TASK_SERAILIZER = 'json'
|
||||||
|
|
|
@ -21,26 +21,6 @@ from ldapentities.models import (
|
||||||
_logger = get_task_logger(__name__)
|
_logger = get_task_logger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class LdapRouter(object):
|
|
||||||
|
|
||||||
def route_for_task(self, task, args=None, kwargs=None):
|
|
||||||
if 'ldap' in task:
|
|
||||||
return {'exchange': 'ldap',
|
|
||||||
'exchange_type': 'direct',
|
|
||||||
'queue': 'ldap'}
|
|
||||||
return None
|
|
||||||
|
|
||||||
|
|
||||||
class FileRouter(object):
|
|
||||||
|
|
||||||
def route_for_task(self, task, args=None, kwargs=None):
|
|
||||||
if 'file' in task:
|
|
||||||
return {'exchange': 'file',
|
|
||||||
'exchange_type': 'direct',
|
|
||||||
'queue': 'file'}
|
|
||||||
return None
|
|
||||||
|
|
||||||
|
|
||||||
@shared_task
|
@shared_task
|
||||||
def create_ldap_group(groupname, gid, descr):
|
def create_ldap_group(groupname, gid, descr):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in a new issue