1 | <%@ page |
---|
2 | contentType="text/html; charset=UTF-8" |
---|
3 | import="javax.servlet.*" |
---|
4 | import="javax.servlet.http.*" |
---|
5 | import="java.io.*" |
---|
6 | import="java.util.*" |
---|
7 | import="java.text.DecimalFormat" |
---|
8 | import="org.apache.hadoop.mapred.*" |
---|
9 | import="org.apache.hadoop.util.*" |
---|
10 | %> |
---|
11 | <% |
---|
12 | JobTracker tracker = (JobTracker) application.getAttribute("job.tracker"); |
---|
13 | ClusterStatus status = tracker.getClusterStatus(); |
---|
14 | String trackerName = |
---|
15 | StringUtils.simpleHostname(tracker.getJobTrackerMachine()); |
---|
16 | JobQueueInfo[] queues = tracker.getQueues(); |
---|
17 | Vector<JobInProgress> runningJobs = tracker.runningJobs(); |
---|
18 | Vector<JobInProgress> completedJobs = tracker.completedJobs(); |
---|
19 | Vector<JobInProgress> failedJobs = tracker.failedJobs(); |
---|
20 | %> |
---|
21 | <%! |
---|
22 | private static DecimalFormat percentFormat = new DecimalFormat("##0.00"); |
---|
23 | |
---|
24 | public void generateSummaryTable(JspWriter out, ClusterStatus status, |
---|
25 | JobTracker tracker) throws IOException { |
---|
26 | String tasksPerNode = status.getTaskTrackers() > 0 ? |
---|
27 | percentFormat.format(((double)(status.getMaxMapTasks() + |
---|
28 | status.getMaxReduceTasks())) / status.getTaskTrackers()): |
---|
29 | "-"; |
---|
30 | out.print("<table border=\"1\" cellpadding=\"5\" cellspacing=\"0\">\n"+ |
---|
31 | "<tr><th>Maps</th><th>Reduces</th>" + |
---|
32 | "<th>Total Submissions</th>" + |
---|
33 | "<th>Nodes</th><th>Map Task Capacity</th>" + |
---|
34 | "<th>Reduce Task Capacity</th><th>Avg. Tasks/Node</th>" + |
---|
35 | "<th>Blacklisted Nodes</th></tr>\n"); |
---|
36 | out.print("<tr><td>" + status.getMapTasks() + "</td><td>" + |
---|
37 | status.getReduceTasks() + "</td><td>" + |
---|
38 | tracker.getTotalSubmissions() + |
---|
39 | "</td><td><a href=\"machines.jsp?type=active\">" + |
---|
40 | status.getTaskTrackers() + |
---|
41 | "</a></td><td>" + status.getMaxMapTasks() + |
---|
42 | "</td><td>" + status.getMaxReduceTasks() + |
---|
43 | "</td><td>" + tasksPerNode + |
---|
44 | "</td><td><a href=\"machines.jsp?type=blacklisted\">" + |
---|
45 | status.getBlacklistedTrackers() + "</a>" + |
---|
46 | "</td></tr></table>\n"); |
---|
47 | |
---|
48 | out.print("<br>"); |
---|
49 | if (tracker.hasRestarted()) { |
---|
50 | out.print("<span class=\"small\"><i>"); |
---|
51 | if (tracker.hasRecovered()) { |
---|
52 | out.print("The JobTracker got restarted and recovered back in " ); |
---|
53 | out.print(StringUtils.formatTime(tracker.getRecoveryDuration())); |
---|
54 | } else { |
---|
55 | out.print("The JobTracker got restarted and is still recovering"); |
---|
56 | } |
---|
57 | out.print("</i></span>"); |
---|
58 | } |
---|
59 | }%> |
---|
60 | |
---|
61 | |
---|
62 | <html> |
---|
63 | <head> |
---|
64 | <title><%= trackerName %> Hadoop Map/Reduce Administration</title> |
---|
65 | <link rel="stylesheet" type="text/css" href="/static/hadoop.css"> |
---|
66 | <script type="text/javascript" src="/static/jobtracker.js"></script> |
---|
67 | </head> |
---|
68 | <body> |
---|
69 | |
---|
70 | <% JSPUtil.processButtons(request, response, tracker); %> |
---|
71 | |
---|
72 | <h1><%= trackerName %> Hadoop Map/Reduce Administration</h1> |
---|
73 | |
---|
74 | <div id="quicklinks"> |
---|
75 | <a href="#quicklinks" onclick="toggle('quicklinks-list'); return false;">Quick Links</a> |
---|
76 | <ul id="quicklinks-list"> |
---|
77 | <li><a href="#scheduling_info">Scheduling Info</a></li> |
---|
78 | <li><a href="#running_jobs">Running Jobs</a></li> |
---|
79 | <li><a href="#completed_jobs">Completed Jobs</a></li> |
---|
80 | <li><a href="#failed_jobs">Failed Jobs</a></li> |
---|
81 | <li><a href="#local_logs">Local Logs</a></li> |
---|
82 | </ul> |
---|
83 | </div> |
---|
84 | |
---|
85 | <b>State:</b> <%= status.getJobTrackerState() %><br> |
---|
86 | <b>Started:</b> <%= new Date(tracker.getStartTime())%><br> |
---|
87 | <b>Version:</b> <%= VersionInfo.getVersion()%>, |
---|
88 | r<%= VersionInfo.getRevision()%><br> |
---|
89 | <b>Compiled:</b> <%= VersionInfo.getDate()%> by |
---|
90 | <%= VersionInfo.getUser()%><br> |
---|
91 | <b>Identifier:</b> <%= tracker.getTrackerIdentifier()%><br> |
---|
92 | |
---|
93 | <hr> |
---|
94 | <h2>Cluster Summary (Heap Size is <%= StringUtils.byteDesc(status.getUsedMemory()) %>/<%= StringUtils.byteDesc(status.getMaxMemory()) %>)</h2> |
---|
95 | <% |
---|
96 | generateSummaryTable(out, status, tracker); |
---|
97 | %> |
---|
98 | <hr> |
---|
99 | <h2 id="scheduling_info">Scheduling Information</h2> |
---|
100 | <table border="2" cellpadding="5" cellspacing="2"> |
---|
101 | <thead style="font-weight: bold"> |
---|
102 | <tr> |
---|
103 | <td> Queue Name </td> |
---|
104 | <td> Scheduling Information</td> |
---|
105 | </tr> |
---|
106 | </thead> |
---|
107 | <tbody> |
---|
108 | <% |
---|
109 | for(JobQueueInfo queue: queues) { |
---|
110 | String queueName = queue.getQueueName(); |
---|
111 | String schedulingInformation = queue.getSchedulingInfo(); |
---|
112 | if(schedulingInformation == null || schedulingInformation.trim().equals("")) { |
---|
113 | schedulingInformation = "NA"; |
---|
114 | } |
---|
115 | %> |
---|
116 | <tr> |
---|
117 | <td><a href="jobqueue_details.jsp?queueName=<%=queueName%>"><%=queueName%></a></td> |
---|
118 | <td><%=schedulingInformation.replaceAll("\n","<br/>") %> |
---|
119 | </td> |
---|
120 | </tr> |
---|
121 | <% |
---|
122 | } |
---|
123 | %> |
---|
124 | </tbody> |
---|
125 | </table> |
---|
126 | <hr/> |
---|
127 | <b>Filter (Jobid, Priority, User, Name)</b> <input type="text" id="filter" onkeyup="applyfilter()"> <br> |
---|
128 | <span class="small">Example: 'user:smith 3200' will filter by 'smith' only in the user field and '3200' in all fields</span> |
---|
129 | <hr> |
---|
130 | |
---|
131 | <h2 id="running_jobs">Running Jobs</h2> |
---|
132 | <%=JSPUtil.generateJobTable("Running", runningJobs, 30, 0)%> |
---|
133 | <hr> |
---|
134 | |
---|
135 | <h2 id="completed_jobs">Completed Jobs</h2> |
---|
136 | <%=JSPUtil.generateJobTable("Completed", completedJobs, 0, runningJobs.size())%> |
---|
137 | <hr> |
---|
138 | |
---|
139 | <h2 id="failed_jobs">Failed Jobs</h2> |
---|
140 | <%=JSPUtil.generateJobTable("Failed", failedJobs, 0, |
---|
141 | (runningJobs.size()+completedJobs.size()))%> |
---|
142 | <hr> |
---|
143 | |
---|
144 | <h2 id="local_logs">Local Logs</h2> |
---|
145 | <a href="logs/">Log</a> directory, <a href="jobhistory.jsp"> |
---|
146 | Job Tracker History</a> |
---|
147 | |
---|
148 | <% |
---|
149 | out.println(ServletUtil.htmlFooter()); |
---|
150 | %> |
---|