Java Code Examples for org.apache.hadoop.mapred.Counters.Group#getCounterForName()
The following examples show how to use
org.apache.hadoop.mapred.Counters.Group#getCounterForName() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestStreamingCounters.java From hadoop with Apache License 2.0 | 5 votes |
private void validateCounters() throws IOException { Counters counters = job.running_.getCounters(); assertNotNull("Counters", counters); Group group = counters.getGroup("UserCounters"); assertNotNull("Group", group); Counter counter = group.getCounterForName("InputLines"); assertNotNull("Counter", counter); assertEquals(3, counter.getCounter()); }
Example 2
Source File: TestStreamingCounters.java From big-c with Apache License 2.0 | 5 votes |
private void validateCounters() throws IOException { Counters counters = job.running_.getCounters(); assertNotNull("Counters", counters); Group group = counters.getGroup("UserCounters"); assertNotNull("Group", group); Counter counter = group.getCounterForName("InputLines"); assertNotNull("Counter", counter); assertEquals(3, counter.getCounter()); }
Example 3
Source File: HadoopJobHistoryLoader.java From spork with Apache License 2.0 | 5 votes |
@SuppressWarnings("deprecation") private static void parseAndAddJobCounters(Map<String, String> job, String counters) { try { Counters counterGroups = Counters.fromEscapedCompactString(counters); for (Group otherGroup : counterGroups) { Group group = counterGroups.getGroup(otherGroup.getName()); for (Counter otherCounter : otherGroup) { Counter counter = group.getCounterForName(otherCounter.getName()); job.put(otherCounter.getName(), String.valueOf(counter.getValue())); } } } catch (ParseException e) { LOG.warn("Failed to parse job counters", e); } }
Example 4
Source File: TestStreamingCounters.java From RDFS with Apache License 2.0 | 5 votes |
public void testCommandLine() throws IOException { try { try { OUTPUT_DIR.getAbsoluteFile().delete(); } catch (Exception e) { } createInput(); boolean mayExit = false; // During tests, the default Configuration will use a local mapred // So don't specify -config or -cluster StreamJob job = new StreamJob(genArgs(), mayExit); job.go(); File outFile = new File(OUTPUT_DIR, "part-00000").getAbsoluteFile(); String output = StreamUtil.slurp(outFile); outFile.delete(); assertEquals(outputExpect, output); Counters counters = job.running_.getCounters(); assertNotNull("Counters", counters); Group group = counters.getGroup("UserCounters"); assertNotNull("Group", group); Counter counter = group.getCounterForName("InputLines"); assertNotNull("Counter", counter); assertEquals(3, counter.getCounter()); } finally { File outFileCRC = new File(OUTPUT_DIR, ".part-00000.crc").getAbsoluteFile(); INPUT_FILE.delete(); outFileCRC.delete(); OUTPUT_DIR.getAbsoluteFile().delete(); } }
Example 5
Source File: TestStreamingCounters.java From hadoop-gpu with Apache License 2.0 | 5 votes |
public void testCommandLine() throws IOException { try { try { OUTPUT_DIR.getAbsoluteFile().delete(); } catch (Exception e) { } createInput(); boolean mayExit = false; // During tests, the default Configuration will use a local mapred // So don't specify -config or -cluster StreamJob job = new StreamJob(genArgs(), mayExit); job.go(); File outFile = new File(OUTPUT_DIR, "part-00000").getAbsoluteFile(); String output = StreamUtil.slurp(outFile); outFile.delete(); assertEquals(outputExpect, output); Counters counters = job.running_.getCounters(); assertNotNull("Counters", counters); Group group = counters.getGroup("UserCounters"); assertNotNull("Group", group); Counter counter = group.getCounterForName("InputLines"); assertNotNull("Counter", counter); assertEquals(3, counter.getCounter()); } finally { File outFileCRC = new File(OUTPUT_DIR, ".part-00000.crc").getAbsoluteFile(); INPUT_FILE.delete(); outFileCRC.delete(); OUTPUT_DIR.getAbsoluteFile().delete(); } }