incubator-hama-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From edwardy...@apache.org
Subject svn commit: r1065910 - in /incubator/hama/trunk: CHANGES.txt conf/hama-default.xml src/java/org/apache/hama/bsp/TaskRunner.java
Date Tue, 01 Feb 2011 05:50:34 GMT
Author: edwardyoon
Date: Tue Feb  1 05:50:34 2011
New Revision: 1065910

URL: http://svn.apache.org/viewvc?rev=1065910&view=rev
Log:
Remove hard-coded javaOpts for Child processors

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

Modified: incubator/hama/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/CHANGES.txt?rev=1065910&r1=1065909&r2=1065910&view=diff
==============================================================================
--- incubator/hama/trunk/CHANGES.txt (original)
+++ incubator/hama/trunk/CHANGES.txt Tue Feb  1 05:50:34 2011
@@ -51,6 +51,7 @@ Trunk (unreleased changes)
 
   IMPROVEMENTS
  
+    HAMA-348: Remove hard-coded javaOpts (edwardyoon)
     HAMA-347: Add implementation of umbilical interface (edwardyoon)
     HAMA-346: Modify MniCluster so that developers can benefit when testing using Junit
                        (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=1065910&r1=1065909&r2=1065910&view=diff
==============================================================================
--- incubator/hama/trunk/conf/hama-default.xml (original)
+++ incubator/hama/trunk/conf/hama-default.xml Tue Feb  1 05:50:34 2011
@@ -69,6 +69,20 @@
     <value>/tmp/hama-${user.name}</value>
     <description>Temporary directory on the local filesystem.</description>
   </property>
+  <property>
+    <name>bsp.child.java.opts</name>
+    <value>-Xmx200m</value>
+    <description>Java opts for the groom server child processes.  
+    The following symbol, if present, will be interpolated: @taskid@ is replaced 
+    by current TaskID. Any other occurrences of '@' will go unchanged.
+    For example, to enable verbose gc logging to a file named for the taskid in
+    /tmp and to set the heap maximum to be a gigabyte, pass a 'value' of:
+          -Xmx1024m -verbose:gc -Xloggc:/tmp/@taskid@.gc
+  
+    The configuration variable bsp.child.ulimit can be used to control the
+    maximum virtual memory of the child processes. 
+    </description>
+  </property>
 
   <!--
   Beginning of properties that are directly mapped from ZooKeeper's zoo.cfg.

Modified: incubator/hama/trunk/src/java/org/apache/hama/bsp/TaskRunner.java
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/src/java/org/apache/hama/bsp/TaskRunner.java?rev=1065910&r1=1065909&r2=1065910&view=diff
==============================================================================
--- incubator/hama/trunk/src/java/org/apache/hama/bsp/TaskRunner.java (original)
+++ incubator/hama/trunk/src/java/org/apache/hama/bsp/TaskRunner.java Tue Feb  1 05:50:34
2011
@@ -94,10 +94,10 @@ public class TaskRunner extends Thread {
       new File(new File(System.getProperty("java.home"), "bin"), "java");
       vargs.add(jvm.toString());
 
-      String javaOpts = handleDeprecatedHeapSize("-Xmx500m", // TODO move to
-                                                             // config file
-          conf.get("bsp.child.heap.size"));
-      javaOpts = replaceAll(javaOpts, "@taskid@", task.getTaskID().toString());
+      // bsp.child.java.opts
+      String javaOpts = conf.getConf().get("bsp.child.java.opts", "-Xmx200m");
+      javaOpts = javaOpts.replace("@taskid@", task.getTaskID().toString());
+      
       String[] javaOptsSplit = javaOpts.split(" ");
       for (int i = 0; i < javaOptsSplit.length; i++) {
         vargs.add(javaOptsSplit[i]);
@@ -122,62 +122,6 @@ public class TaskRunner extends Thread {
   }
 
   /**
-   * Handle deprecated mapred.child.heap.size. If present, interpolate into
-   * mapred.child.java.opts value with warning.
-   * 
-   * @param javaOpts Value of mapred.child.java.opts property.
-   * @param heapSize Value of mapred.child.heap.size property.
-   * @return A <code>javaOpts</code> with <code>heapSize</code> interpolated
if
-   *         present.
-   */
-  private String handleDeprecatedHeapSize(String javaOpts, final String heapSize) {
-    if (heapSize == null || heapSize.length() <= 0) {
-      return javaOpts;
-    }
-    final String MX = "-Xmx";
-    int index = javaOpts.indexOf(MX);
-    if (index < 0) {
-      javaOpts = javaOpts + " " + MX + heapSize;
-    } else {
-      int end = javaOpts.indexOf(" ", index + MX.length());
-      javaOpts = javaOpts.substring(0, index + MX.length()) + heapSize
-          + ((end < 0) ? "" : javaOpts.substring(end));
-    }
-    LOG.warn("mapred.child.heap.size is deprecated. Use "
-        + "mapred.child.java.opt instead. Meantime, mapred.child.heap.size "
-        + "is interpolated into mapred.child.java.opt: " + javaOpts);
-    return javaOpts;
-  }
-
-  /**
-   * Replace <code>toFind</code> with <code>replacement</code>. When
hadoop
-   * moves to JDK1.5, replace this method with String#replace (Of is
-   * commons-lang available, replace with StringUtils#replace).
-   * 
-   * @param text String to do replacements in.
-   * @param toFind String to find.
-   * @param replacement String to replace <code>toFind</code> with.
-   * @return A String with all instances of <code>toFind</code> replaced by
-   *         <code>replacement</code> (The original <code>text</code>
is
-   *         returned if <code>toFind</code> is not found in <code>text<code>).
-   */
-  private static String replaceAll(String text, final String toFind,
-      final String replacement) {
-    if (text == null || toFind == null || replacement == null) {
-      throw new IllegalArgumentException("Text " + text + " or toFind "
-          + toFind + " or replacement " + replacement + " are null.");
-    }
-    int offset = 0;
-    for (int index = text.indexOf(toFind); index >= 0; index = text.indexOf(
-        toFind, offset)) {
-      offset = index + toFind.length();
-      text = text.substring(0, index) + replacement + text.substring(offset);
-
-    }
-    return text;
-  }
-
-  /**
    * Run the child process
    */
   private void runChild(String[] args, File dir) throws IOException {



Mime
View raw message