in datafu-hourglass/src/main/java/datafu/hourglass/jobs/ReduceEstimator.java [77:116]
public ReduceEstimator(FileSystem fs, Properties props)
{
this.fs = fs;
if (props != null)
{
for (Object o : props.keySet())
{
String key = (String)o;
if (key.startsWith("num.reducers."))
{
if (key.equals("num.reducers.bytes.per.reducer"))
{
tagToBytesPerReducer.put(DEFAULT, Long.parseLong(props.getProperty(key)));
}
else
{
Pattern p = Pattern.compile("num\\.reducers\\.([a-z]+)\\.bytes\\.per\\.reducer");
Matcher m = p.matcher(key);
if (m.matches())
{
String tag = m.group(1);
tagToBytesPerReducer.put(tag, Long.parseLong(props.getProperty(key)));
}
else
{
throw new RuntimeException("Property not recognized: " + key);
}
}
}
}
}
if (!tagToBytesPerReducer.containsKey(DEFAULT))
{
long defaultValue = DEFAULT_BYTES_PER_REDUCER;
_log.info(String.format("No default bytes per reducer set, using %.2f MB",toMB(defaultValue)));
tagToBytesPerReducer.put(DEFAULT, defaultValue);
}
}