def get_build_ids(start, end): builds_ids = Application.view('app_manager/builds_by_date', startkey=start, endkey=end, reduce=False, wrapper=lambda row: row['id']).all() return builds_ids
def couch_check(): """Confirm CouchDB is up and running, by hitting an arbitrary view.""" try: results = Application.view('app_manager/builds_by_date', limit=1).all() except Exception: return False, None else: return isinstance(results, list), None
def get_build_ids(start, end): builds_ids = Application.view( 'app_manager/builds_by_date', startkey=start, endkey=end, reduce=False, wrapper=lambda row: row['id'] ).all() return builds_ids
def _get_app_by_name(domain, name): app = Application.view('app_manager/applications_brief', startkey=[domain, name, {}], endkey=[domain, name], descending=True, limit=1).one() if app: return Application.get(app['_id']) else: raise ResourceNotFound(_("Not found application by name: %s") % name)
def couch_check(): """check couch""" #in reality when things go wrong with couch and postgres (as of this # writing) - it's far from graceful, so this will # likely never be # reached because another exception will fire first - but for # completeness sake, this check is done here to verify our calls will # work, and if other error handling allows the request to get this far. try: results = Application.view('app_manager/builds_by_date', limit=1).all() except Exception: return False, None else: return isinstance(results, list), None
def handle(self, *args, **options): builds = True limit = 100 skip = 0 while builds: builds = Application.view('app_manager/builds_by_date', include_docs=True, reduce=False, limit=limit, skip=skip, reverse=True).all() skip += limit for build in builds: if any([ form.version > build.version for module in build.modules for form in module.forms ]): print build._id
def handle(self, *args, **options): builds = True limit = 100 skip = 0 while builds: builds = Application.view( 'app_manager/builds_by_date', include_docs=True, reduce=False, limit=limit, skip=skip, reverse=True ).all() skip += limit for build in builds: if any([ form.version > build.version for module in build.modules for form in module.forms ]): print build._id
def check_couch(): """Confirm CouchDB is up and running, by hitting an arbitrary view.""" results = Application.view('app_manager/builds_by_date', limit=1).all() assert isinstance(results, list), "Couch didn't return a list of builds" return ServiceStatus(True, "Successfully queried an arbitrary couch view")