jtUrl + "/taskdetails.jsp?jobid=" + jobId + "&tipid=" + task.toString(); TaskLogProcessor tlp = new TaskLogProcessor(conf); for (String logUrl : ti.getLogUrls()) { tlp.addTaskAttemptLogUrl(logUrl); stackTraces.put(jobId, new ArrayList<List<String>>()); stackTraces.get(jobId).addAll(tlp.getStackTraces()); List<ErrorAndSolution> errors = tlp.getErrors();
@Test public void testGetStackTraces() throws Exception { JobConf jobConf = new JobConf(); HiveConf.setQueryString(jobConf, "select * from foo group by moo;"); final TaskLogProcessor taskLogProcessor = new TaskLogProcessor(jobConf); Throwable oome = new OutOfMemoryError("java heap space"); String oomeStr = writeThrowableAsFile("Some line in the beginning\n", oome, null, "1", taskLogProcessor); Throwable compositeException = new InvocationTargetException(new IOException(new NullPointerException())); String compositeStr = writeThrowableAsFile(null, compositeException, "Some line in the end.\n", "2", taskLogProcessor); Throwable eofe = new EOFException(); String eofeStr = writeThrowableAsFile("line a\nlineb\n", eofe, " line c\nlineD\n", "3", taskLogProcessor); List<List<String>> stackTraces = taskLogProcessor.getStackTraces(); assertEquals(3, stackTraces.size()); // Assert the actual stack traces are exactly equal to the written ones, // and are contained in "stackTraces" list in the submission order: checkException(oomeStr, stackTraces.get(0)); checkException(compositeStr, stackTraces.get(1)); checkException(eofeStr, stackTraces.get(2)); }
@Test public void testScriptErrorHeuristic() throws Exception { JobConf jobConf = new JobConf(); HiveConf.setQueryString(jobConf, "select * from foo group by moo;"); final TaskLogProcessor taskLogProcessor = new TaskLogProcessor(jobConf); String errorCode = "7874"; // example code String content = "line a\nlineb\n" + "Script failed with code " + errorCode + " line c\nlineD\n"; File log3File = writeTestLog("1", content); taskLogProcessor.addTaskAttemptLogUrl(log3File.toURI().toURL().toString()); List<ErrorAndSolution> errList = taskLogProcessor.getErrors(); assertEquals(1, errList.size()); final ErrorAndSolution eas = errList.get(0); String error = eas.getError(); assertNotNull(error); // check that the error code is present in the error description: assertTrue(error.indexOf(errorCode) >= 0); String solution = eas.getSolution(); assertNotNull(solution); assertTrue(solution.length() > 0); }
private String writeThrowableAsFile(String before, Throwable t, String after, String fileSuffix, TaskLogProcessor taskLogProcessor) throws IOException { // compose file text: StringBuilder sb = new StringBuilder(); if (before != null) { sb.append(before); } final String stackTraceStr = toString(t); sb.append(stackTraceStr); if (after != null) { sb.append(after); } // write it to file: File file = writeTestLog(fileSuffix, sb.toString()); // add it to the log processor: taskLogProcessor.addTaskAttemptLogUrl(file.toURI().toURL().toString()); return stackTraceStr; }
@Test public void testMapAggrMemErrorHeuristic() throws Exception { JobConf jobConf = new JobConf(); HiveConf.setQueryString(jobConf, "select * from foo group by moo;"); final TaskLogProcessor taskLogProcessor = new TaskLogProcessor(jobConf); Throwable oome = new OutOfMemoryError("java heap space"); File log1File = writeTestLog("1", toString(oome)); taskLogProcessor.addTaskAttemptLogUrl(log1File.toURI().toURL().toString()); List<ErrorAndSolution> errList = taskLogProcessor.getErrors(); assertEquals(1, errList.size()); final ErrorAndSolution eas = errList.get(0); String error = eas.getError(); assertNotNull(error); // check that the error code is present in the error description: assertTrue(error.contains("memory")); String solution = eas.getSolution(); assertNotNull(solution); assertTrue(solution.length() > 0); String confName = HiveConf.ConfVars.HIVEMAPAGGRHASHMEMORY.toString(); assertTrue(solution.contains(confName)); }
jtUrl + "/taskdetails.jsp?jobid=" + jobId + "&tipid=" + task.toString(); TaskLogProcessor tlp = new TaskLogProcessor(conf); for (String logUrl : ti.getLogUrls()) { tlp.addTaskAttemptLogUrl(logUrl); stackTraces.put(jobId, new ArrayList<List<String>>()); stackTraces.get(jobId).addAll(tlp.getStackTraces()); List<ErrorAndSolution> errors = tlp.getErrors();
HiveConf.setQueryString(jobConf, "select * from foo group by moo;"); final TaskLogProcessor taskLogProcessor = new TaskLogProcessor(jobConf); + "line E\n"; File log3File = writeTestLog("1", content); taskLogProcessor.addTaskAttemptLogUrl(log3File.toURI().toURL().toString()); List<ErrorAndSolution> errList = taskLogProcessor.getErrors(); assertEquals(1, errList.size());
jtUrl + "/taskdetails.jsp?jobid=" + jobId + "&tipid=" + task.toString(); TaskLogProcessor tlp = new TaskLogProcessor(conf); for (String logUrl : ti.getLogUrls()) { tlp.addTaskAttemptLogUrl(logUrl); stackTraces.put(jobId, new ArrayList<List<String>>()); stackTraces.get(jobId).addAll(tlp.getStackTraces()); List<ErrorAndSolution> errors = tlp.getErrors();
String taskUrl = jtUrl + "/taskdetails.jsp?jobid=" + jobId + "&tipid=" + task.toString(); TaskLogProcessor tlp = new TaskLogProcessor(conf); for (String logUrl : ti.getLogUrls()) { tlp.addTaskAttemptLogUrl(logUrl); List<ErrorAndSolution> errors = tlp.getErrors();