/** * Test counter recovery */ private void testCounter(Counters counter) throws ParseException { String compactEscapedString = counter.makeEscapedCompactString(); assertFalse("compactEscapedString should not contain null", compactEscapedString.contains("null")); Counters recoveredCounter = Counters.fromEscapedCompactString(compactEscapedString); // Check for recovery from string assertEquals("Recovered counter does not match on content", counter, recoveredCounter); }
String.valueOf(failedMaps), String.valueOf(failedReduces), counters.makeEscapedCompactString()}); for (PrintWriter out : writer) { out.close();
/** * Log finish time of task. * @param taskId task id * @param taskType MAP or REDUCE * @param finishTime finish timeof task in ms */ public static void logFinished(TaskID taskId, String taskType, long finishTime, Counters counters){ if (!disableHistory){ ArrayList<PrintWriter> writer = openJobs.get(JOBTRACKER_UNIQUE_STRING + taskId.getJobID()); if (null != writer){ JobHistory.log(writer, RecordTypes.Task, new Keys[]{Keys.TASKID, Keys.TASK_TYPE, Keys.TASK_STATUS, Keys.FINISH_TIME, Keys.COUNTERS}, new String[]{ taskId.toString(), taskType, Values.SUCCESS.name(), String.valueOf(finishTime), counters.makeEscapedCompactString()}); } } } /**
String.valueOf(finishedMaps), String.valueOf(finishedReduces), counters.makeEscapedCompactString()}); CloseWriters close = new CloseWriters(writer); fileManager.addCloseTask(close);
/** * Log finish time of task. * @param taskId task id * @param taskType MAP or REDUCE * @param finishTime finish timeof task in ms */ public static void logFinished(TaskID taskId, String taskType, long finishTime, Counters counters){ if (!disableHistory){ JobID id = taskId.getJobID(); ArrayList<PrintWriter> writer = fileManager.getWriters(id); if (null != writer){ JobHistory.log(writer, RecordTypes.Task, new Keys[]{Keys.TASKID, Keys.TASK_TYPE, Keys.TASK_STATUS, Keys.FINISH_TIME, Keys.COUNTERS}, new String[]{ taskId.toString(), taskType, Values.SUCCESS.name(), String.valueOf(finishTime), counters.makeEscapedCompactString()}); } } }
/** * Test counter recovery */ private void testCounter(Counters counter) throws ParseException { String compactEscapedString = counter.makeEscapedCompactString(); Counters recoveredCounter = Counters.fromEscapedCompactString(compactEscapedString); // Check for recovery from string assertEquals("Recovered counter does not match on content", counter, recoveredCounter); assertEquals("recovered counter has wrong hash code", counter.hashCode(), recoveredCounter.hashCode()); }
String.valueOf(finishTime), hostName, stateString, counter.makeEscapedCompactString()});
String.valueOf(finishTime), hostName, stateString, counter.makeEscapedCompactString()});
String.valueOf(finishTime), hostName, stateString, counter.makeEscapedCompactString()});
String.valueOf(finishTime), hostName, stateString, counter.makeEscapedCompactString()});