hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acmur...@apache.org
Subject svn commit: r610910 [3/3] - in /lucene/hadoop/trunk: ./ conf/ docs/ src/contrib/streaming/src/java/org/apache/hadoop/streaming/ src/docs/src/documentation/content/xdocs/ src/java/org/apache/hadoop/mapred/
Date Thu, 10 Jan 2008 20:09:02 GMT
Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobConf.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobConf.java?rev=610910&r1=610909&r2=610910&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobConf.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobConf.java Thu Jan 10 12:09:01
2008
@@ -828,6 +828,9 @@
   }
   
   /**
+   * @deprecated Use {{@link #getMapSpeculativeExecution()} or
+   *             {@link #getReduceSpeculativeExecution()} instead.
+   * 
    * Should speculative execution be used for this job? 
    * Defaults to <code>true</code>.
    * 
@@ -839,6 +842,9 @@
   }
   
   /**
+   * @deprecated Use {@link #setMapSpeculativeExecution(boolean)} or
+   *                 {@link #setReduceSpeculativeExecution(boolean)} instead. 
+   * 
    * Turn speculative execution on or off for this job. 
    * 
    * @param speculativeExecution <code>true</code> if speculative execution 
@@ -847,7 +853,54 @@
   public void setSpeculativeExecution(boolean speculativeExecution) {
     setBoolean("mapred.speculative.execution", speculativeExecution);
   }
+
+  /**
+   * Should speculative execution be used for this job for map tasks? 
+   * Defaults to <code>true</code>.
+   * 
+   * @return <code>true</code> if speculative execution be 
+   *                           used for this job for map tasks,
+   *         <code>false</code> otherwise.
+   */
+  public boolean getMapSpeculativeExecution() { 
+    return getBoolean("mapred.map.tasks.speculative.execution", true);
+  }
   
+  /**
+   * Turn speculative execution on or off for this job for map tasks. 
+   * 
+   * @param speculativeExecution <code>true</code> if speculative execution 
+   *                             should be turned on for map tasks,
+   *                             else <code>false</code>.
+   */
+  public void setMapSpeculativeExecution(boolean speculativeExecution) {
+    setBoolean("mapred.map.tasks.speculative.execution", speculativeExecution);
+  }
+
+  /**
+   * Should speculative execution be used for this job for reduce tasks? 
+   * Defaults to <code>true</code>.
+   * 
+   * @return <code>true</code> if speculative execution be used 
+   *                           for reduce tasks for this job,
+   *         <code>false</code> otherwise.
+   */
+  public boolean getReduceSpeculativeExecution() { 
+    return getBoolean("mapred.reduce.tasks.speculative.execution", true);
+  }
+  
+  /**
+   * Turn speculative execution on or off for this job for reduce tasks. 
+   * 
+   * @param speculativeExecution <code>true</code> if speculative execution 
+   *                             should be turned on for reduce tasks,
+   *                             else <code>false</code>.
+   */
+  public void setReduceSpeculativeExecution(boolean speculativeExecution) {
+    setBoolean("mapred.reduce.tasks.speculative.execution", 
+               speculativeExecution);
+  }
+
   /**
    * Get configured the number of reduce tasks for this job.
    * Defaults to <code>1</code>.

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/TaskInProgress.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/TaskInProgress.java?rev=610910&r1=610909&r2=610910&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 Thu Jan 10 12:09:01
2008
@@ -131,6 +131,7 @@
     this.conf = conf;
     this.partition = partition;
     setMaxTaskAttempts();
+    this.runSpeculative = conf.getMapSpeculativeExecution();
     init(JobTracker.getJobUniqueString(jobid));
   }
         
@@ -148,8 +149,10 @@
     this.job = job;
     this.conf = conf;
     setMaxTaskAttempts();
+    this.runSpeculative = conf.getReduceSpeculativeExecution();
     init(JobTracker.getJobUniqueString(jobid));
   }
+  
   /**
    * Set the max number of attempts before we declare a TIP as "failed"
    */
@@ -201,7 +204,11 @@
    */
   void init(String jobUniqueString) {
     this.startTime = System.currentTimeMillis();
-    this.runSpeculative = conf.getSpeculativeExecution();
+    if ("true".equals(conf.get("mapred.speculative.execution"))) {
+      this.runSpeculative = true;
+    } else if ("false".equals(conf.get("mapred.speculative.execution"))) {
+      this.runSpeculative = false;
+    }
     this.taskIdPrefix = makeUniqueString(jobUniqueString);
     this.id = "tip_" + this.taskIdPrefix;
   }



Mime
View raw message