def operator_health(name): try: op = search_operator(name) if not op: raise NotExistError("operator %s not exist" % name, "") return health(op) except Exception as e: logger.error(e) return e
def operator_detail(name): try: op = search_operator(name) if not op: raise NotExistError("operator %s not exist" % name, "") return new_operator(name=op.name, backend=op.backend, type=op.type, input=op.input, output=op.output, endpoint=op.endpoint, dimension=op.dimension, metric_type=op.metric_type) except Exception as e: logger.error(e) raise e
def operator_detail(name): try: op = search_operator(name) if not op: raise NotExistError("operator %s not exist" % name, "") return new_operator(name=op.name, type=op.type, addr=op.addr, author=op.author, version=op.version, description=op.description) except Exception as e: logger.error(e) raise e
def all_operators(): res = [] try: operators = search_operator() for x in operators: res.append(new_operator(name=x.Operator.name, type=x.Operator.type, addr=x.Operator.addr, author=x.Operator.author, version=x.Operator.version, description=x.Operator.description)) return res except Exception as e: logger.error(e) raise e
def all_operators(): res = [] try: operators = search_operator() for x in operators: res.append(new_operator(name=x.Operator.name, backend=x.Operator.backend, type=x.Operator.type, input=x.Operator.input, output=x.Operator.output, endpoint=x.Operator.endpoint, dimension=x.Operator.dimension, metric_type=x.Operator.metric_type)) except Exception as e: logger.error(e) return e return res
def register_operators(**args): op = DB(name=args['name'], type=args['type'], addr=args['addr'], author=args['author'], version=args['version'], description=args['description']) try: if search_operator(args['name']): raise ExistError(f"operator {args['name']} had exist", "") insert_operator(op) return new_operator(name=args['name'], type=args['type'], addr=args['addr'], author=args['author'], version=args['version'], description=args['description']) except Exception as e: raise e
def register_operators(**args): op = DB(name=args['name'], type=args['type'], addr=args['addr'], author=args['author'], version=args['version'], description=args['description']) try: if search_operator(args['name']): raise ExistError(f"operator {args['name']} had exist", "") insert_operator(op) return new_operator(name=args['name'], type=args['type'], addr=args['addr'], author=args['author'], version=args['version'], description=args['description']) except Exception as e: logger.error(f"Unexpected error happen during register operator, {str(e)}", exc_info=True) raise e