hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cutt...@apache.org
Subject svn commit: r393641 - in /lucene/hadoop/trunk/src: java/org/apache/hadoop/mapred/ webapps/mapred/
Date Wed, 12 Apr 2006 23:04:36 GMT
Author: cutting
Date: Wed Apr 12 16:04:33 2006
New Revision: 393641

URL: http://svn.apache.org/viewcvs?rev=393641&view=rev
Log:
Fix for HADOOP-92.  Show information about all attempts to run each task in the web ui.  Contributed
by Mahadev konar.

Added:
    lucene/hadoop/trunk/src/webapps/mapred/taskdetails.jsp
Modified:
    lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobInProgress.java
    lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobTracker.java
    lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/TaskInProgress.java
    lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/TaskStatus.java
    lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/TaskTracker.java
    lucene/hadoop/trunk/src/webapps/mapred/jobdetails.jsp

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobInProgress.java
URL: http://svn.apache.org/viewcvs/lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobInProgress.java?rev=393641&r1=393640&r2=393641&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobInProgress.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobInProgress.java Wed Apr 12 16:04:33
2006
@@ -490,4 +490,21 @@
         LOG.warning("Error cleaning up "+profile.getJobId()+": "+e);
       }
     }
+
+    /**
+      * Return the TaskInProgress that matches the tipid.
+      */
+    public TaskInProgress getTaskInProgress(String tipid){
+        for (int i = 0; i < maps.length; i++) {
+	    if (tipid.equals(maps[i].getTIPId())){
+                return maps[i];
+	    }               
+	}
+	for (int i = 0; i < reduces.length; i++) {
+	    if (tipid.equals(reduces[i].getTIPId())){
+		return reduces[i];
+            }
+	}
+	return null;
+    }
 }

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobTracker.java
URL: http://svn.apache.org/viewcvs/lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobTracker.java?rev=393641&r1=393640&r2=393641&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobTracker.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobTracker.java Wed Apr 12 16:04:33
2006
@@ -825,6 +825,19 @@
         }
     }
 
+    /** Get all the TaskStatuses from the tipid. */
+    TaskStatus[] getTaskStatuses(String jobid, String tipid){
+	JobInProgress job = (JobInProgress) jobs.get(jobid);
+	if (job == null){
+	    return new TaskStatus[0];
+	}
+	TaskInProgress tip = (TaskInProgress) job.getTaskInProgress(tipid);
+	if (tip == null){
+	    return new TaskStatus[0];
+	}
+	return tip.getTaskStatuses();
+    }
+
     ///////////////////////////////////////////////////////////////
     // JobTracker methods
     ///////////////////////////////////////////////////////////////
@@ -851,6 +864,7 @@
     void updateTaskStatuses(TaskTrackerStatus status) {
         for (Iterator it = status.taskReports(); it.hasNext(); ) {
             TaskStatus report = (TaskStatus) it.next();
+            report.setHostname(status.getHost());
             TaskInProgress tip = (TaskInProgress) taskidToTIPMap.get(report.getTaskId());
             if (tip == null) {
                 LOG.info("Serious problem.  While updating status, cannot find taskid " +
report.getTaskId());

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/TaskInProgress.java
URL: http://svn.apache.org/viewcvs/lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/TaskInProgress.java?rev=393641&r1=393640&r2=393641&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/TaskInProgress.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/TaskInProgress.java Wed Apr 12 16:04:33
2006
@@ -307,6 +307,13 @@
     }
 
     /**
+     * Get the Status of the tasks managed by this TIP
+     */
+    public TaskStatus[] getTaskStatuses() {
+	return (TaskStatus[])taskStatuses.values().toArray(new TaskStatus[taskStatuses.size()]);
+    }
+
+     /**
      * The TIP's been ordered kill()ed.
      */
     public void kill() {

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/TaskStatus.java
URL: http://svn.apache.org/viewcvs/lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/TaskStatus.java?rev=393641&r1=393640&r2=393641&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/TaskStatus.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/TaskStatus.java Wed Apr 12 16:04:33
2006
@@ -37,16 +37,20 @@
     private int runState;
     private String diagnosticInfo;
     private String stateString;
+    private String hostname;
 
     public TaskStatus() {}
 
-    public TaskStatus(String taskid, boolean isMap, float progress, int runState, String
diagnosticInfo, String stateString) {
+    public TaskStatus(String taskid, boolean isMap, float progress,
+                      int runState, String diagnosticInfo,
+                      String stateString, String hostname) {
         this.taskid = taskid;
         this.isMap = isMap;
         this.progress = progress;
         this.runState = runState;
         this.diagnosticInfo = diagnosticInfo;
         this.stateString = stateString;
+	this.hostname = hostname;
     }
     
     public String getTaskId() { return taskid; }
@@ -54,6 +58,8 @@
     public float getProgress() { return progress; }
     public void setProgress(float progress) { this.progress = progress; } 
     public int getRunState() { return runState; }
+    public String getHostname() {return hostname;}
+    public void setHostname(String host) { this.hostname = host;}
     public void setRunState(int runState) { this.runState = runState; }
     public String getDiagnosticInfo() { return diagnosticInfo; }
     public void setDiagnosticInfo(String info) { this.diagnosticInfo = info; }

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/TaskTracker.java
URL: http://svn.apache.org/viewcvs/lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/TaskTracker.java?rev=393641&r1=393640&r2=393641&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/TaskTracker.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/TaskTracker.java Wed Apr 12 16:04:33
2006
@@ -422,7 +422,7 @@
         /**
          */
         public TaskStatus createStatus() {
-            TaskStatus status = new TaskStatus(task.getTaskId(), task.isMapTask(), progress,
runstate, diagnosticInfo.toString(), (stateString == null) ? "" : stateString);
+            TaskStatus status = new TaskStatus(task.getTaskId(), task.isMapTask(), progress,
runstate, diagnosticInfo.toString(), (stateString == null) ? "" : stateString, "");
             if (diagnosticInfo.length() > 0) {
                 diagnosticInfo = new StringBuffer();
             }

Modified: lucene/hadoop/trunk/src/webapps/mapred/jobdetails.jsp
URL: http://svn.apache.org/viewcvs/lucene/hadoop/trunk/src/webapps/mapred/jobdetails.jsp?rev=393641&r1=393640&r2=393641&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/webapps/mapred/jobdetails.jsp (original)
+++ lucene/hadoop/trunk/src/webapps/mapred/jobdetails.jsp Wed Apr 12 16:04:33 2006
@@ -45,17 +45,16 @@
 <h2>Map Tasks</h2>
   <center>
   <table border=2 cellpadding="5" cellspacing="2">
-  <tr><td align="center">Task Id</td><td>Complete</td><td>State</td><td>Errors</td></tr>
+  <tr><td align="center">Task</td><td>Complete</td><td>Status</td><td>Errors</td></tr>
 
   <%
 
     for (int i = 0; i < mapTaskReports.length; i++) {
       TaskReport report = mapTaskReports[i];
 
-      out.print("<tr><td>" + report.getTaskId() + "</td>");
+      out.print("<tr><td><a href=\"taskdetails.jsp?jobid=" + jobid + "&taskid="
+ report.getTaskId() + "\">"  + report.getTaskId() + "</a></td>");
       out.print("<td>" + report.getProgress() + "</td>");
-      out.print("<td>" + report.getState() + "</td>");
-
+      out.print("<td>"  + report.getState() + "</td>");
       String[] diagnostics = report.getDiagnostics();
       for (int j = 0; j < diagnostics.length ; j++) {
         out.print("<td>" + diagnostics[j] + "</td>");
@@ -71,13 +70,13 @@
 <h2>Reduce Tasks</h2>
   <center>
   <table border=2 cellpadding="5" cellspacing="2">
-  <tr><td align="center">Task Id</td><td>Complete</td><td>State</td><td>Errors</td></tr>
+  <tr><td align="center">Task</td><td>Complete</td><td>State</td><td>Errors</td></tr>
 
   <%
     for (int i = 0; i < reduceTaskReports.length; i++) {
       TaskReport report = reduceTaskReports[i];
 
-      out.print("<tr><td>" + report.getTaskId() + "</td>");
+      out.print("<tr><td><a href=\"taskdetails.jsp?jobid=" + jobid + "&taskid="
+ report.getTaskId() + "\">" + report.getTaskId() + "</a></td>");
       out.print("<td>" + report.getProgress() + "</td>");
       out.print("<td>" + report.getState() + "</td>");
 

Added: lucene/hadoop/trunk/src/webapps/mapred/taskdetails.jsp
URL: http://svn.apache.org/viewcvs/lucene/hadoop/trunk/src/webapps/mapred/taskdetails.jsp?rev=393641&view=auto
==============================================================================
--- lucene/hadoop/trunk/src/webapps/mapred/taskdetails.jsp (added)
+++ lucene/hadoop/trunk/src/webapps/mapred/taskdetails.jsp Wed Apr 12 16:04:33 2006
@@ -0,0 +1,76 @@
+<%@ page
+  contentType="text/html; charset=UTF-8"
+  import="javax.servlet.*"
+  import="javax.servlet.http.*"
+  import="java.io.*"
+  import="java.lang.String"
+  import="java.util.*"
+  import="org.apache.hadoop.mapred.*"
+%>
+<%
+  String jobid = request.getParameter("jobid");
+  JobTracker tracker = JobTracker.getTracker();
+  JobInProgress job = (JobInProgress) tracker.getJob(jobid);
+  String taskid = request.getParameter("taskid");
+  TaskStatus[] ts = (job != null) ? tracker.getTaskStatuses(jobid, taskid): null;
+%>
+
+<%! 
+  public void writeString(JspWriter out, int state) throws IOException{
+    String sstate;
+    if (state == TaskStatus.RUNNING){
+      sstate = "RUNNING";
+    }
+    else if (state == TaskStatus.SUCCEEDED){
+      sstate = "SUCCEDED";
+    }
+    else if (state == TaskStatus.FAILED){
+      sstate = "FAILED";
+    }
+    else if (state == TaskStatus.UNASSIGNED){
+      sstate = "UNASSIGNED";
+    }
+    else{
+      sstate = "ERROR IN STATUS";
+   }
+    out.print(sstate);
+  }
+%>
+
+<html>
+<title>Hadoop Task Details</title>
+<body>
+<h1>Job '<%=jobid%>'</h1>
+
+<hr>
+
+<h2>All Task Attempts</h2>
+<center>
+<table border=2 cellpadding="5" cellspacing="2">
+<tr><td align="center">Task Attempts</td><td>Machine</td><td>Status</td><td>Errors</td></tr>
+
+  <%
+    for (int i = 0; i < ts.length; i++) {
+      TaskStatus status = ts[i];
+      out.print("<tr><td>" + status.getTaskId() + "</td>");
+      out.print("<td>" + status.getHostname() + "</td>");
+      out.print("<td>");
+      writeString(out, status.getRunState()); 
+      out.print("</td>");
+      out.print("<td>" + status.getDiagnosticInfo() + "</td>");
+      out.print("</tr>\n");
+    }
+  %>
+</table>
+</center>
+
+<hr>
+<%
+out.print("<a href=\"/jobdetails.jsp?jobid=" + jobid + "\">" + "Go back to the Job"
+ "</a><br>");	
+%>
+<a href="http://lucene.apache.org/hadoop">Hadoop</a>, 2006.<br>
+<hr>
+<a href="/jobtracker.jsp">Go back to JobTracker</a><br>
+<a href="http://lucene.apache.org/hadoop">Hadoop</a>, 2006.<br>
+</body>
+</html>



Mime
View raw message