Ejemplo n.º 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
Ejemplo n.º 2
0
def get_graphs():
    page = 1
    graphs = []
    while True:
        partial_graphs = facade.list_graphs(page=page, per_page=100)
        graphs += partial_graphs['graphs']
        if page == partial_graphs['total_pages']:
            break
        page += 1
    return graphs
Ejemplo n.º 3
0
    def get(self):
        """List all graphs from DB."""

        args = search_parser.parse_args(request)

        try:
            page = args.get('page')
            per_page = args.get('per_page')
            res = facade.list_graphs(page, per_page)
        except JSONDecodeError:
            raise gmap_exc.SearchException('Parameter query is invalid')
        else:
            return res, 200
Ejemplo n.º 4
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
Ejemplo n.º 5
0
    def get(self):
        """List all graphs from DB."""

        graphs = facade.list_graphs()
        return graphs, 200