def command(self): logging.config.fileConfig(self.path_to_ini_file) #get SqlAlchemy session self._init_session() from pylons import config index_location = config['index_dir'] load_rcextensions(config['here']) repo_location = self.options.repo_location \ if self.options.repo_location else RepoModel().repos_path repo_list = map(strip, self.options.repo_list.split(',')) \ if self.options.repo_list else None repo_update_list = map(strip, self.options.repo_update_list.split(',')) \ if self.options.repo_update_list else None #====================================================================== # WHOOSH DAEMON #====================================================================== from rhodecode.lib.pidlock import LockHeld, DaemonLock from rhodecode.lib.indexers.daemon import WhooshIndexingDaemon try: l = DaemonLock( file_=os.path.join(dn(dn(index_location)), 'make_index.lock')) WhooshIndexingDaemon(index_location=index_location, repo_location=repo_location, repo_list=repo_list, repo_update_list=repo_update_list)\ .run(full_index=self.options.full_index) l.release() except LockHeld: sys.exit(1)
def create_test_index(repo_location, config, full_index): """ Makes default test index :param config: test config :param full_index: """ from rhodecode.lib.indexers.daemon import WhooshIndexingDaemon from rhodecode.lib.pidlock import DaemonLock, LockHeld repo_location = repo_location index_location = os.path.join(config['app_conf']['index_dir']) if not os.path.exists(index_location): os.makedirs(index_location) try: l = DaemonLock(file_=jn(dn(index_location), 'make_index.lock')) WhooshIndexingDaemon(index_location=index_location, repo_location=repo_location)\ .run(full_index=full_index) l.release() except LockHeld: pass
def command(self): logging.config.fileConfig(self.path_to_ini_file) from pylons import config add_cache(config) engine = engine_from_config(config, 'sqlalchemy.db1.') init_model(engine) index_location = config['index_dir'] repo_location = self.options.repo_location \ if self.options.repo_location else RepoModel().repos_path repo_list = map(strip, self.options.repo_list.split(',')) \ if self.options.repo_list else None repo_update_list = map(strip, self.options.repo_update_list.split(',')) \ if self.options.repo_update_list else None load_rcextensions(config['here']) #====================================================================== # WHOOSH DAEMON #====================================================================== from rhodecode.lib.pidlock import LockHeld, DaemonLock from rhodecode.lib.indexers.daemon import WhooshIndexingDaemon try: l = DaemonLock(file_=jn(dn(dn(index_location)), 'make_index.lock')) WhooshIndexingDaemon(index_location=index_location, repo_location=repo_location, repo_list=repo_list, repo_update_list=repo_update_list)\ .run(full_index=self.options.full_index) l.release() except LockHeld: sys.exit(1)
def command(self): logging.config.fileConfig(self.path_to_ini_file) # get SqlAlchemy session self._init_session() from pylons import config index_location = config["index_dir"] load_rcextensions(config["here"]) repo_location = self.options.repo_location if self.options.repo_location else RepoModel().repos_path repo_list = map(strip, self.options.repo_list.split(",")) if self.options.repo_list else None repo_update_list = ( map(strip, self.options.repo_update_list.split(",")) if self.options.repo_update_list else None ) # ====================================================================== # WHOOSH DAEMON # ====================================================================== from rhodecode.lib.pidlock import LockHeld, DaemonLock from rhodecode.lib.indexers.daemon import WhooshIndexingDaemon try: l = DaemonLock(file_=os.path.join(dn(dn(index_location)), "make_index.lock")) WhooshIndexingDaemon( index_location=index_location, repo_location=repo_location, repo_list=repo_list, repo_update_list=repo_update_list, ).run(full_index=self.options.full_index) l.release() except LockHeld: sys.exit(1)
def command(self): logging.config.fileConfig(self.path_to_ini_file) from pylons import config add_cache(config) engine = engine_from_config(config, 'sqlalchemy.db1.') init_model(engine) index_location = config['index_dir'] repo_location = self.options.repo_location \ if self.options.repo_location else RepoModel().repos_path repo_list = map(strip, self.options.repo_list.split(',')) \ if self.options.repo_list else None load_rcextensions(config['here']) #====================================================================== # WHOOSH DAEMON #====================================================================== from rhodecode.lib.pidlock import LockHeld, DaemonLock from rhodecode.lib.indexers.daemon import WhooshIndexingDaemon try: l = DaemonLock(file_=jn(dn(dn(index_location)), 'make_index.lock')) WhooshIndexingDaemon(index_location=index_location, repo_location=repo_location, repo_list=repo_list,)\ .run(full_index=self.options.full_index) l.release() except LockHeld: sys.exit(1)
def __wrapper(func, *fargs, **fkwargs): lockkey = __get_lockkey(func, *fargs, **fkwargs) lockkey_path = config["here"] log.info("running task with lockkey %s" % lockkey) try: l = DaemonLock(file_=jn(lockkey_path, lockkey)) ret = func(*fargs, **fkwargs) l.release() return ret except LockHeld: log.info("LockHeld") return "Task with key %s already running" % lockkey
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(jn(lockkey_path, lockkey)) ret = func(*fargs, **fkwargs) l.release() return ret except LockHeld: log.info('LockHeld') return 'Task with key %s already running' % lockkey
def __wrapper(func, *fargs, **fkwargs): lockkey = __get_lockkey(func, *fargs, **fkwargs) lockkey_path = config['here'] log.info('running task with lockkey %s', lockkey) try: l = DaemonLock(file_=jn(lockkey_path, lockkey)) ret = func(*fargs, **fkwargs) l.release() return ret except LockHeld: log.info('LockHeld') return 'Task with key %s already running' % lockkey
def __wrapper(func, *fargs, **fkwargs): lockkey = __get_lockkey(func, *fargs, **fkwargs) lockkey_path = config['here'] log.info('running task with lockkey %s' % lockkey) try: l = DaemonLock(file_=jn(lockkey_path, lockkey)) ret = func(*fargs, **fkwargs) l.release() return ret except LockHeld: log.info('LockHeld') return 'Task with key %s already running' % lockkey