def get(self, project, queue): stmt = sa.sql.select([tables.Catalogue]).where(_match(project, queue)) entry = self._conn.execute(stmt).fetchone() if entry is None: raise errors.QueueNotMapped(queue, project) return _normalize(entry)
def get(self, project, queue): fields = {'_id': 0} key = utils.scope_queue_name(queue, project) entry = self._col.find_one({PRIMARY_KEY: key}, fields=fields) if entry is None: raise errors.QueueNotMapped(project, queue) return _normalize(entry)
def update(self, project, queue, pool=None): if pool is None: return if not self.exists(project, queue): raise errors.QueueNotMapped(queue, project) stmt = sa.sql.update(tables.Catalogue).where(_match( project, queue)).values(pool=pool) self._conn.execute(stmt)
def update(self, project, queue, shard=None): # NOTE(cpp-cabrera): _insert handles conn_error res = self._insert(project, queue, shard, upsert=False) if not res['updatedExisting']: raise errors.QueueNotMapped(project, queue)
def update(self, project, queue, shard=None): if not self.exists(project, queue): raise errors.QueueNotMapped(project, queue) self._db.set(_key(project, queue), shard)
def get(self, project, queue): shard = self._db.get(_key(project, queue)) if not shard: raise errors.QueueNotMapped(project, queue) return _normalize(project, queue, shard)