[Swift-commit] r7718 - SwiftApps/cloud

ketan at ci.uchicago.edu ketan at ci.uchicago.edu
Mon Mar 17 11:49:26 CDT 2014


Author: ketan
Date: 2014-03-17 11:49:25 -0500 (Mon, 17 Mar 2014)
New Revision: 7718

Modified:
   SwiftApps/cloud/addnodes
   SwiftApps/cloud/coaster-service.conf
Log:
spot pricing

Modified: SwiftApps/cloud/addnodes
===================================================================
--- SwiftApps/cloud/addnodes	2014-03-15 18:56:42 UTC (rev 7717)
+++ SwiftApps/cloud/addnodes	2014-03-17 16:49:25 UTC (rev 7718)
@@ -54,8 +54,16 @@
 
 addbynum (){
     echo "$1"
-    #ec2-run-instance -k <key-name> -n 1 -g <groupname> --instance-type <type> <ami-id>
-    runinst=$(ec2-run-instance -k "$EC2KEYPAIR" -g "$EC2SECGRP" -n "$1" --instance-type t1.micro "$EC2AMI")
+    
+    if [ -z "$SPOT_PRICE" ] ; then
+        #ec2-run-instances -k <key-name> -n 1 -g <groupname> --instance-type <type> <ami-id>
+        echo "spot ptice not set: $SPOT_PRICE"
+        runinst=$(ec2-run-instances -k "$EC2KEYPAIR" -g "$EC2SECGRP" -n "$1" --instance-type t1.micro "$EC2AMI")
+    else
+        echo "spot price set to: $SPOT_PRICE"
+        runinst=$(ec2-request-spot-instances -k "$EC2KEYPAIR" -g "$EC2SECGRP" -n "$1" --instance-type -p "$SPOT_PRICE" t1.micro "$EC2AMI")
+    fi
+
     echo "Waiting for instances to start"
     sleep 60
     for i in $(echo $runinst | grep -o '\bi-........\b'); do
@@ -65,8 +73,13 @@
 }
 
 #use getopts to check user options
-while getopts ":a:n:" o ; do
+while getopts ":a:n:p:" o ; do
     case $o in
+    p)
+        SPOT_PRICE=${OPTARG}
+        #echo "in p block"
+    ;;
+
     a)
         addbyip ${OPTARG}
     ;;
@@ -74,7 +87,7 @@
     n)
         addbynum ${OPTARG}
     ;;
-    
+
     *)
         usage
     ;;

Modified: SwiftApps/cloud/coaster-service.conf
===================================================================
--- SwiftApps/cloud/coaster-service.conf	2014-03-15 18:56:42 UTC (rev 7717)
+++ SwiftApps/cloud/coaster-service.conf	2014-03-17 16:49:25 UTC (rev 7718)
@@ -51,7 +51,7 @@
 #app cat=/bin/cat
 #app bash=/bin/bash
 #app echo=/bin/echo
-export WORKERURL="http://localhost:50003"
+export WORKERURL="http://localhost:50001"
 export PID_FILE="/homes/ketan/.swift/.coaster-service-pids"
 export LOG="start-coaster-service.log"
-export LOCAL_PORT="50003"
+export LOCAL_PORT="50001"




More information about the Swift-commit mailing list