##// END OF EJS Templates
fixes issue #197 Relative paths for pidlocks
marcink -
r1354:ed309b1f beta
parent child Browse files
Show More
@@ -28,6 +28,7 b' import sys'
28 28 import socket
29 29 import traceback
30 30 import logging
31 from os.path import dirname as dn, join as jn
31 32
32 33 from hashlib import md5
33 34 from decorator import decorator
@@ -85,7 +86,7 b' def __get_lockkey(func, *fargs, **fkwarg'
85 86
86 87 func_name = str(func.__name__) if hasattr(func, '__name__') else str(func)
87 88
88 lockkey = 'task_%s' % \
89 lockkey = 'task_%s.lock' % \
89 90 md5(func_name + '-' + '-'.join(map(str, params))).hexdigest()
90 91 return lockkey
91 92
@@ -93,9 +94,11 b' def __get_lockkey(func, *fargs, **fkwarg'
93 94 def locked_task(func):
94 95 def __wrapper(func, *fargs, **fkwargs):
95 96 lockkey = __get_lockkey(func, *fargs, **fkwargs)
97 lockkey_path = dn(dn(dn(os.path.abspath(__file__))))
98
96 99 log.info('running task with lockkey %s', lockkey)
97 100 try:
98 l = DaemonLock(lockkey)
101 l = DaemonLock(jn(lockkey_path, lockkey))
99 102 ret = func(*fargs, **fkwargs)
100 103 l.release()
101 104 return ret
@@ -28,6 +28,7 b' from celery.decorators import task'
28 28 import os
29 29 import traceback
30 30 import logging
31 from os.path import dirname as dn, join as jn
31 32
32 33 from time import mktime
33 34 from operator import itemgetter
@@ -100,9 +101,11 b' def get_commits_stats(repo_name, ts_min_'
100 101
101 102 lockkey = __get_lockkey('get_commits_stats', repo_name, ts_min_y,
102 103 ts_max_y)
104 lockkey_path = dn(dn(dn(dn(os.path.abspath(__file__)))))
105 print jn(lockkey_path, lockkey)
103 106 log.info('running task with lockkey %s', lockkey)
104 107 try:
105 lock = DaemonLock(lockkey)
108 lock = l = DaemonLock(jn(lockkey_path, lockkey))
106 109
107 110 #for js data compatibilty cleans the key for person from '
108 111 akc = lambda k: person(k).replace('"', "")
@@ -99,7 +99,7 b' class MakeIndex(BasePasterCommand):'
99 99 from rhodecode.lib.pidlock import LockHeld, DaemonLock
100 100 from rhodecode.lib.indexers.daemon import WhooshIndexingDaemon
101 101 try:
102 l = DaemonLock()
102 l = DaemonLock(file=jn(dn(dn(index_location)), 'make_index.lock'))
103 103 WhooshIndexingDaemon(index_location=index_location,
104 104 repo_location=repo_location,
105 105 repo_list=repo_list)\
@@ -29,6 +29,7 b' import datetime'
29 29 import traceback
30 30 import paste
31 31 import beaker
32 from os.path import dirname as dn, join as jn
32 33
33 34 from paste.script.command import Command, BadCommand
34 35
@@ -470,7 +471,7 b' def create_test_index(repo_location, ful'
470 471 shutil.rmtree(index_location)
471 472
472 473 try:
473 l = DaemonLock()
474 l = DaemonLock(file=jn(dn(dn(index_location)), 'make_index.lock'))
474 475 WhooshIndexingDaemon(index_location=index_location,
475 476 repo_location=repo_location)\
476 477 .run(full_index=full_index)
General Comments 0
You need to be logged in to leave comments. Login now