Changeset - aac24db58ce8
[Not reviewed]
beta
0 4 0
Marcin Kuzminski - 15 years ago 2010-11-27 01:43:04
marcin@python-works.com
fixed cache problem,
updated docs
4 files changed with 46 insertions and 4 deletions:
0 comments (0 inline, 0 general)
docs/changelog.rst
Show inline comments
 
@@ -24,7 +24,7 @@ news
 
  and options to disable those hooks from admin panel
 
- introduced new enhanced changelog for merges that shows more accurate results
 
- gui optimizations, fixed application width to 1024px
 
- whoosh,celeryd,upgrade moved to paster command
 
- whoosh, celeryd, upgrade moved to paster command
 

	
 
fixes
 
+++++
docs/setup.rst
Show inline comments
 
@@ -131,6 +131,22 @@ information check out the RhodeCode logs
 
ldap will be saved there.
 

	
 

	
 

	
 
Setting Up Celery
 
-----------------
 

	
 
Since version 1.1 celery is configured by the rhodecode ini configuration files
 
simply set use_celery=true in the ini file then add / change the configuration 
 
variables inside the ini file.
 

	
 
Remember that the ini files uses format with '.' not with '_' like celery
 
so for example setting `BROKER_HOST` in celery means setting `broker.host` in
 
the config file.
 

	
 
In order to make start using celery run::
 
 paster celeryd <configfile.ini>
 

	
 

	
 
Nginx virtual host example
 
--------------------------
 

	
rhodecode/lib/celerylib/tasks.py
Show inline comments
 
@@ -21,6 +21,31 @@ from vcs.backends import get_repo
 

	
 
from sqlalchemy import engine_from_config
 

	
 
#set cache regions for beaker so celery can utilise it
 
def add_cache(settings):
 
    cache_settings = {'regions':None}
 
    for key in settings.keys():
 
        for prefix in ['beaker.cache.', 'cache.']:
 
            if key.startswith(prefix):
 
                name = key.split(prefix)[1].strip()
 
                cache_settings[name] = settings[key].strip()
 
    if cache_settings['regions']:
 
        for region in cache_settings['regions'].split(','):
 
            region = region.strip()
 
            region_settings = {}
 
            for key, value in cache_settings.items():
 
                if key.startswith(region):
 
                    region_settings[key.split('.')[1]] = value
 
            region_settings['expire'] = int(region_settings.get('expire',
 
                                                                60))
 
            region_settings.setdefault('lock_dir',
 
                                       cache_settings.get('lock_dir'))
 
            if 'type' not in region_settings:
 
                region_settings['type'] = cache_settings.get('type',
 
                                                             'memory')
 
            beaker.cache.cache_regions[region] = region_settings
 
add_cache(config)
 

	
 
try:
 
    import json
 
except ImportError:
 
@@ -51,7 +76,8 @@ def whoosh_index(repo_location, full_ind
 
    from rhodecode.lib.indexers.daemon import WhooshIndexingDaemon
 
    index_location = config['index_dir']
 
    WhooshIndexingDaemon(index_location=index_location,
 
                         repo_location=repo_location).run(full_index=full_index)
 
                         repo_location=repo_location, sa=get_session())\
 
                         .run(full_index=full_index)
 

	
 
@task
 
@locked_task
rhodecode/lib/indexers/daemon.py
Show inline comments
 
@@ -67,7 +67,7 @@ class WhooshIndexingDaemon(object):
 
    """
 

	
 
    def __init__(self, indexname='HG_INDEX', index_location=None,
 
                 repo_location=None):
 
                 repo_location=None, sa=None):
 
        self.indexname = indexname
 

	
 
        self.index_location = index_location
 
@@ -78,7 +78,7 @@ class WhooshIndexingDaemon(object):
 
        if not repo_location:
 
            raise Exception('You have to provide repositories location')
 

	
 
        self.repo_paths = ScmModel().repo_scan(self.repo_location, None)
 
        self.repo_paths = ScmModel(sa).repo_scan(self.repo_location, None)
 
        self.initial = False
 
        if not os.path.isdir(self.index_location):
 
            os.makedirs(self.index_location)
0 comments (0 inline, 0 general)