Ejemplo n.º 1
0
def delete_operators(name):
    try:
        op = MongoIns.search_by_name(OPERATOR_COLLECTION_NAME, name)
        if not op:
            raise NotExistError(f"operator {name} not exist", "")
        op = op[0]
        MongoIns.delete_by_name(OPERATOR_COLLECTION_NAME, name)
        operator = Operator(op["name"], op["addr"], op["author"], op["version"], op["type"], op["description"])
        operator.metadata = op["metadata"]
        return operator
    except Exception as e:
        logger.error(e)
        raise e
Ejemplo n.º 2
0
def delete_pipeline(name):
    try:
        p = MongoIns.search_by_name(PIPELINE_COLLECTION_NAME, name)
        if not p:
            raise NotExistError("pipeline %s is not exist" % name, "")
        p = p[0]
        MongoIns.delete_by_name(PIPELINE_COLLECTION_NAME, name)
        pipe = Pipeline(p["name"], p["description"], p["processors"],
                        p["encoder"], p["input"], p["output"])
        pipe.metadata = p["metadata"]
        return pipe
    except Exception as e:
        logger.error(e)
        raise e
Ejemplo n.º 3
0
def delete_application(name, force=False):
    try:
        if not force:
            if not entities_list(name, 100, 0):
                raise RequestError(
                    "Prevent to delete application with entity not deleted",
                    "")
        app = MongoIns.search_by_name(APPLICATION_COLLECTION_NAME, name)
        if not app:
            raise NotExistError(f"application {name} not exist", "")
        app = app[0]
        delete_milvus_collections_by_fields(app)
        S3Ins.del_s3_buckets(app['bucket'])
        MongoIns.delete_mongo_collection(f"{name}_entity")
        MongoIns.delete_by_name(APPLICATION_COLLECTION_NAME, name)
        logger.info("delete application %s", name)
        application = Application(app["name"], app["fields"], app["bucket"])
        application.metadata = app["metadata"]
        return application
    except Exception as e:
        logger.error(e)
        raise e