def get_statistic(params): """获取统计信息 Args: params:dict 参数字典 Returns: path, {}: 路径和参数字典 """ worker_name = params.get('worker_name') worker_statistic = get_worker_statistic(worker_name) return "statistic.html", {'statistic': worker_statistic,}
def get_statistic(params): """获取统计信息 Args: params:dict 参数字典 Returns: path, {}: 路径和参数字典 """ worker_name = params.get('worker_name') worker_statistic = get_worker_statistic(worker_name) return "statistic.html", { 'statistic': worker_statistic, }
def api_get_worker_statistic(params): """获取某一个worker的实时统计信息 Args: params: 字典,参数字典,必须包含如下信息: worker_name: worker的名字 """ is_ok, errors = check_params(params, 'worker_name') if not is_ok: return result(400, "params error", str(errors)) worker_name = params['worker_name'] try: worker_statistic = get_worker_statistic(worker_name) except WorkerError, e: return result(400, "get worker data failed", str(e))