def entities_list(name, num, page):
    res = []
    try:
        docs = MongoIns.list_documents(f"{name}_entity", num, page)
        for doc in docs:
            res.append(new_mapping_ins(docs=doc))
        logger.info("get application %s entity list", name)
        return res
    except Exception as e:
        logger.error(e)
        raise e
Exemple #2
0
def all_operators():
    res = []
    try:
        operators = MongoIns.list_documents(OPERATOR_COLLECTION_NAME, 0)
        for x in operators:
            op = Operator(x["name"], x["addr"], x["author"], x["version"], x["type"], x["description"])
            op.metadata = x["metadata"]
            res.append(op)
        return res
    except Exception as e:
        logger.error(e)
        raise e
Exemple #3
0
def all_pipelines():
    res = []
    try:
        pipes = MongoIns.list_documents(PIPELINE_COLLECTION_NAME, 0)
        for pipe in pipes:
            p = Pipeline(pipe["name"], pipe["description"], pipe["processors"],
                         pipe["encoder"], pipe["input"], pipe["output"])
            p.metadata = pipe["metadata"]
            res.append(p)
        return res
    except Exception as e:
        logger.error(e)
        raise e
def all_applications():
    res = []
    try:
        apps = MongoIns.list_documents(APPLICATION_COLLECTION_NAME, 0)
        for x in apps:
            app = Application(name=x["name"],
                              fields=x["fields"],
                              bucket=x["bucket"])
            app.metadata = x["metadata"]
            res.append(app)
        logger.info("get all application")
        return res
    except Exception as e:
        logger.error(e)
        raise e