hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From omal...@apache.org
Subject svn commit: r1077503 - in /hadoop/common/branches/branch-0.20-security-patches/src: mapred/org/apache/hadoop/mapred/ test/org/apache/hadoop/mapred/ webapps/job/
Date Fri, 04 Mar 2011 04:21:30 GMT
Author: omalley
Date: Fri Mar  4 04:21:29 2011
New Revision: 1077503

URL: http://svn.apache.org/viewvc?rev=1077503&view=rev
Log:
commit ab6ab8740de71afb8832c23c809c169222403b47
Author: Arun C Murthy <acmurthy@apache.org>
Date:   Mon Jun 14 14:25:19 2010 -0700

    MAPREDUCE-1850. Add information about the host from which a job is submitted. Contributed
by Krishna Ramachandran.
    
    +++ b/YAHOO-CHANGES.txt
    +    MAPREDUCE-1850. Add information about the host from which a job is
    +    submitted. (Krishna Ramachandran via acmurthy)
    +

Modified:
    hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/mapred/JobClient.java
    hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/mapred/JobConf.java
    hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/mapred/JobInProgress.java
    hadoop/common/branches/branch-0.20-security-patches/src/test/org/apache/hadoop/mapred/TestEmptyJob.java
    hadoop/common/branches/branch-0.20-security-patches/src/webapps/job/jobdetails.jsp

Modified: hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/mapred/JobClient.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/mapred/JobClient.java?rev=1077503&r1=1077502&r2=1077503&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/mapred/JobClient.java
(original)
+++ hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/mapred/JobClient.java
Fri Mar  4 04:21:29 2011
@@ -773,6 +773,11 @@ public class JobClient extends Configure
 
           Path submitJobFile = JobSubmissionFiles.getJobConfPath(submitJobDir);
           int reduces = jobCopy.getNumReduceTasks();
+          InetAddress ip = InetAddress.getLocalHost();
+          if (ip != null) {
+            job.setJobSubmitHostAddress(ip.getHostAddress());
+            job.setJobSubmitHostName(ip.getHostName());
+          }
           JobContext context = new JobContext(jobCopy, jobId);
 
           jobCopy = (JobConf)context.getConfiguration();

Modified: hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/mapred/JobConf.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/mapred/JobConf.java?rev=1077503&r1=1077502&r2=1077503&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/mapred/JobConf.java
(original)
+++ hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/mapred/JobConf.java
Fri Mar  4 04:21:29 2011
@@ -1414,6 +1414,46 @@ public class JobConf extends Configurati
   }
 
   /**
+   * Set {@link JobSubmitHostName} for this job.
+   * 
+   * @param prio the {@link JobSubmitHostName} for this job.
+   */
+  void setJobSubmitHostName(String hostname) {
+    set("mapreduce.job.submithost", hostname);
+  }
+  
+  /**
+   * Get the {@link JobSubmitHostName} for this job.
+   * 
+   * @return the {@link JobSubmitHostName} for this job.
+   */
+  String getJobSubmitHostName() {
+    String hostname = get("mapreduce.job.submithost");
+    
+    return hostname;
+  }
+
+  /**
+   * Set {@link JobSubmitHostAddress} for this job.
+   * 
+   * @param prio the {@link JobSubmitHostAddress} for this job.
+   */
+  void setJobSubmitHostAddress(String hostadd) {
+    set("mapreduce.job.submithostaddress", hostadd);
+  }
+  
+  /**
+   * Get the {@link JobSubmitHostAddress} for this job.
+   * 
+   * @return the {@link JobSubmitHostAddress} for this job.
+   */
+  String getJobSubmitHostAddress() {
+    String hostadd = get("mapreduce.job.submithostaddress");
+    
+    return hostadd;
+  }
+
+  /**
    * Get whether the task profiling is enabled.
    * @return true if some tasks will be profiled
    */

Modified: hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/mapred/JobInProgress.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/mapred/JobInProgress.java?rev=1077503&r1=1077502&r2=1077503&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/mapred/JobInProgress.java
(original)
+++ hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/mapred/JobInProgress.java
Fri Mar  4 04:21:29 2011
@@ -213,6 +213,8 @@ public class JobInProgress {
   volatile private boolean hasSpeculativeMaps;
   volatile private boolean hasSpeculativeReduces;
   private long inputLength = 0;
+  private String submitHostName;
+  private String submitHostAddress;
   private String user;
   private String historyFile = "";
   private boolean historyFileCopied;
@@ -369,6 +371,8 @@ public class JobInProgress {
                                   jobFile, url, conf.getJobName(),
                                   conf.getQueueName());
 
+    this.submitHostName = conf.getJobSubmitHostName();
+    this.submitHostAddress = conf.getJobSubmitHostAddress();
     this.numMapTasks = conf.getNumMapTasks();
     this.numReduceTasks = conf.getNumReduceTasks();
     
@@ -3059,6 +3063,20 @@ public class JobInProgress {
     return jobId;
   }
   
+  /**
+   * @return submitHostName  of this JobInProgress.
+   */
+  public String getJobSubmitHostName() {
+    return this.submitHostName;
+  }
+  
+  /**
+   * @return submitHostAddress  of this JobInProgress.
+   */
+  public String getJobSubmitHostAddress() {
+    return this.submitHostAddress;
+  }
+
   public synchronized Object getSchedulingInfo() {
     return this.schedulingInfo;
   }

Modified: hadoop/common/branches/branch-0.20-security-patches/src/test/org/apache/hadoop/mapred/TestEmptyJob.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-patches/src/test/org/apache/hadoop/mapred/TestEmptyJob.java?rev=1077503&r1=1077502&r2=1077503&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-patches/src/test/org/apache/hadoop/mapred/TestEmptyJob.java
(original)
+++ hadoop/common/branches/branch-0.20-security-patches/src/test/org/apache/hadoop/mapred/TestEmptyJob.java
Fri Mar  4 04:21:29 2011
@@ -21,6 +21,7 @@ package org.apache.hadoop.mapred;
 import java.io.File;
 import java.io.IOException;
 import java.net.URI;
+import java.net.InetAddress;
 
 import junit.framework.TestCase;
 
@@ -116,7 +117,14 @@ public class TestEmptyJob extends TestCa
     JobClient jc = new JobClient(conf);
     RunningJob runningJob = jc.submitJob(conf);
     JobInProgress job = mr.getJobTrackerRunner().getJobTracker().getJob(runningJob.getID());
-    
+
+    InetAddress ip = InetAddress.getLocalHost();
+    if (ip != null) {
+      assertTrue(job.getJobSubmitHostAddress().equalsIgnoreCase(
+          ip.getHostAddress()));
+      assertTrue(job.getJobSubmitHostName().equalsIgnoreCase(ip.getHostName()));
+    }
+
     while (true) {
       if (job.isCleanupLaunched()) {
         LOG.info("Waiting for cleanup to be launched for job " 

Modified: hadoop/common/branches/branch-0.20-security-patches/src/webapps/job/jobdetails.jsp
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-patches/src/webapps/job/jobdetails.jsp?rev=1077503&r1=1077502&r2=1077503&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-patches/src/webapps/job/jobdetails.jsp (original)
+++ hadoop/common/branches/branch-0.20-security-patches/src/webapps/job/jobdetails.jsp Fri
Mar  4 04:21:29 2011
@@ -283,6 +283,10 @@
         HtmlQuoting.quoteHtmlChars(profile.getJobName()) + "<br>\n");
     out.print("<b>Job File:</b> <a href=\"jobconf.jsp?jobid=" + jobId + "\">"
+
         profile.getJobFile() + "</a><br>\n");
+    out.print("<b>Submit Host:</b> " +
+        HtmlQuoting.quoteHtmlChars(job.getJobSubmitHostName()) + "<br>\n");
+    out.print("<b>Submit Host Address:</b> " +
+        HtmlQuoting.quoteHtmlChars(job.getJobSubmitHostAddress()) + "<br>\n");
 
     Map<JobACL, AccessControlList> jobAcls = status.getJobACLs();
     JSPUtil.printJobACLs(tracker, jobAcls, out);



Mime
View raw message