hama-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From edwardy...@apache.org
Subject svn commit: r1103959 - in /incubator/hama/trunk: CHANGES.txt conf/hama-default.xml src/java/org/apache/hama/bsp/LocalBSPRunner.java
Date Tue, 17 May 2011 00:13:26 GMT
Author: edwardyoon
Date: Tue May 17 00:13:26 2011
New Revision: 1103959

URL: http://svn.apache.org/viewvc?rev=1103959&view=rev
Log:
Make the thread pool size user configurable

Modified:
    incubator/hama/trunk/CHANGES.txt
    incubator/hama/trunk/conf/hama-default.xml
    incubator/hama/trunk/src/java/org/apache/hama/bsp/LocalBSPRunner.java

Modified: incubator/hama/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/CHANGES.txt?rev=1103959&r1=1103958&r2=1103959&view=diff
==============================================================================
--- incubator/hama/trunk/CHANGES.txt (original)
+++ incubator/hama/trunk/CHANGES.txt Tue May 17 00:13:26 2011
@@ -11,6 +11,7 @@ Release 0.3 - Unreleased
 
   IMPROVEMENTS
 
+    HAMA-389: Make the thread pool size user configurable (Thomas Jungblut via edwardyoon)
     HAMA-386: Removing 'System.arraycopy(...)' call from ByteMessage (edwardyoon)
     HAMA-379: Setting default values to job.setNumBspTask() (Thomas Jungblut via edwardyoon)
     HAMA-376: Refactor BSPMaster and GroomServer (ChiaHung Lin via edwardyoon)

Modified: incubator/hama/trunk/conf/hama-default.xml
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/conf/hama-default.xml?rev=1103959&r1=1103958&r2=1103959&view=diff
==============================================================================
--- incubator/hama/trunk/conf/hama-default.xml (original)
+++ incubator/hama/trunk/conf/hama-default.xml Tue May 17 00:13:26 2011
@@ -83,6 +83,11 @@
     maximum virtual memory of the child processes. 
     </description>
   </property>
+    <property>
+    <name>bsp.local.tasks.maximum</name>
+    <value>20</value>
+    <description>Number of tasks that run in parallel when in local mode.</description>
+  </property>
 
   <!--
   Beginning of properties that are directly mapped from ZooKeeper's zoo.cfg.

Modified: incubator/hama/trunk/src/java/org/apache/hama/bsp/LocalBSPRunner.java
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/src/java/org/apache/hama/bsp/LocalBSPRunner.java?rev=1103959&r1=1103958&r2=1103959&view=diff
==============================================================================
--- incubator/hama/trunk/src/java/org/apache/hama/bsp/LocalBSPRunner.java (original)
+++ incubator/hama/trunk/src/java/org/apache/hama/bsp/LocalBSPRunner.java Tue May 17 00:13:26
2011
@@ -50,7 +50,7 @@ public class LocalBSPRunner implements J
   private static final String IDENTIFIER = "localrunner";
   private static String WORKING_DIR = "/user/hama/bsp/";
   protected static volatile ThreadPoolExecutor threadPool;
-  protected static final int threadPoolSize;
+  protected static int threadPoolSize;
   protected static final LinkedList<Future<BSP>> futureList = new LinkedList<Future<BSP>>();
   protected static CyclicBarrier barrier;
 
@@ -70,13 +70,6 @@ public class LocalBSPRunner implements J
   protected Configuration conf;
   protected FileSystem fs;
 
-  {
-    for (int i = 0; i < threadPoolSize; i++) {
-      String name = IDENTIFIER + " " + i;
-      localGrooms.put(name, new LocalGroom(name));
-    }
-  }
-
   public LocalBSPRunner(Configuration conf) throws IOException {
     super();
     this.conf = conf;
@@ -84,6 +77,18 @@ public class LocalBSPRunner implements J
     String path = conf.get("bsp.local.dir");
     if (path != null && !path.isEmpty())
       WORKING_DIR = path;
+
+    int overridenSize = conf.getInt("bsp.local.tasks.maximum", 20);
+    threadPoolSize = overridenSize;
+    threadPool = (ThreadPoolExecutor) Executors
+        .newFixedThreadPool(threadPoolSize);
+    barrier = new CyclicBarrier(threadPoolSize);
+
+    for (int i = 0; i < threadPoolSize; i++) {
+      String name = IDENTIFIER + " " + i;
+      localGrooms.put(name, new LocalGroom(name));
+    }
+
   }
 
   @Override



Mime
View raw message