@@ -28,6 +28,7 @@ import sys
import socket
import traceback
import logging
from os.path import dirname as dn, join as jn
from hashlib import md5
from decorator import decorator
@@ -85,7 +86,7 @@ def __get_lockkey(func, *fargs, **fkwarg
func_name = str(func.__name__) if hasattr(func, '__name__') else str(func)
lockkey = 'task_%s' % \
lockkey = 'task_%s.lock' % \
md5(func_name + '-' + '-'.join(map(str, params))).hexdigest()
return lockkey
@@ -93,9 +94,11 @@ def __get_lockkey(func, *fargs, **fkwarg
def locked_task(func):
def __wrapper(func, *fargs, **fkwargs):
lockkey = __get_lockkey(func, *fargs, **fkwargs)
lockkey_path = dn(dn(dn(os.path.abspath(__file__))))
log.info('running task with lockkey %s', lockkey)
try:
l = DaemonLock(lockkey)
l = DaemonLock(jn(lockkey_path, lockkey))
ret = func(*fargs, **fkwargs)
l.release()
return ret
@@ -28,6 +28,7 @@ from celery.decorators import task
import os
from time import mktime
from operator import itemgetter
@@ -100,9 +101,11 @@ def get_commits_stats(repo_name, ts_min_
lockkey = __get_lockkey('get_commits_stats', repo_name, ts_min_y,
ts_max_y)
lockkey_path = dn(dn(dn(dn(os.path.abspath(__file__)))))
print jn(lockkey_path, lockkey)
lock = DaemonLock(lockkey)
lock = l = DaemonLock(jn(lockkey_path, lockkey))
#for js data compatibilty cleans the key for person from '
akc = lambda k: person(k).replace('"', "")
@@ -99,7 +99,7 @@ class MakeIndex(BasePasterCommand):
from rhodecode.lib.pidlock import LockHeld, DaemonLock
from rhodecode.lib.indexers.daemon import WhooshIndexingDaemon
l = DaemonLock()
l = DaemonLock(file=jn(dn(dn(index_location)), 'make_index.lock'))
WhooshIndexingDaemon(index_location=index_location,
repo_location=repo_location,
repo_list=repo_list)\
@@ -29,6 +29,7 @@ import datetime
import paste
import beaker
from paste.script.command import Command, BadCommand
@@ -470,7 +471,7 @@ def create_test_index(repo_location, ful
shutil.rmtree(index_location)
repo_location=repo_location)\
.run(full_index=full_index)
Status change: