##// END OF EJS Templates
version bump
version bump

File last commit:

r510:9bedaa07 default
r513:2fa16ec5 rhodecode-0.0.0.8.4 default
Show More
__init__.py
60 lines | 1.5 KiB | text/x-python | PythonLexer
Implemented locking for task, to prevent for running the same tasks,...
r497 from pylons_app.lib.pidlock import DaemonLock, LockHeld
starting celery branch
r467 from vcs.utils.lazy import LazyProperty
Implemented locking for task, to prevent for running the same tasks,...
r497 from decorator import decorator
starting celery branch
r467 import logging
Implemented password reset(forms/models/ tasks) and mailing tasks....
r474 import os
import sys
import traceback
Implemented locking for task, to prevent for running the same tasks,...
r497 from hashlib import md5
starting celery branch
r467 log = logging.getLogger(__name__)
class ResultWrapper(object):
def __init__(self, task):
self.task = task
@LazyProperty
def result(self):
return self.task
Some fixes to summary, and total rewrite of summary graphs implemented more interactive graph....
r487 def run_task(task, *args, **kwargs):
starting celery branch
r467 try:
Some fixes to summary, and total rewrite of summary graphs implemented more interactive graph....
r487 t = task.delay(*args, **kwargs)
log.info('running task %s', t.task_id)
starting celery branch
r467 return t
Some fixes to summary, and total rewrite of summary graphs implemented more interactive graph....
r487 except Exception, e:
Implemented locking for task, to prevent for running the same tasks,...
r497 print e
Some fixes to summary, and total rewrite of summary graphs implemented more interactive graph....
r487 if e.errno == 111:
log.debug('Unnable to connect. Sync execution')
else:
log.error(traceback.format_exc())
starting celery branch
r467 #pure sync version
Some fixes to summary, and total rewrite of summary graphs implemented more interactive graph....
r487 return ResultWrapper(task(*args, **kwargs))
Implemented locking for task, to prevent for running the same tasks,...
r497
simplified task locking, and fixed some bugs for keyworded arguments
r502 def locked_task(func):
def __wrapper(func, *fargs, **fkwargs):
params = list(fargs)
params.extend(['%s-%s' % ar for ar in fkwargs.items()])
Implemented locking for task, to prevent for running the same tasks,...
r497 lockkey = 'task_%s' % \
simplified task locking, and fixed some bugs for keyworded arguments
r502 md5(str(func.__name__) + '-' + \
'-'.join(map(str, params))).hexdigest()
Implemented locking for task, to prevent for running the same tasks,...
r497 log.info('running task with lockkey %s', lockkey)
try:
l = DaemonLock(lockkey)
fixed lockdecrator to return executed function data...
r510 ret = func(*fargs, **fkwargs)
Implemented locking for task, to prevent for running the same tasks,...
r497 l.release()
fixed lockdecrator to return executed function data...
r510 return ret
Implemented locking for task, to prevent for running the same tasks,...
r497 except LockHeld:
log.info('LockHeld')
return 'Task with key %s already running' % lockkey
simplified task locking, and fixed some bugs for keyworded arguments
r502 return decorator(__wrapper, func)
Implemented locking for task, to prevent for running the same tasks,...
r497