gpt4 book ai didi

hadoop - Hadoop 中自定义计数器的替代文本

转载 作者:可可西里 更新时间:2023-11-01 16:22:56 26 4
gpt4 key购买 nike

我定义了以下计数器

static enum BadRecordCounters
{
NO_CREATION_DATE, UNKNOWN_USER_ID, UNPARSEABLE_RECORD, UNTAGGED_POSTS
}

它们显示如下

14/05/06 21:43:06 INFO mapred.JobClient:   com.aravind.learning.hadoop.mapred.techtalks.StackoverflowDataWranglerMapper$BadRecordCounters
14/05/06 21:43:06 INFO mapred.JobClient: UNKNOWN_USER_ID=93
14/05/06 21:43:06 INFO mapred.JobClient: UNTAGGED_POSTS=2461

我想知道是否有一种机制可以为这些使用替代文本。例如,我希望计数器组被读取为 Bad Record Counters 而不是 FQCN。

最佳答案

Map Reduce 允许您通过属性文件修改程序中指定的计数器标签。

权威指南中有一个名为“可读计数器名称”的部分处理了这个主题。

我只是在这里复制相关部分

The recipe to provide readable names is as follows. Create a properties file named after the enum, using an underscore as a separator for nested classes. The properties file should be in the same directory as the top-level class containing the enum. The file is named MaxTemperatureWithCounters_Temperature.properties for the counters in Example 8-1.

The properties file should contain a single property named CounterGroupName, whose value is the display name for the whole group. Then each field in the enum should have a corresponding property defined for it, whose name is the name of the field suffixed with .name and whose value is the display name for the counter.

MaxTemperatureWithCounters_Temperature.properties:
CounterGroupName=Air Temperature Records
MISSING.name=Missing
MALFORMED.name=Malformed

属性文件应该与包含枚举的顶级类位于同一目录中。

关于hadoop - Hadoop 中自定义计数器的替代文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23507353/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com