comparison rhodecode/lib/celerylib/__init__.py @ 1723:64e91067b996 beta

- refactoring to overcome poor usage of global pylons config - db transaction fixes - fixed tests - garden
author Marcin Kuzminski <marcin@python-works.com>
date Sat, 26 Nov 2011 02:16:21 +0200
parents 2755c11c90d8
children 89efedac4e6c
comparison
equal deleted inserted replaced
1722:e7eef7a1db6a 1723:64e91067b996
30 import logging 30 import logging
31 from os.path import dirname as dn, join as jn 31 from os.path import dirname as dn, join as jn
32 32
33 from hashlib import md5 33 from hashlib import md5
34 from decorator import decorator 34 from decorator import decorator
35 from pylons import config
36 35
37 from vcs.utils.lazy import LazyProperty 36 from vcs.utils.lazy import LazyProperty
38 37 from rhodecode import CELERY_ON
39 from rhodecode.lib import str2bool, safe_str 38 from rhodecode.lib import str2bool, safe_str
40 from rhodecode.lib.pidlock import DaemonLock, LockHeld 39 from rhodecode.lib.pidlock import DaemonLock, LockHeld
41 40
42 from celery.messaging import establish_connection 41 from celery.messaging import establish_connection
43 42
44 43
45 log = logging.getLogger(__name__) 44 log = logging.getLogger(__name__)
46 45
47 try: 46
48 CELERY_ON = str2bool(config['app_conf'].get('use_celery'))
49 except KeyError:
50 CELERY_ON = False
51 47
52 48
53 class ResultWrapper(object): 49 class ResultWrapper(object):
54 def __init__(self, task): 50 def __init__(self, task):
55 self.task = task 51 self.task = task