unify routers, add support for mysql and pgsql tasks

- add new celeryrouters.GvaRouter
- remove LdapRouter and FileRouter
This commit is contained in:
Jan Dittberner 2015-01-01 22:32:37 +01:00
parent e29646a947
commit 546441d499
2 changed files with 8 additions and 16 deletions

1
.gitignore vendored
View file

@ -1,2 +1,3 @@
.*.swp .*.swp
*.pyc *.pyc
.ropeproject/

View file

@ -2,23 +2,14 @@
from __future__ import unicode_literals from __future__ import unicode_literals
class LdapRouter(object): class GvaRouter(object):
def route_for_task(self, task, args=None, kwargs=None): def route_for_task(self, task, args=None, kwargs=None):
if 'ldap' in task: for route in ['ldap', 'file', 'mysql', 'pgsql']:
return {'exchange': 'ldap', if route in task:
return {
'exchange': route,
'exchange_type': 'direct', 'exchange_type': 'direct',
'queue': 'ldap'} 'queue': route,
}
return None 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