コード例 #1
0
def _is_arango_ok():
    try:
        db = app.config['ARANGO_CONN']
        db.get_database()
        facade.list_graphs()
        facade.list_collections('document')
        facade.list_collections('edge')
    except Exception:
        app.logger.error('Failed to healthcheck arango.')
        deps = {'status': False}
    else:
        deps = {'status': True}

    return deps
コード例 #2
0
def _is_arango_ok():
    try:
        db = DB()
        db.get_database()
        graphs = facade.list_graphs()
        collections = facade.list_collections('document')
        edges = facade.list_collections('edge')
    except:
        app.logger.error('Failed to healthcheck arango.')
        deps = {'status': False}
    else:
        deps = {
            'status': True,
            'graphs': graphs,
            'collections': collections,
            'edges': edges
        }

    return deps
コード例 #3
0
def get_collections(kind):
    page = 1
    collections = []
    while True:
        partial_coll = facade.list_collections(kind, page=page, per_page=100)
        collections += partial_coll['collections']
        if page == partial_coll['total_pages']:
            break
        page += 1
    return collections
コード例 #4
0
    def get(self):
        """List all collections of kind document from DB."""

        args = search_parser.parse_args(request)

        try:
            page = args.get('page')
            per_page = args.get('per_page')
            res = facade.list_collections('document', page, per_page)
        except JSONDecodeError:
            raise gmap_exc.SearchException('Parameter query is invalid')
        else:
            return res, 200
コード例 #5
0
    def get(self):
        """List all collections of kind edge from DB."""

        args = search_parser.parse_args(request)

        try:
            query = args.get('query') or '[]'
            page = args.get('page')
            per_page = args.get('per_page')
            data = json.loads(query)
            res = facade.list_collections('edge', data, page, per_page)
        except JSONDecodeError:
            raise gmap_exc.SearchException('Parameter query is invalid')
        else:
            return res, 200