tasktracker.jsp 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <%
  2. /*
  3. * Licensed to the Apache Software Foundation (ASF) under one
  4. * or more contributor license agreements. See the NOTICE file
  5. * distributed with this work for additional information
  6. * regarding copyright ownership. The ASF licenses this file
  7. * to you under the Apache License, Version 2.0 (the
  8. * "License"); you may not use this file except in compliance
  9. * with the License. You may obtain a copy of the License at
  10. *
  11. * http://www.apache.org/licenses/LICENSE-2.0
  12. *
  13. * Unless required by applicable law or agreed to in writing, software
  14. * distributed under the License is distributed on an "AS IS" BASIS,
  15. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16. * See the License for the specific language governing permissions and
  17. * limitations under the License.
  18. */
  19. %>
  20. <%@ page
  21. contentType="text/html; charset=UTF-8"
  22. import="javax.servlet.*"
  23. import="javax.servlet.http.*"
  24. import="java.io.*"
  25. import="java.util.*"
  26. import="java.text.DecimalFormat"
  27. import="org.apache.hadoop.http.HtmlQuoting"
  28. import="org.apache.hadoop.mapred.*"
  29. import="org.apache.hadoop.util.*"
  30. %>
  31. <%! private static final long serialVersionUID = 1L;
  32. %>
  33. <%
  34. TaskTracker tracker = (TaskTracker) application.getAttribute("task.tracker");
  35. String trackerName = tracker.getName();
  36. %>
  37. <!DOCTYPE html>
  38. <html>
  39. <title><%= trackerName %> Task Tracker Status</title>
  40. <body>
  41. <h1><%= trackerName %> Task Tracker Status</h1>
  42. <img src="/static/hadoop-logo.jpg"/><br>
  43. <b>Version:</b> <%= VersionInfo.getVersion()%>,
  44. <%= VersionInfo.getRevision()%><br>
  45. <b>Compiled:</b> <%= VersionInfo.getDate()%> by
  46. <%= VersionInfo.getUser()%> from
  47. <%= VersionInfo.getBranch()%><br>
  48. <h2>Running tasks</h2>
  49. <center>
  50. <table border=2 cellpadding="5" cellspacing="2">
  51. <tr><td align="center">Task Attempts</td><td>Status</td>
  52. <td>Progress</td><td>Errors</td></tr>
  53. <%
  54. Iterator itr = tracker.getRunningTaskStatuses().iterator();
  55. while (itr.hasNext()) {
  56. TaskStatus status = (TaskStatus) itr.next();
  57. out.print("<tr><td>" + status.getTaskID());
  58. out.print("</td><td>" + status.getRunState());
  59. out.print("</td><td>" +
  60. StringUtils.formatPercent(status.getProgress(), 2));
  61. out.print("</td><td><pre>" +
  62. HtmlQuoting.quoteHtmlChars(status.getDiagnosticInfo()) +
  63. "</pre></td>");
  64. out.print("</tr>\n");
  65. }
  66. %>
  67. </table>
  68. </center>
  69. <h2>Non-Running Tasks</h2>
  70. <table border=2 cellpadding="5" cellspacing="2">
  71. <tr><td align="center">Task Attempts</td><td>Status</td>
  72. <%
  73. for(TaskStatus status: tracker.getNonRunningTasks()) {
  74. out.print("<tr><td>" + status.getTaskID() + "</td>");
  75. out.print("<td>" + status.getRunState() + "</td></tr>\n");
  76. }
  77. %>
  78. </table>
  79. <h2>Tasks from Running Jobs</h2>
  80. <center>
  81. <table border=2 cellpadding="5" cellspacing="2">
  82. <tr><td align="center">Task Attempts</td><td>Status</td>
  83. <td>Progress</td><td>Errors</td></tr>
  84. <%
  85. itr = tracker.getTasksFromRunningJobs().iterator();
  86. while (itr.hasNext()) {
  87. TaskStatus status = (TaskStatus) itr.next();
  88. out.print("<tr><td>" + status.getTaskID());
  89. out.print("</td><td>" + status.getRunState());
  90. out.print("</td><td>" +
  91. StringUtils.formatPercent(status.getProgress(), 2));
  92. out.print("</td><td><pre>" +
  93. HtmlQuoting.quoteHtmlChars(status.getDiagnosticInfo()) +
  94. "</pre></td>");
  95. out.print("</tr>\n");
  96. }
  97. %>
  98. </table>
  99. </center>
  100. <h2>Local Logs</h2>
  101. <a href="/logs/">Log</a> directory
  102. <%
  103. out.println(ServletUtil.htmlFooter());
  104. %>