|
@@ -6,75 +6,32 @@
|
|
import="java.util.*"
|
|
import="java.util.*"
|
|
import="java.text.DecimalFormat"
|
|
import="java.text.DecimalFormat"
|
|
import="org.apache.hadoop.mapred.*"
|
|
import="org.apache.hadoop.mapred.*"
|
|
|
|
+ import="org.apache.hadoop.util.*"
|
|
%>
|
|
%>
|
|
<%!
|
|
<%!
|
|
JobTracker tracker = JobTracker.getTracker();
|
|
JobTracker tracker = JobTracker.getTracker();
|
|
- String trackerLabel = tracker.getJobTrackerMachine() + ":" + tracker.getTrackerPort();
|
|
|
|
|
|
+ String trackerLabel =
|
|
|
|
+ StringUtils.simpleHostname(tracker.getJobTrackerMachine());
|
|
private static DecimalFormat percentFormat = new DecimalFormat("##0.00");
|
|
private static DecimalFormat percentFormat = new DecimalFormat("##0.00");
|
|
|
|
|
|
- public void generateTaskTrackerTable(JspWriter out) throws IOException {
|
|
|
|
- Collection c = tracker.taskTrackers();
|
|
|
|
-
|
|
|
|
- if (c.size() == 0) {
|
|
|
|
- out.print("There are currently no known TaskTracker(s).");
|
|
|
|
- } else {
|
|
|
|
- out.print("<center>\n");
|
|
|
|
- out.print("<table border=\"2\" cellpadding=\"5\" cellspacing=\"2\">\n");
|
|
|
|
- out.print("<tr><td align=\"center\" colspan=\"5\"><b>Task Trackers</b></td></tr>\n");
|
|
|
|
- out.print("<tr><td><b>Name</b></td><td><b>Host</b></td>" +
|
|
|
|
- "<td><b># running tasks</b></td><td><b>Failures</b></td>" +
|
|
|
|
- "<td><b>Secs since heartbeat</b></td></tr>\n");
|
|
|
|
- int maxFailures = 0;
|
|
|
|
- String failureKing = null;
|
|
|
|
- for (Iterator it = c.iterator(); it.hasNext(); ) {
|
|
|
|
- TaskTrackerStatus tt = (TaskTrackerStatus) it.next();
|
|
|
|
- long sinceHeartbeat = System.currentTimeMillis() - tt.getLastSeen();
|
|
|
|
- if (sinceHeartbeat > 0) {
|
|
|
|
- sinceHeartbeat = sinceHeartbeat / 1000;
|
|
|
|
- }
|
|
|
|
- int numCurTasks = 0;
|
|
|
|
- for (Iterator it2 = tt.taskReports(); it2.hasNext(); ) {
|
|
|
|
- it2.next();
|
|
|
|
- numCurTasks++;
|
|
|
|
- }
|
|
|
|
- int numFailures = tt.getFailures();
|
|
|
|
- if (numFailures > maxFailures) {
|
|
|
|
- maxFailures = numFailures;
|
|
|
|
- failureKing = tt.getTrackerName();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- out.print("<tr><td>" + tt.getTrackerName() + "</td><td>" +
|
|
|
|
- tt.getHost() + "</td><td>" + numCurTasks +
|
|
|
|
- "</td><td>" + numFailures +
|
|
|
|
- "</td><td>" + sinceHeartbeat + "</td></tr>\n");
|
|
|
|
- }
|
|
|
|
- out.print("</table>\n");
|
|
|
|
- out.print("</center>\n");
|
|
|
|
- if (maxFailures > 0) {
|
|
|
|
- out.print("Highest Failures: " + failureKing + " with " + maxFailures +
|
|
|
|
- " failures<br>\n");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
public void generateJobTable(JspWriter out, String label, Vector jobs) throws IOException {
|
|
public void generateJobTable(JspWriter out, String label, Vector jobs) throws IOException {
|
|
out.print("<center>\n");
|
|
out.print("<center>\n");
|
|
out.print("<table border=\"2\" cellpadding=\"5\" cellspacing=\"2\">\n");
|
|
out.print("<table border=\"2\" cellpadding=\"5\" cellspacing=\"2\">\n");
|
|
- out.print("<tr><td align=\"center\" colspan=\"8\"><b>" + label + " Jobs </b></td></tr>\n");
|
|
|
|
|
|
+ out.print("<tr><td align=\"center\" colspan=\"9\"><b>" + label + " Jobs </b></td></tr>\n");
|
|
if (jobs.size() > 0) {
|
|
if (jobs.size() > 0) {
|
|
out.print("<tr><td><b>Jobid</b></td><td><b>User</b></td>");
|
|
out.print("<tr><td><b>Jobid</b></td><td><b>User</b></td>");
|
|
out.print("<td><b>Name</b></td>");
|
|
out.print("<td><b>Name</b></td>");
|
|
- out.print("<td><b>% complete</b></td><td><b>Required maps</b></td>");
|
|
|
|
- out.print("<td><b>maps completed</b></td>");
|
|
|
|
- out.print("<td><b>Required reduces</b></td>");
|
|
|
|
- out.print("<td><b>reduces completed</b></td></tr>\n");
|
|
|
|
|
|
+ out.print("<td><b>Map % complete</b></td>");
|
|
|
|
+ out.print("<td><b>Map total</b></td>");
|
|
|
|
+ out.print("<td><b>Maps completed</b></td>");
|
|
|
|
+ out.print("<td><b>Reduce % complete</b></td>");
|
|
|
|
+ out.print("<td><b>Reduce total</b></td>");
|
|
|
|
+ out.print("<td><b>Reduces completed</b></td></tr>\n");
|
|
for (Iterator it = jobs.iterator(); it.hasNext(); ) {
|
|
for (Iterator it = jobs.iterator(); it.hasNext(); ) {
|
|
JobInProgress job = (JobInProgress) it.next();
|
|
JobInProgress job = (JobInProgress) it.next();
|
|
JobProfile profile = job.getProfile();
|
|
JobProfile profile = job.getProfile();
|
|
JobStatus status = job.getStatus();
|
|
JobStatus status = job.getStatus();
|
|
String jobid = profile.getJobId();
|
|
String jobid = profile.getJobId();
|
|
- double completedRatio = (0.5 * (100 * status.mapProgress())) +
|
|
|
|
- (0.5 * (100 * status.reduceProgress()));
|
|
|
|
|
|
|
|
int desiredMaps = job.desiredMaps();
|
|
int desiredMaps = job.desiredMaps();
|
|
int desiredReduces = job.desiredReduces();
|
|
int desiredReduces = job.desiredReduces();
|
|
@@ -82,15 +39,16 @@
|
|
int completedReduces = job.finishedReduces();
|
|
int completedReduces = job.finishedReduces();
|
|
String name = profile.getJobName();
|
|
String name = profile.getJobName();
|
|
|
|
|
|
- out.print( "<tr><td>" + jobid +
|
|
|
|
- "<br>" + "<a href=\"jobdetails.jsp?jobid=" + jobid + "&type=" + "map" + "&pagenum=" + 1 + "\">" +
|
|
|
|
- "Maps" + "</a>" + "<br>" +
|
|
|
|
- "<a href=\"jobdetails.jsp?jobid=" + jobid + "&type=" + "reduce" + "&pagenum=" + 1 + "\">" +
|
|
|
|
- "Reduces" + "</a></td>" +
|
|
|
|
|
|
+ out.print( "<tr><td><a href=\"jobdetails.jsp?jobid=" + jobid + "\">" +
|
|
|
|
+ jobid + "</a></td>" +
|
|
"<td>" + profile.getUser() + "</td>"
|
|
"<td>" + profile.getUser() + "</td>"
|
|
+ "<td>" + ("".equals(name) ? " " : name) + "</td>" +
|
|
+ "<td>" + ("".equals(name) ? " " : name) + "</td>" +
|
|
- "<td>" + percentFormat.format(completedRatio) + "%</td><td>" +
|
|
|
|
|
|
+ "<td>" +
|
|
|
|
+ percentFormat.format(100.0 * status.mapProgress()) +
|
|
|
|
+ "%</td><td>" +
|
|
desiredMaps + "</td><td>" + completedMaps + "</td><td>" +
|
|
desiredMaps + "</td><td>" + completedMaps + "</td><td>" +
|
|
|
|
+ percentFormat.format(100.0 * status.reduceProgress()) +
|
|
|
|
+ "%</td><td>" +
|
|
desiredReduces + "</td><td> " + completedReduces +
|
|
desiredReduces + "</td><td> " + completedReduces +
|
|
"</td></tr>\n");
|
|
"</td></tr>\n");
|
|
}
|
|
}
|
|
@@ -105,20 +63,20 @@
|
|
ClusterStatus status = tracker.getClusterStatus();
|
|
ClusterStatus status = tracker.getClusterStatus();
|
|
out.print("<table border=\"2\" cellpadding=\"5\" cellspacing=\"2\">\n"+
|
|
out.print("<table border=\"2\" cellpadding=\"5\" cellspacing=\"2\">\n"+
|
|
"<tr><th>Maps</th><th>Reduces</th>" +
|
|
"<tr><th>Maps</th><th>Reduces</th>" +
|
|
- "<th>Capacity</th><th>Nodes</th></tr>\n");
|
|
|
|
|
|
+ "<th>Tasks/Node</th><th>Nodes</th></tr>\n");
|
|
out.print("<tr><td>" + status.getMapTasks() + "</td><td>" +
|
|
out.print("<tr><td>" + status.getMapTasks() + "</td><td>" +
|
|
status.getReduceTasks() + "</td><td>" +
|
|
status.getReduceTasks() + "</td><td>" +
|
|
- status.getMaxTasks() + "</td><td>" +
|
|
|
|
- status.getTaskTrackers() + "</td></tr></table>\n");
|
|
|
|
|
|
+ status.getMaxTasks() + "</td><td><a href=\"/machines.jsp\">" +
|
|
|
|
+ status.getTaskTrackers() + "</a></td></tr></table>\n");
|
|
}
|
|
}
|
|
%>
|
|
%>
|
|
|
|
|
|
<html>
|
|
<html>
|
|
|
|
|
|
-<title>Hadoop MapReduce General Administration</title>
|
|
|
|
|
|
+<title><%= trackerLabel %> Hadoop Map/Reduce Administration</title>
|
|
|
|
|
|
<body>
|
|
<body>
|
|
-<h1>JobTracker '<%=trackerLabel%>'</h1>
|
|
|
|
|
|
+<h1><%= trackerLabel %> Hadoop Map/Reduce Administration</h1>
|
|
|
|
|
|
This JobTracker has been up since <%= new Date(tracker.getStartTime())%>.<br>
|
|
This JobTracker has been up since <%= new Date(tracker.getStartTime())%>.<br>
|
|
<hr>
|
|
<hr>
|
|
@@ -130,13 +88,6 @@ This JobTracker has been up since <%= new Date(tracker.getStartTime())%>.<br>
|
|
</center>
|
|
</center>
|
|
<hr>
|
|
<hr>
|
|
|
|
|
|
-
|
|
|
|
-<h2>Task Trackers</h2>
|
|
|
|
-<%
|
|
|
|
- generateTaskTrackerTable(out);
|
|
|
|
-%>
|
|
|
|
-
|
|
|
|
-<hr>
|
|
|
|
<h2>Running Jobs</h2>
|
|
<h2>Running Jobs</h2>
|
|
<%
|
|
<%
|
|
generateJobTable(out, "Running", tracker.runningJobs());
|
|
generateJobTable(out, "Running", tracker.runningJobs());
|