def test_inheritance(xom): with xom.keyfs.transaction(write=True): user = xom.model.create_user("one", "one") prod = user.create_stage("prod") prod.set_versiondata({"name": "proj", "version": "1.0"}) dev = user.create_stage("dev", bases=(prod.name, )) dev.set_versiondata({"name": "proj", "version": "1.1"}) with xom.keyfs.transaction(): stage = xom.model.getstage(dev.name) preprocess_project(stage, "proj")
def test_inheritance(xom): with xom.keyfs.transaction(write=True): user = xom.model.create_user("one", "one") prod = user.create_stage("prod") prod.set_versiondata({"name": "proj", "version": "1.0"}) dev = user.create_stage("dev", bases=(prod.name,)) dev.set_versiondata({"name": "proj", "version": "1.1"}) with xom.keyfs.transaction(): stage = xom.model.getstage(dev.name) preprocess_project(stage, "proj")
def handler(self, is_from_mirror, serial, indexname, names): log.debug( "Got %s projects from %s at serial %s for indexing", len(names), indexname, serial) ix = get_indexer(self.xom) counter = itertools.count() project_ix = ix.get_project_ix() main_keys = project_ix.schema.names() writer = project_ix.writer() searcher = project_ix.searcher() try: with self.xom.keyfs.transaction(write=False) as tx: stage = self.xom.model.getstage(indexname) if stage is not None: for name in names: data = preprocess_project( ProjectIndexingInfo(stage=stage, name=name)) # because we use the current transaction, we also # use the current serial for indexing ix._update_project( data, tx.at_serial, counter, main_keys, writer, searcher=searcher) count = next(counter) except Exception: writer.cancel() # let the queue handle retries raise else: log.debug("Committing %s new documents to search index." % count) writer.commit()
def devpiserver_mirror_initialnames(stage, projectnames): ix = get_indexer(stage.xom.config) threadlog.info( "indexing '%s' mirror with %s projects", stage.name, len(projectnames)) ix.update_projects(preprocess_project(stage, name) for name in projectnames) threadlog.info("finished mirror indexing operation")
def index_project(stage, name): if stage is None: return ix = get_indexer(stage.xom.config) ix.update_projects([preprocess_project(stage, name)])
def devpiserver_mirror_initialnames(stage, projectnames): ix = get_indexer(stage.xom.config) ix.update_projects( [preprocess_project(stage, name) for name in projectnames]) threadlog.info("finished mirror indexing operation")