You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by bu...@apache.org on 2014/03/10 16:32:37 UTC

[10/13] git commit: ACCUMULO-2005: Add a 3rd argument to functional test RunTests.java to allow a timeout factor for mapred.task.timeout and run.py -f flag

ACCUMULO-2005: Add a 3rd argument to functional test RunTests.java to allow a timeout factor for mapred.task.timeout and run.py -f flag

(reimplemented for 1.5.x branch)

Signed-off-by: Sean Busbey <bu...@cloudera.com>


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/bc9cee0c
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/bc9cee0c
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/bc9cee0c

Branch: refs/heads/1.5.2-SNAPSHOT
Commit: bc9cee0c02952a0ba6d4c96f71204e84a5acb701
Parents: 32dc104
Author: Hung Pham <hp...@cloudera.com>
Authored: Sun Feb 9 18:07:30 2014 -0500
Committer: Sean Busbey <bu...@cloudera.com>
Committed: Mon Mar 10 09:23:32 2014 -0500

----------------------------------------------------------------------
 .../accumulo/test/functional/RunTests.java      | 21 +++++++++++++++++---
 test/system/auto/README                         | 10 ++++++++++
 2 files changed, 28 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/bc9cee0c/test/src/main/java/org/apache/accumulo/test/functional/RunTests.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/RunTests.java b/test/src/main/java/org/apache/accumulo/test/functional/RunTests.java
index 0f4dd8e..b70afd1 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/RunTests.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/RunTests.java
@@ -76,19 +76,26 @@ public class RunTests extends Configured implements Tool {
   private static final Logger log = Logger.getLogger(RunTests.class);
   
   private Job job = null;
-  
+
+  private static final int DEFAULT_TIMEOUT_FACTOR = 1;
+
   static class Opts extends Help {
     @Parameter(names="--tests", description="newline separated list of tests to run", required=true)
     String testFile;
     @Parameter(names="--output", description="destination for the results of tests in HDFS", required=true)
     String outputPath;
+    @Parameter(names="--timeoutFactor", description="Optional scaling factor for timeout for both mapred.task.timeout and -f flag on run.py", required=false)
+    Integer intTimeoutFactor = DEFAULT_TIMEOUT_FACTOR;
   }
   
+  static final String TIMEOUT_FACTOR = RunTests.class.getName() + ".timeoutFactor";
+
   static public class TestMapper extends Mapper<LongWritable,Text,Text,Text> {
     
     private static final String REDUCER_RESULT_START = "::::: ";
     private static final int RRS_LEN = REDUCER_RESULT_START.length();
     private Text result = new Text();
+    String mapperTimeoutFactor = null;
 
     private static enum Outcome {
       SUCCESS, FAILURE, ERROR, UNEXPECTED_SUCCESS, EXPECTED_FAILURE
@@ -105,7 +112,7 @@ public class RunTests extends Configured implements Tool {
 
     @Override
     protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
-      List<String> cmd = Arrays.asList("/usr/bin/python", "test/system/auto/run.py", "-m", "-t", value.toString());
+      List<String> cmd = Arrays.asList("/usr/bin/python", "test/system/auto/run.py", "-m", "-f", mapperTimeoutFactor, "-t", value.toString());
       log.info("Running test " + cmd);
       ProcessBuilder pb = new ProcessBuilder(cmd);
       pb.directory(new File(context.getConfiguration().get("accumulo.home")));
@@ -140,6 +147,10 @@ public class RunTests extends Configured implements Tool {
       p.waitFor();
     }
     
+    @Override
+    protected void setup(Mapper.Context context) throws IOException, InterruptedException {
+      mapperTimeoutFactor = Integer.toString(context.getConfiguration().getInt(TIMEOUT_FACTOR, DEFAULT_TIMEOUT_FACTOR));
+    }
   }
   
   @Override
@@ -153,7 +164,11 @@ public class RunTests extends Configured implements Tool {
     Configuration conf = job.getConfiguration();
     conf.setInt("mapred.max.split.size", 40);
     conf.set("accumulo.home", System.getenv("ACCUMULO_HOME"));
-    conf.setInt("mapred.task.timeout", 8 * 60 * 1000);
+
+    // Taking third argument as scaling factor to setting mapred.task.timeout
+    // and TIMEOUT_FACTOR
+    conf.setInt("mapred.task.timeout", opts.intTimeoutFactor * 8 * 60 * 1000);
+    conf.setInt(TIMEOUT_FACTOR, opts.intTimeoutFactor);
     conf.setBoolean("mapred.map.tasks.speculative.execution", false);
     
     // set input

http://git-wip-us.apache.org/repos/asf/accumulo/blob/bc9cee0c/test/system/auto/README
----------------------------------------------------------------------
diff --git a/test/system/auto/README b/test/system/auto/README
index 41f6159..c12ca68 100644
--- a/test/system/auto/README
+++ b/test/system/auto/README
@@ -69,6 +69,16 @@ cluster at your disposal, you can run the tests as a MapReduce job:
 The example above runs every test. You can trim the tests file to include
 only the tests you wish to run.
 
+You may specify a 'timeout factor' via an optional integer argument:
+
+ $ ./bin/accumulo org.apache.accumulo.test.functional.RunTests --tests \
+   /user/hadoop/tests --output /user/hadoop/results --timeoutFactor <integer>
+
+Where 'timeout_factor' indicates how much we should scale up timeouts. It will
+be used to set both mapred.task.timeout and the "-f" flag used by run.py. If
+not given, 'timeout_factor' defaults to 1, which corresponds to a
+mapred.task.timeout of 480 seconds.
+
 In some clusters, the user under which MR jobs run is different from the user
 under which Accumulo is installed, and this can cause failures running the
 tests. Various configuration and permission changes can be made to help the