@Override public String getTaskAttemptLogUrl(JobConf conf, String taskTrackerHttpAddress, String taskAttemptId) throws MalformedURLException { URL taskTrackerHttpURL = new URL(taskTrackerHttpAddress); return TaskLogServlet.getTaskLogUrl( taskTrackerHttpURL.getHost(), Integer.toString(taskTrackerHttpURL.getPort()), taskAttemptId); }
printTaskLog(response, out, taskId, start, end, plainText, TaskLog.LogName.STDOUT, isCleanup); printTaskLog(response, out, taskId, start, end, plainText, TaskLog.LogName.STDERR, isCleanup); printTaskLog(response, out, taskId, start, end, plainText, TaskLog.LogName.SYSLOG, isCleanup); if (haveTaskLog(taskId, TaskLog.LogName.DEBUGOUT)) { printTaskLog(response, out, taskId, start, end, plainText, TaskLog.LogName.DEBUGOUT, isCleanup); if (haveTaskLog(taskId, TaskLog.LogName.PROFILE)) { printTaskLog(response, out, taskId, start, end, plainText, TaskLog.LogName.PROFILE, isCleanup); printTaskLog(response, out, taskId, start, end, plainText, filter, isCleanup); "You must supply a value for `filter' (STDOUT, STDERR, or SYSLOG) if you set plainText = true"); } else { printTaskLog(response, out, taskId, start, end, plainText, filter, isCleanup);
private static void quotedWrite(OutputStream out, byte[] data, int offset, int length) throws IOException { int end = offset + length; while (offset < end) { int next = findFirstQuotable(data, offset, end); out.write(data, offset, next - offset); offset = next; if (offset < end) { switch (data[offset]) { case '<': out.write("<".getBytes()); break; case '>': out.write(">".getBytes()); break; case '&': out.write("&".getBytes()); break; default: out.write(data[offset]); break; } offset += 1; } } }
ServletContext context = getServletContext(); TaskTracker taskTracker = (TaskTracker) context.getAttribute( "task.tracker"); JobConf jobACLConf = getConfFromJobACLsFile(jobId); checkAccessForTaskLogs(jobACLConf, user, jobId.toString(), taskTracker); } catch (AccessControlException e) { printTaskLog(response, out, attemptId, start, end, plainText, TaskLog.LogName.STDOUT, isCleanup); printTaskLog(response, out, attemptId, start, end, plainText, TaskLog.LogName.STDERR, isCleanup); printTaskLog(response, out, attemptId, start, end, plainText, TaskLog.LogName.SYSLOG, isCleanup); if (haveTaskLog(attemptId, isCleanup, TaskLog.LogName.DEBUGOUT)) { printTaskLog(response, out, attemptId, start, end, plainText, TaskLog.LogName.DEBUGOUT, isCleanup); if (haveTaskLog(attemptId, isCleanup, TaskLog.LogName.PROFILE)) { printTaskLog(response, out, attemptId, start, end, plainText, TaskLog.LogName.PROFILE, isCleanup); printTaskLog(response, out, attemptId, start, end, plainText, filter, isCleanup); } else { response.setContentType("text/plain; charset=utf-8");
out.write(b, 0, result); } else { quotedWrite(out, b, 0, result);
protected void validateJobACLsFileContent() { JobConf jobACLsConf = TaskLogServlet.getConfFromJobACLsFile(jobId); assertTrue(jobACLsConf.get("user.name").equals( localizedJobConf.getUser())); assertTrue(jobACLsConf.get(MRJobConfig.JOB_ACL_VIEW_JOB). equals(localizedJobConf.get(MRJobConfig.JOB_ACL_VIEW_JOB))); String queue = localizedJobConf.getQueueName(); assertTrue(queue.equalsIgnoreCase(jobACLsConf.getQueueName())); String qACLName = toFullPropertyName(queue, QueueACL.ADMINISTER_JOBS.getAclName()); assertTrue(jobACLsConf.get(qACLName).equals( localizedJobConf.get(qACLName))); }
out.write(b, 0, result); } else { quotedWrite(out, b, 0, result);
@Override public String getTaskAttemptLogUrl(JobConf conf, String taskTrackerHttpAddress, String taskAttemptId) throws MalformedURLException { URL taskTrackerHttpURL = new URL(taskTrackerHttpAddress); return TaskLogServlet.getTaskLogUrl( taskTrackerHttpURL.getHost(), Integer.toString(taskTrackerHttpURL.getPort()), taskAttemptId); }
printTaskLog(response, out, taskId, start, end, plainText, TaskLog.LogName.STDOUT, isCleanup); printTaskLog(response, out, taskId, start, end, plainText, TaskLog.LogName.STDERR, isCleanup); printTaskLog(response, out, taskId, start, end, plainText, TaskLog.LogName.SYSLOG, isCleanup); if (haveTaskLog(taskId, TaskLog.LogName.DEBUGOUT)) { printTaskLog(response, out, taskId, start, end, plainText, TaskLog.LogName.DEBUGOUT, isCleanup); if (haveTaskLog(taskId, TaskLog.LogName.PROFILE)) { printTaskLog(response, out, taskId, start, end, plainText, TaskLog.LogName.PROFILE, isCleanup); printTaskLog(response, out, taskId, start, end, plainText, filter, isCleanup); "You must supply a value for `filter' (STDOUT, STDERR, or SYSLOG) if you set plainText = true"); } else { printTaskLog(response, out, taskId, start, end, plainText, filter, isCleanup);
private static void quotedWrite(OutputStream out, byte[] data, int offset, int length) throws IOException { int end = offset + length; while (offset < end) { int next = findFirstQuotable(data, offset, end); out.write(data, offset, next - offset); offset = next; if (offset < end) { switch (data[offset]) { case '<': out.write("<".getBytes()); break; case '>': out.write(">".getBytes()); break; case '&': out.write("&".getBytes()); break; default: out.write(data[offset]); break; } offset += 1; } } }
@Override public String getTaskAttemptLogUrl(JobConf conf, String taskTrackerHttpAddress, String taskAttemptId) throws MalformedURLException { URL taskTrackerHttpURL = new URL(taskTrackerHttpAddress); return TaskLogServlet.getTaskLogUrl( taskTrackerHttpURL.getHost(), Integer.toString(taskTrackerHttpURL.getPort()), taskAttemptId); }
@Override public String getTaskAttemptLogUrl(JobConf conf, String taskTrackerHttpAddress, String taskAttemptId) throws MalformedURLException { URL taskTrackerHttpURL = new URL(taskTrackerHttpAddress); return TaskLogServlet.getTaskLogUrl( taskTrackerHttpURL.getHost(), Integer.toString(taskTrackerHttpURL.getPort()), taskAttemptId); }
@Override public String getTaskAttemptLogUrl(JobConf conf, String taskTrackerHttpAddress, String taskAttemptId) throws MalformedURLException { URL taskTrackerHttpURL = new URL(taskTrackerHttpAddress); return TaskLogServlet.getTaskLogUrl( taskTrackerHttpURL.getHost(), Integer.toString(taskTrackerHttpURL.getPort()), taskAttemptId); }
/** * Return the TaskLogsUrl of a particular TaskAttempt * * @param attempt * @return the taskLogsUrl. null if http-port or tracker-name or * task-attempt-id are unavailable. */ public static String getTaskLogsUrl(JobHistory.TaskAttempt attempt) { if (attempt.get(Keys.HTTP_PORT).equals("") || attempt.get(Keys.TRACKER_NAME).equals("") || attempt.get(Keys.TASK_ATTEMPT_ID).equals("")) { return null; } String taskTrackerName = JobInProgress.convertTrackerNameToHostName( attempt.get(Keys.TRACKER_NAME)).substring("tracker_".length()); return TaskLogServlet.getTaskLogUrl(taskTrackerName, attempt .get(Keys.HTTP_PORT), attempt.get(Keys.TASK_ATTEMPT_ID)); } }
/** * Return the TaskLogsUrl of a particular TaskAttempt * * @param attempt * @return the taskLogsUrl. null if http-port or tracker-name or * task-attempt-id are unavailable. */ public static String getTaskLogsUrl(JobHistory.TaskAttempt attempt) { if (attempt.get(Keys.HTTP_PORT).equals("") || attempt.get(Keys.TRACKER_NAME).equals("") || attempt.get(Keys.TASK_ATTEMPT_ID).equals("")) { return null; } String taskTrackerName = JobInProgress.convertTrackerNameToHostName( attempt.get(Keys.TRACKER_NAME)); return TaskLogServlet.getTaskLogUrl(taskTrackerName, attempt .get(Keys.HTTP_PORT), attempt.get(Keys.TASK_ATTEMPT_ID)); } }
/** * Return the TaskLogsUrl of a particular TaskAttempt * * @param attempt * @return the taskLogsUrl. null if http-port or tracker-name or * task-attempt-id are unavailable. */ public static String getTaskLogsUrl( JobHistoryParser.TaskAttemptInfo attempt) { if (attempt.getHttpPort() == -1 || attempt.getTrackerName().equals("") || attempt.getAttemptId() == null) { return null; } String taskTrackerName = JobInProgress.convertTrackerNameToHostName( attempt.getTrackerName()); return TaskLogServlet.getTaskLogUrl(taskTrackerName, Integer.toString(attempt.getHttpPort()), attempt.getAttemptId().toString()); }
String stdoutURL = TaskLogServlet.getTaskLogUrl("localhost", Integer.toString(attemptsMap.get(attempt).getHttpPort()), attempt.toString()) + "&filter=" + TaskLog.LogName.STDOUT; validateViewJob(stdoutURL, "GET"); String stderrURL = TaskLogServlet.getTaskLogUrl("localhost", Integer.toString(attemptsMap.get(attempt).getHttpPort()), attempt.toString()) + "&filter=" + TaskLog.LogName.STDERR; for (TaskAttemptID attempt : attemptsMap.keySet()) { String stdoutURL = TaskLogServlet.getTaskLogUrl("localhost", Integer.toString(attemptsMap.get(attempt).getHttpPort()), attempt.toString()) + "&filter=" + TaskLog.LogName.STDOUT;; String stderrURL = TaskLogServlet.getTaskLogUrl("localhost", Integer.toString(attemptsMap.get(attempt).getHttpPort()), attempt.toString()) + "&filter=" + TaskLog.LogName.STDERR;
String tasklogUrl = TaskLogServlet.getTaskLogUrl("localhost", String.valueOf(ttStatus.getHttpPort()), attemptId.toString()) + "&filter=STDERR"; String cleanupTasklogUrl = TaskLogServlet.getTaskLogUrl("localhost", String.valueOf(ttStatus.getHttpPort()), attemptId.toString()) + "&filter=STDERR&cleanup=true";
String taskLogUrl = null; if (taskTracker != null ) { taskLogUrl = TaskLogServlet.getTaskLogUrl(taskTracker.getHost(), String.valueOf(taskTracker.getHttpPort()), status.getTaskID().toString()); taskLogUrl = null; if (cleanupTracker != null ) { taskLogUrl = TaskLogServlet.getTaskLogUrl(cleanupTracker.getHost(), String.valueOf(cleanupTracker.getHttpPort()), status.getTaskID().toString());
String taskLogUrl = null; if (taskTracker != null) { taskLogUrl = TaskLogServlet.getTaskLogUrl(taskTracker.getHost(), String.valueOf(taskTracker.getHttpPort()), statuses[i].getTaskID().toString());