You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whirr.apache.org by to...@apache.org on 2011/01/04 00:26:02 UTC

svn commit: r1054822 - in /incubator/whirr/trunk: CHANGES.txt cli/src/main/java/org/apache/whirr/cli/command/AbstractClusterSpecCommand.java core/src/main/java/org/apache/whirr/service/ClusterSpec.java

Author: tomwhite
Date: Mon Jan  3 23:26:01 2011
New Revision: 1054822

URL: http://svn.apache.org/viewvc?rev=1054822&view=rev
Log:
WHIRR-181. Add descriptions for CLI command options. Contributed by Andrei Savu.

Modified:
    incubator/whirr/trunk/CHANGES.txt
    incubator/whirr/trunk/cli/src/main/java/org/apache/whirr/cli/command/AbstractClusterSpecCommand.java
    incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/ClusterSpec.java

Modified: incubator/whirr/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/whirr/trunk/CHANGES.txt?rev=1054822&r1=1054821&r2=1054822&view=diff
==============================================================================
--- incubator/whirr/trunk/CHANGES.txt (original)
+++ incubator/whirr/trunk/CHANGES.txt Mon Jan  3 23:26:01 2011
@@ -49,6 +49,9 @@ Trunk (unreleased changes)
     WHIRR-187. [HBase] Change hbase.tmp.dir to be in line with Hadoop service.
     (Lars George via tomwhite)
 
+    WHIRR-181. Add descriptions for CLI command options.
+    (Andrei Savu via tomwhite)
+
   BUG FIXES
 
     WHIRR-128. Fix DNS resolution for clients running within EC2.

Modified: incubator/whirr/trunk/cli/src/main/java/org/apache/whirr/cli/command/AbstractClusterSpecCommand.java
URL: http://svn.apache.org/viewvc/incubator/whirr/trunk/cli/src/main/java/org/apache/whirr/cli/command/AbstractClusterSpecCommand.java?rev=1054822&r1=1054821&r2=1054822&view=diff
==============================================================================
--- incubator/whirr/trunk/cli/src/main/java/org/apache/whirr/cli/command/AbstractClusterSpecCommand.java (original)
+++ incubator/whirr/trunk/cli/src/main/java/org/apache/whirr/cli/command/AbstractClusterSpecCommand.java Mon Jan  3 23:26:01 2011
@@ -51,8 +51,12 @@ public abstract class AbstractClusterSpe
 
   protected OptionParser parser = new OptionParser();
   private Map<Property, OptionSpec> optionSpecs;
-  private OptionSpec<String> configOption = parser.accepts("config")
-    .withRequiredArg().ofType(String.class);
+  private OptionSpec<String> configOption = parser
+    .accepts("config", "Note that Whirr properties specified in " + 
+      "this file  should all have a whirr. prefix.")
+    .withRequiredArg()
+    .describedAs("config.properties")
+    .ofType(String.class);
 
   public AbstractClusterSpecCommand(String name, String description, ServiceFactory factory) {
     super(name, description);
@@ -60,7 +64,8 @@ public abstract class AbstractClusterSpe
 
     optionSpecs = Maps.newHashMap();
     for (Property property : EnumSet.allOf(Property.class)) {
-      ArgumentAcceptingOptionSpec<?> spec = parser.accepts(property.getSimpleName())
+      ArgumentAcceptingOptionSpec<?> spec = parser
+        .accepts(property.getSimpleName(), property.getDescription())
         .withRequiredArg()
         .ofType(property.getType());
       if (property.hasMultipleArguments()) {

Modified: incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/ClusterSpec.java
URL: http://svn.apache.org/viewvc/incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/ClusterSpec.java?rev=1054822&r1=1054821&r2=1054822&view=diff
==============================================================================
--- incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/ClusterSpec.java (original)
+++ incubator/whirr/trunk/core/src/main/java/org/apache/whirr/service/ClusterSpec.java Mon Jan  3 23:26:01 2011
@@ -68,26 +68,58 @@ public class ClusterSpec {
   }
   
   public enum Property {
-    SERVICE_NAME(String.class, false),
-    INSTANCE_TEMPLATES(String.class, false),
-    PROVIDER(String.class, false),
-    CREDENTIAL(String.class, false),
-    IDENTITY(String.class, false),
-    CLUSTER_NAME(String.class, false),
-    PUBLIC_KEY_FILE(String.class, false),
-    PRIVATE_KEY_FILE(String.class, false),
-    IMAGE_ID(String.class, false),
-    HARDWARE_ID(String.class, false),
-    LOCATION_ID(String.class, false),
-    CLIENT_CIDRS(String.class, true),
-    VERSION(String.class, false),
-    RUN_URL_BASE(String.class, false);
+    SERVICE_NAME(String.class, false, "(optional) The name of the " + 
+      "service to use. E.g. hadoop."),
+      
+    INSTANCE_TEMPLATES(String.class, false, "The number of instances " +
+      "to launch for each set of roles. E.g. 1 nn+jt,10 dn+tt means " + 
+      "one instance with the roles nn (namenode) and jt (jobtracker)," +
+      " and ten instances each with the roles dn (datanode) and tt " + 
+      "(tasktracker)."),
+      
+    PROVIDER(String.class, false, "The name of the cloud provider. " + 
+      "E.g. ec2, cloudservers"),
+      
+    CREDENTIAL(String.class, false, "The cloud credential."),
+    
+    IDENTITY(String.class, false, "The cloud identity."),
+    
+    CLUSTER_NAME(String.class, false,  "The name of the cluster " + 
+      "to operate on. E.g. hadoopcluster."),
+      
+    PUBLIC_KEY_FILE(String.class, false, "The filename of the public " +
+      "key used to connect to instances."),
+      
+    PRIVATE_KEY_FILE(String.class, false, "The filename of the " + 
+      "private RSA key used to connect to instances."),
+      
+    IMAGE_ID(String.class, false, "The ID of the image to use for " + 
+      "instances. If not specified then a vanilla Linux image is " + 
+      "chosen."),
+      
+    HARDWARE_ID(String.class, false, "The type of hardware to use for" + 
+      " the instance. This must be compatible with the image ID."),
+      
+    LOCATION_ID(String.class, false, "The location to launch " + 
+      "instances in. If not specified then an arbitrary location " + 
+      "will be chosen."),
+      
+    CLIENT_CIDRS(String.class, true, "A comma-separated list of CIDR" + 
+      " blocks. E.g. 208.128.0.0/11,108.128.0.0/11"),
+      
+    VERSION(String.class, false, ""),
+    
+    RUN_URL_BASE(String.class, false, "The base URL for forming run " + 
+      "urls from. Change this to host your own set of launch scripts.");
     
     private Class<?> type;
     private boolean multipleArguments;
-    Property(Class<?> type, boolean multipleArguments) {
+    private String description;
+    
+    Property(Class<?> type, boolean multipleArguments, String description) {
       this.type = type;
       this.multipleArguments = multipleArguments;
+      this.description = description;
     }
     
     public String getSimpleName() {
@@ -105,6 +137,10 @@ public class ClusterSpec {
     public boolean hasMultipleArguments() {
       return multipleArguments;
     }
+    
+    public String getDescription() {
+      return description;
+    }
   }
   
   /**