MAPREDUCE-2784. [Gridmix] Bug fixes in ExecutionSummarizer and ResourceUsageMatcher. (amarrk)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.23@1237579 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Amar Kamat 2012-01-30 09:41:20 +00:00
parent 2ef107ff90
commit 4b946ebdf2
5 changed files with 42 additions and 16 deletions

View File

@ -176,6 +176,9 @@ Release 0.23.1 - Unreleased
on the webapps. (Bhallamudi Venkata Siva Kamesh and Jason Lowe via vinodkv) on the webapps. (Bhallamudi Venkata Siva Kamesh and Jason Lowe via vinodkv)
BUG FIXES BUG FIXES
MAPREDUCE-2784. [Gridmix] Bug fixes in ExecutionSummarizer and
ResourceUsageMatcher. (amarrk)
MAPREDUCE-3194. "mapred mradmin" command is broken in mrv2 MAPREDUCE-3194. "mapred mradmin" command is broken in mrv2
(Jason Lowe via bobby) (Jason Lowe via bobby)

View File

@ -149,10 +149,15 @@ class ExecutionSummarizer implements StatListener<JobStats> {
throws IOException { throws IOException {
numJobsInInputTrace = factory.numJobsInTrace; numJobsInInputTrace = factory.numJobsInTrace;
endTime = System.currentTimeMillis(); endTime = System.currentTimeMillis();
Path inputTracePath = new Path(inputPath); if ("-".equals(inputPath)) {
FileSystem fs = inputTracePath.getFileSystem(conf); inputTraceLocation = Summarizer.NA;
inputTraceLocation = fs.makeQualified(inputTracePath).toString(); inputTraceSignature = Summarizer.NA;
inputTraceSignature = getTraceSignature(inputTraceLocation); } else {
Path inputTracePath = new Path(inputPath);
FileSystem fs = inputTracePath.getFileSystem(conf);
inputTraceLocation = fs.makeQualified(inputTracePath).toString();
inputTraceSignature = getTraceSignature(inputPath);
}
jobSubmissionPolicy = Gridmix.getJobSubmissionPolicy(conf).name(); jobSubmissionPolicy = Gridmix.getJobSubmissionPolicy(conf).name();
resolver = userResolver.getClass().getName(); resolver = userResolver.getClass().getName();
if (dataSize > 0) { if (dataSize > 0) {

View File

@ -314,9 +314,13 @@ public class Gridmix extends Configured implements Tool {
} }
}); });
// print the run summary // print the gridmix summary if the run was successful
System.out.print("\n\n"); if (val == 0) {
System.out.println(summarizer.toString()); // print the run summary
System.out.print("\n\n");
System.out.println(summarizer.toString());
}
return val; return val;
} }

View File

@ -52,15 +52,23 @@ public class ResourceUsageMatcher {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public void configure(Configuration conf, ResourceCalculatorPlugin monitor, public void configure(Configuration conf, ResourceCalculatorPlugin monitor,
ResourceUsageMetrics metrics, Progressive progress) { ResourceUsageMetrics metrics, Progressive progress) {
Class[] plugins = Class[] plugins = conf.getClasses(RESOURCE_USAGE_EMULATION_PLUGINS);
conf.getClasses(RESOURCE_USAGE_EMULATION_PLUGINS,
ResourceUsageEmulatorPlugin.class);
if (plugins == null) { if (plugins == null) {
System.out.println("No resource usage emulator plugins configured."); System.out.println("No resource usage emulator plugins configured.");
} else { } else {
for (Class<? extends ResourceUsageEmulatorPlugin> plugin : plugins) { for (Class clazz : plugins) {
if (plugin != null) { if (clazz != null) {
emulationPlugins.add(ReflectionUtils.newInstance(plugin, conf)); if (ResourceUsageEmulatorPlugin.class.isAssignableFrom(clazz)) {
ResourceUsageEmulatorPlugin plugin =
(ResourceUsageEmulatorPlugin) ReflectionUtils.newInstance(clazz,
conf);
emulationPlugins.add(plugin);
} else {
throw new RuntimeException("Misconfigured resource usage plugins. "
+ "Class " + clazz.getClass().getName() + " is not a resource "
+ "usage plugin as it does not extend "
+ ResourceUsageEmulatorPlugin.class.getName());
}
} }
} }
} }

View File

@ -159,7 +159,7 @@ public class TestGridmixSummary {
@Override @Override
protected Thread createReaderThread() { protected Thread createReaderThread() {
return null; return new Thread();
} }
} }
@ -243,7 +243,7 @@ public class TestGridmixSummary {
tid, es.getInputTraceSignature()); tid, es.getInputTraceSignature());
// test trace location // test trace location
Path qPath = fs.makeQualified(testTraceFile); Path qPath = fs.makeQualified(testTraceFile);
assertEquals("Mismatch in trace signature", assertEquals("Mismatch in trace filename",
qPath.toString(), es.getInputTraceLocation()); qPath.toString(), es.getInputTraceLocation());
// test expected data size // test expected data size
assertEquals("Mismatch in expected data size", assertEquals("Mismatch in expected data size",
@ -275,7 +275,7 @@ public class TestGridmixSummary {
es.finalize(factory, testTraceFile.toString(), 0L, resolver, dataStats, es.finalize(factory, testTraceFile.toString(), 0L, resolver, dataStats,
conf); conf);
// test missing expected data size // test missing expected data size
assertEquals("Mismatch in trace signature", assertEquals("Mismatch in trace data size",
Summarizer.NA, es.getExpectedDataSize()); Summarizer.NA, es.getExpectedDataSize());
assertFalse("Mismatch in trace signature", assertFalse("Mismatch in trace signature",
tid.equals(es.getInputTraceSignature())); tid.equals(es.getInputTraceSignature()));
@ -295,6 +295,12 @@ public class TestGridmixSummary {
assertEquals("Mismatch in trace signature", assertEquals("Mismatch in trace signature",
tid, es.getInputTraceSignature()); tid, es.getInputTraceSignature());
// finalize trace identifier '-' input
es.finalize(factory, "-", 0L, resolver, dataStats, conf);
assertEquals("Mismatch in trace signature",
Summarizer.NA, es.getInputTraceSignature());
assertEquals("Mismatch in trace file location",
Summarizer.NA, es.getInputTraceLocation());
} }
// test the ExecutionSummarizer // test the ExecutionSummarizer