本文整理汇总了Python中naarad.metrics.metric.Metric.ignore方法的典型用法代码示例。如果您正苦于以下问题:Python Metric.ignore方法的具体用法?Python Metric.ignore怎么用?Python Metric.ignore使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类naarad.metrics.metric.Metric
的用法示例。
在下文中一共展示了Metric.ignore方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: parse_metric_section
# 需要导入模块: from naarad.metrics.metric import Metric [as 别名]
# 或者: from naarad.metrics.metric.Metric import ignore [as 别名]
def parse_metric_section(config_obj, section, metric_classes, metrics, aggregate_metric_classes, outdir_default, resource_path):
"""
Parse a metric section and create a Metric object
:param config_obj: ConfigParser object
:param section: Section name
:param metric_classes: List of valid metric types
:param metrics: List of all regular metric objects (used by aggregate metric)
:param aggregate_metric_classes: List of all valid aggregate metric types
:param outdir_default: Default output directory
:param resource_path: Default resource directory
:return: An initialized Metric object
"""
hostname, infile, aggr_hosts, aggr_metrics, label, ts_start, ts_end, precision, kwargs, rule_strings = parse_basic_metric_options(config_obj, section)
#TODO: Make user specify metric_type in config and not infer from section
metric_type = section.split('-')[0]
if metric_type in metric_classes: # regular metrics
new_metric = metric_classes[metric_type](section, infile, hostname, outdir_default, resource_path, label, ts_start, ts_end, rule_strings, **kwargs)
elif metric_type in aggregate_metric_classes: #aggregate metrics
new_metric = aggregate_metric_classes[metric_type](section, aggr_hosts, aggr_metrics, metrics, outdir_default, resource_path, label, ts_start, ts_end, rule_strings, **kwargs)
else: # new metrics.
new_metric = Metric(section, infile, hostname, outdir_default, resource_path, label, ts_start, ts_end, rule_strings, **kwargs)
if config_obj.has_option(section, 'ignore') and config_obj.getint(section, 'ignore') == 1:
new_metric.ignore = True
if config_obj.has_option(section, 'calc_metrics'):
new_metric.calc_metrics = config_obj.get(section, 'calc_metrics')
new_metric.precision = precision
return new_metric