comparison pylons_app/lib/celerylib/__init__.py @ 506:d5efb83590ef

fixed lock decorator bug which didn't release the lock after func execution and rewrote the pidlock a little with Ask Solem suggestions! added tredning languages stats
author Marcin Kuzminski <marcin@python-works.com>
date Mon, 27 Sep 2010 02:17:03 +0200
parents ac32a026c306
children 9bedaa073c23
comparison
equal deleted inserted replaced
505:5aba7adff196 506:d5efb83590ef
40 md5(str(func.__name__) + '-' + \ 40 md5(str(func.__name__) + '-' + \
41 '-'.join(map(str, params))).hexdigest() 41 '-'.join(map(str, params))).hexdigest()
42 log.info('running task with lockkey %s', lockkey) 42 log.info('running task with lockkey %s', lockkey)
43 try: 43 try:
44 l = DaemonLock(lockkey) 44 l = DaemonLock(lockkey)
45 return func(*fargs, **fkwargs) 45 func(*fargs, **fkwargs)
46 l.release() 46 l.release()
47 except LockHeld: 47 except LockHeld:
48 log.info('LockHeld') 48 log.info('LockHeld')
49 return 'Task with key %s already running' % lockkey 49 return 'Task with key %s already running' % lockkey
50 50