giraph-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ach...@apache.org
Subject svn commit: r1401939 - in /giraph/trunk: CHANGELOG giraph/src/main/java/org/apache/giraph/GiraphRunner.java
Date Thu, 25 Oct 2012 01:01:47 GMT
Author: aching
Date: Thu Oct 25 01:01:47 2012
New Revision: 1401939

URL: http://svn.apache.org/viewvc?rev=1401939&view=rev
Log:
GIRAPH-387: GiraphRunner's better handling of configuration property
arguments. (netj via aching)

Modified:
    giraph/trunk/CHANGELOG
    giraph/trunk/giraph/src/main/java/org/apache/giraph/GiraphRunner.java

Modified: giraph/trunk/CHANGELOG
URL: http://svn.apache.org/viewvc/giraph/trunk/CHANGELOG?rev=1401939&r1=1401938&r2=1401939&view=diff
==============================================================================
--- giraph/trunk/CHANGELOG (original)
+++ giraph/trunk/CHANGELOG Thu Oct 25 01:01:47 2012
@@ -1,6 +1,8 @@
 Giraph Change Log
 
 Release 0.2.0 - unreleased
+  GIRAPH-387: GiraphRunner's better handling of configuration property
+  arguments. (netj via aching)
 
   GIRAPH-385: Script for running on all profiles. (nitay via aching)
 

Modified: giraph/trunk/giraph/src/main/java/org/apache/giraph/GiraphRunner.java
URL: http://svn.apache.org/viewvc/giraph/trunk/giraph/src/main/java/org/apache/giraph/GiraphRunner.java?rev=1401939&r1=1401938&r2=1401939&view=diff
==============================================================================
--- giraph/trunk/giraph/src/main/java/org/apache/giraph/GiraphRunner.java (original)
+++ giraph/trunk/giraph/src/main/java/org/apache/giraph/GiraphRunner.java Thu Oct 25 01:01:47
2012
@@ -94,7 +94,9 @@ public class GiraphRunner implements Too
     options.addOption("cf", "cacheFile", true, "Files for distributed cache");
     options.addOption("ca", "customArguments", true, "provide custom" +
         " arguments for the job configuration in the form:" +
-        " <param1>=<value1>,<param2>=<value2> etc.");
+        " -ca <param1>=<value1>,<param2>=<value2> -ca <param3>=<value3>
etc." +
+        " It can appear multiple times, and the last one has effect" +
+        " for the same param.");
     return options;
   }
 
@@ -165,7 +167,8 @@ public class GiraphRunner implements Too
     }
 
     int workers = Integer.parseInt(cmd.getOptionValue('w'));
-    GiraphConfiguration giraphConfiguration = new GiraphConfiguration();
+    GiraphConfiguration giraphConfiguration = new GiraphConfiguration(
+            getConf());
     giraphConfiguration.setVertexClass(
         (Class<? extends Vertex>) Class.forName(vertexClassName));
     giraphConfiguration.setVertexInputFormatClass(
@@ -228,19 +231,21 @@ public class GiraphRunner implements Too
 
     if (cmd.hasOption("ca")) {
       Configuration jobConf = job.getConfiguration();
-      for (String paramValue :
-          Splitter.on(',').split(cmd.getOptionValue("ca"))) {
-        String[] parts = Iterables.toArray(Splitter.on('=').split(paramValue),
-            String.class);
-        if (parts.length != 2) {
-          throw new IllegalArgumentException("Unable to parse custom " +
-              " argument: " + paramValue);
+      for (String caOptionValue : cmd.getOptionValues("ca")) {
+        for (String paramValue :
+            Splitter.on(',').split(caOptionValue)) {
+          String[] parts = Iterables.toArray(Splitter.on('=').split(paramValue),
+              String.class);
+          if (parts.length != 2) {
+            throw new IllegalArgumentException("Unable to parse custom " +
+                " argument: " + paramValue);
+          }
+          if (LOG.isInfoEnabled()) {
+            LOG.info("Setting custom argument [" + parts[0] + "] to [" +
+                parts[1] + "]");
+          }
+          jobConf.set(parts[0], parts[1]);
         }
-        if (LOG.isInfoEnabled()) {
-          LOG.info("Setting custom argument [" + parts[0] + "] to [" +
-              parts[1] + "]");
-        }
-        jobConf.set(parts[0], parts[1]);
       }
     }
 



Mime
View raw message