hadoop-mapreduce-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject svn commit: r1078708 - in /hadoop/mapreduce/trunk: CHANGES.txt src/contrib/fairscheduler/src/test/org/apache/hadoop/mapred/TestFairSchedulerSystem.java
Date Mon, 07 Mar 2011 07:57:37 GMT
Author: todd
Date: Mon Mar  7 07:57:37 2011
New Revision: 1078708

URL: http://svn.apache.org/viewvc?rev=1078708&view=rev
Log:
MAPREDUCE-2331. Add coverage of task graph servlet to fair scheduler system test. Contributed
by Todd Lipcon

Modified:
    hadoop/mapreduce/trunk/CHANGES.txt
    hadoop/mapreduce/trunk/src/contrib/fairscheduler/src/test/org/apache/hadoop/mapred/TestFairSchedulerSystem.java

Modified: hadoop/mapreduce/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/CHANGES.txt?rev=1078708&r1=1078707&r2=1078708&view=diff
==============================================================================
--- hadoop/mapreduce/trunk/CHANGES.txt (original)
+++ hadoop/mapreduce/trunk/CHANGES.txt Mon Mar  7 07:57:37 2011
@@ -57,6 +57,9 @@ Trunk (unreleased changes)
     MAPREDUCE-2239. BlockPlacementPolicyRaid should call getBlockLocations
     only when necessary. (schen)
 
+    MAPREDUCE-2331. Add coverage of task graph servlet to fair scheduler system
+    test. (todd)
+
   OPTIMIZATIONS
     
     MAPREDUCE-2026. Make JobTracker.getJobCounters() and

Modified: hadoop/mapreduce/trunk/src/contrib/fairscheduler/src/test/org/apache/hadoop/mapred/TestFairSchedulerSystem.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/src/contrib/fairscheduler/src/test/org/apache/hadoop/mapred/TestFairSchedulerSystem.java?rev=1078708&r1=1078707&r2=1078708&view=diff
==============================================================================
--- hadoop/mapreduce/trunk/src/contrib/fairscheduler/src/test/org/apache/hadoop/mapred/TestFairSchedulerSystem.java
(original)
+++ hadoop/mapreduce/trunk/src/contrib/fairscheduler/src/test/org/apache/hadoop/mapred/TestFairSchedulerSystem.java
Mon Mar  7 07:57:37 2011
@@ -102,6 +102,8 @@ public class TestFairSchedulerSystem {
           }));
     }
 
+    JobClient jc = new JobClient(mr.createJobConf(null));
+
     // Wait for the tasks to finish, and visit the scheduler servlet
     // every few seconds while waiting.
     for (Future<Void> future : futures) {
@@ -114,6 +116,16 @@ public class TestFairSchedulerSystem {
         }
         checkServlet(true);
         checkServlet(false);
+
+        JobStatus jobs[] = jc.getAllJobs();
+        if (jobs == null) {
+          System.err.println("No jobs running, not checking tasklog servlet");
+          continue;
+        }
+        for (JobStatus j : jobs) {
+          System.err.println("Checking task log for " + j.getJobID());
+          checkTaskGraphServlet(j.getJobID());
+        }
       }
     }
   }
@@ -144,5 +156,32 @@ public class TestFairSchedulerSystem {
 
     String contents = sb.toString();
     assertTrue(contents.contains("Fair Scheduler Administration"));
- }
+  }
+
+  private void checkTaskGraphServlet(JobID job) throws Exception {
+    String jtURL = "http://localhost:" +
+      mr.getJobTrackerRunner().getJobTrackerInfoPort();
+    URL url = new URL(jtURL + "/taskgraph?jobid=" + job.toString() + "&type=map");
+    HttpURLConnection connection = (HttpURLConnection)url.openConnection();
+    connection.setRequestMethod("GET");
+    connection.connect();
+    assertEquals(200, connection.getResponseCode());
+
+    // Just to be sure, slurp the content and make sure it looks like the scheduler
+    String contents = slurpContents(connection);
+    assertTrue(contents.contains("</svg>"));
+  }
+
+  private String slurpContents(HttpURLConnection connection) throws Exception {
+    BufferedReader reader = new BufferedReader(
+      new InputStreamReader(connection.getInputStream()));
+    StringBuilder sb = new StringBuilder();
+
+    String line = null;
+    while ((line = reader.readLine()) != null) {
+      sb.append(line).append('\n');
+    }
+
+    return sb.toString();
+  }
 }



Mime
View raw message