##// END OF EJS Templates
fixed cache problem,...
marcink -
r777:aac24db5 beta
parent child Browse files
Show More
@@ -131,6 +131,22 b' information check out the RhodeCode logs'
131 131 ldap will be saved there.
132 132
133 133
134
135 Setting Up Celery
136 -----------------
137
138 Since version 1.1 celery is configured by the rhodecode ini configuration files
139 simply set use_celery=true in the ini file then add / change the configuration
140 variables inside the ini file.
141
142 Remember that the ini files uses format with '.' not with '_' like celery
143 so for example setting `BROKER_HOST` in celery means setting `broker.host` in
144 the config file.
145
146 In order to make start using celery run::
147 paster celeryd <configfile.ini>
148
149
134 150 Nginx virtual host example
135 151 --------------------------
136 152
@@ -21,6 +21,31 b' from vcs.backends import get_repo'
21 21
22 22 from sqlalchemy import engine_from_config
23 23
24 #set cache regions for beaker so celery can utilise it
25 def add_cache(settings):
26 cache_settings = {'regions':None}
27 for key in settings.keys():
28 for prefix in ['beaker.cache.', 'cache.']:
29 if key.startswith(prefix):
30 name = key.split(prefix)[1].strip()
31 cache_settings[name] = settings[key].strip()
32 if cache_settings['regions']:
33 for region in cache_settings['regions'].split(','):
34 region = region.strip()
35 region_settings = {}
36 for key, value in cache_settings.items():
37 if key.startswith(region):
38 region_settings[key.split('.')[1]] = value
39 region_settings['expire'] = int(region_settings.get('expire',
40 60))
41 region_settings.setdefault('lock_dir',
42 cache_settings.get('lock_dir'))
43 if 'type' not in region_settings:
44 region_settings['type'] = cache_settings.get('type',
45 'memory')
46 beaker.cache.cache_regions[region] = region_settings
47 add_cache(config)
48
24 49 try:
25 50 import json
26 51 except ImportError:
@@ -51,7 +76,8 b' def whoosh_index(repo_location, full_ind'
51 76 from rhodecode.lib.indexers.daemon import WhooshIndexingDaemon
52 77 index_location = config['index_dir']
53 78 WhooshIndexingDaemon(index_location=index_location,
54 repo_location=repo_location).run(full_index=full_index)
79 repo_location=repo_location, sa=get_session())\
80 .run(full_index=full_index)
55 81
56 82 @task
57 83 @locked_task
@@ -67,7 +67,7 b' class WhooshIndexingDaemon(object):'
67 67 """
68 68
69 69 def __init__(self, indexname='HG_INDEX', index_location=None,
70 repo_location=None):
70 repo_location=None, sa=None):
71 71 self.indexname = indexname
72 72
73 73 self.index_location = index_location
@@ -78,7 +78,7 b' class WhooshIndexingDaemon(object):'
78 78 if not repo_location:
79 79 raise Exception('You have to provide repositories location')
80 80
81 self.repo_paths = ScmModel().repo_scan(self.repo_location, None)
81 self.repo_paths = ScmModel(sa).repo_scan(self.repo_location, None)
82 82 self.initial = False
83 83 if not os.path.isdir(self.index_location):
84 84 os.makedirs(self.index_location)
General Comments 0
You need to be logged in to leave comments. Login now