[Swift-commit] r7741 - SwiftApps/cloud

ketan at ci.uchicago.edu ketan at ci.uchicago.edu
Wed Mar 19 15:55:39 CDT 2014


Author: ketan
Date: 2014-03-19 15:55:38 -0500 (Wed, 19 Mar 2014)
New Revision: 7741

Modified:
   SwiftApps/cloud/README
   SwiftApps/cloud/addnodes
Log:
add instances by type

Modified: SwiftApps/cloud/README
===================================================================
--- SwiftApps/cloud/README	2014-03-19 19:34:38 UTC (rev 7740)
+++ SwiftApps/cloud/README	2014-03-19 20:55:38 UTC (rev 7741)
@@ -32,7 +32,6 @@
 export PATH=$HOME/ec2-api-tools-1.6.12.2/bin:$PATH
 ----
 
-
 Swift Installation
 -------------------
 
@@ -190,12 +189,14 @@
 Add EC2 compute instances
 ~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-Add more resources via addnodes. Use -n to add by number and -a to add by ip
-address. For example, the following commandline will add 10 cloud instances to
-the currently executing run:
+Add more resources via addnodes. Use option `-n` to add by number and `-a` to
+add by ip address. Use `-t` to specify the instance type (t1.micro, m1.small,
+http://aws.amazon.com/ec2/instance-types/[etc.]). For example, the following
+commandline will add 10 cloud instances of type `t1.micro` to the currently
+executing run:
 
 ----
-./addnodes -n 6
+./addnodes -n 6 -t t1.micro
 ----
 
 NOTE: The above command will trigger a "create-instance" command on your EC2

Modified: SwiftApps/cloud/addnodes
===================================================================
--- SwiftApps/cloud/addnodes	2014-03-19 19:34:38 UTC (rev 7740)
+++ SwiftApps/cloud/addnodes	2014-03-19 20:55:38 UTC (rev 7741)
@@ -2,7 +2,7 @@
 
 #set -x
 
-# Import settings
+# Import environment settings
 if [ -f "coaster-service.conf" ]; then
    CONFIG_FILE="coaster-service.conf"
 else
@@ -12,10 +12,11 @@
 echo "Configuration: $CONFIG_FILE"
 source $CONFIG_FILE
 
+INSTYPE="m1.small"
 WORKER=$(\which worker.pl)
 
 usage (){
-    printf "Usage: %s  -a \"<space separated ip addresses in quotes>\" | -n <nodecount> \n" "${0}"
+    printf "Usage: %s  -a \"<space separated ip addresses in quotes>\" | [-p spotprice] -n <nodecount> -t instance-type \n" "${0}"
 }
 
 run_command() {
@@ -57,10 +58,10 @@
     if [ -z "$SPOT_PRICE" ] ; then
         #ec2-run-instances -k <key-name> -n 1 -g <groupname> --instance-type <type> <ami-id>
         echo "spot price not set: $SPOT_PRICE"
-        runinst=$(ec2-run-instances -k "$EC2KEYPAIR" -g "$EC2SECGRP" -n "$1" --instance-type m1.small "$EC2AMI")
+        runinst=$(ec2-run-instances -k "$EC2KEYPAIR" -g "$EC2SECGRP" -n "$1" --instance-type "$INSTYPE" "$EC2AMI")
     else
         echo "spot price set to: $SPOT_PRICE"
-        runinst=$(ec2rsi -k "$EC2KEYPAIR" -g "$EC2SECGRP" -n "$1" -p "$SPOT_PRICE" --instance-type m1.small "$EC2AMI")
+        runinst=$(ec2rsi -k "$EC2KEYPAIR" -g "$EC2SECGRP" -n "$1" -p "$SPOT_PRICE" --instance-type "$INSTYPE" "$EC2AMI")
     fi
 
     echo "Waiting for $1 instance(s) to start"
@@ -73,7 +74,7 @@
 }
 
 #use getopts to check user options
-while getopts ":a:n:p:" o ; do
+while getopts ":a:n:p:t" o ; do
     case $o in
     p)
         SPOT_PRICE=${OPTARG}
@@ -88,6 +89,10 @@
         addbynum ${OPTARG}
     ;;
 
+    t)
+        INSTYPE=${OPTARG}
+    ;;
+    
     *)
         usage
     ;;




More information about the Swift-commit mailing list