tasktracker.jsp
上传用户:quxuerui
上传日期:2018-01-08
资源大小:41811k
文件大小:3k
源码类别:

网格计算

开发平台:

Java

  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.   TaskTracker tracker = (TaskTracker) application.getAttribute("task.tracker");
  13.   String trackerName = tracker.getName();
  14. %>
  15. <html>
  16. <title><%= trackerName %> Task Tracker Status</title>
  17. <body>
  18. <h1><%= trackerName %> Task Tracker Status</h1>
  19. <img src="/static/hadoop-logo.jpg"/><br>
  20. <b>Version:</b> <%= VersionInfo.getVersion()%>,
  21.                 r<%= VersionInfo.getRevision()%><br>
  22. <b>Compiled:</b> <%= VersionInfo.getDate()%> by 
  23.                  <%= VersionInfo.getUser()%><br>
  24. <h2>Running tasks</h2>
  25. <center>
  26. <table border=2 cellpadding="5" cellspacing="2">
  27. <tr><td align="center">Task Attempts</td><td>Status</td>
  28.     <td>Progress</td><td>Errors</td></tr>
  29.   <%
  30.      Iterator itr = tracker.getRunningTaskStatuses().iterator();
  31.      while (itr.hasNext()) {
  32.        TaskStatus status = (TaskStatus) itr.next();
  33.        out.print("<tr><td>" + status.getTaskID());
  34.        out.print("</td><td>" + status.getRunState()); 
  35.        out.print("</td><td>" + 
  36.                  StringUtils.formatPercent(status.getProgress(), 2));
  37.        out.print("</td><td><pre>" + status.getDiagnosticInfo() + "</pre></td>");
  38.        out.print("</tr>n");
  39.      }
  40.   %>
  41. </table>
  42. </center>
  43. <h2>Non-Running Tasks</h2>
  44. <table border=2 cellpadding="5" cellspacing="2">
  45. <tr><td align="center">Task Attempts</td><td>Status</td>
  46.   <%
  47.     for(TaskStatus status: tracker.getNonRunningTasks()) {
  48.       out.print("<tr><td>" + status.getTaskID() + "</td>");
  49.       out.print("<td>" + status.getRunState() + "</td></tr>n");
  50.     }
  51.   %>
  52. </table>
  53. <h2>Tasks from Running Jobs</h2>
  54. <center>
  55. <table border=2 cellpadding="5" cellspacing="2">
  56. <tr><td align="center">Task Attempts</td><td>Status</td>
  57.     <td>Progress</td><td>Errors</td></tr>
  58.   <%
  59.      itr = tracker.getTasksFromRunningJobs().iterator();
  60.      while (itr.hasNext()) {
  61.        TaskStatus status = (TaskStatus) itr.next();
  62.        out.print("<tr><td>" + status.getTaskID());
  63.        out.print("</td><td>" + status.getRunState()); 
  64.        out.print("</td><td>" + 
  65.                  StringUtils.formatPercent(status.getProgress(), 2));
  66.        out.print("</td><td><pre>" + status.getDiagnosticInfo() + "</pre></td>");
  67.        out.print("</tr>n");
  68.      }
  69.   %>
  70. </table>
  71. </center>
  72. <h2>Local Logs</h2>
  73. <a href="/logs/">Log</a> directory
  74. <%
  75. out.println(ServletUtil.htmlFooter());
  76. %>