[Swift-commit] r5329 - branches/release-0.93/bin
davidk at ci.uchicago.edu
davidk at ci.uchicago.edu
Fri Dec 2 10:03:54 CST 2011
Author: davidk
Date: 2011-12-02 10:03:54 -0600 (Fri, 02 Dec 2011)
New Revision: 5329
Modified:
branches/release-0.93/bin/start-coaster-service
branches/release-0.93/bin/stop-coaster-service
Log:
Integration with Globus provision
Modified: branches/release-0.93/bin/start-coaster-service
===================================================================
--- branches/release-0.93/bin/start-coaster-service 2011-12-02 13:54:44 UTC (rev 5328)
+++ branches/release-0.93/bin/start-coaster-service 2011-12-02 16:03:54 UTC (rev 5329)
@@ -48,6 +48,53 @@
done
}
+# EC2 workers
+start-workers-ec2()
+{
+ PORT=$1
+ EXECUTION_URL=http://localhost:$PORT
+ if [ ! -d "$SWIFTVMBOOT_DIR" ] || [ ! -x "$SWIFTVMBOOT_DIR/bin/gp-instance-create" ]; then
+ crash "SWIFTVMBOT_DIR incorrectly defined in coaster-service.conf"
+ fi
+
+ SEDFILE=`mktemp`
+ {
+ echo "s at _CLUSTER-NODES_@$EC2_NODES@"
+ echo "s at _INSTANCE-TYPE_@$EC2_INSTANCE_TYPE@"
+ echo "s at _KEYPAIR_@$EC2_KEYPAIR@"
+ echo "s at _KEYFILE_@$EC2_KEYFILE@"
+ echo "s at _AMI_@$EC2_AMI@"
+ } > $SEDFILE
+ sed -f $SEDFILE < "$SWIFTVMBOOT_DIR/ec2.template.conf" > "$SWIFTVMBOOT_DIR/ec2.conf"
+ rm $SEDFILE
+
+ echo Creating instance..
+ "$SWIFTVMBOOT_DIR/bin/gp-instance-create" -c "$SWIFTVMBOOT_DIR/ec2.conf" | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g" | tee -a gpic.out
+ SWIFTVM_INSTANCE=`awk '{print $4}' gpic.out`
+ rm gpic.out
+ echo $SWIFTVM_INSTANCE >> $HOME/.swift/.swiftvm_instance
+
+ echo Starting instance..
+ "$SWIFTVMBOOT_DIR/bin/gp-instance-start" "$SWIFTVM_INSTANCE" | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g"
+ WORKER_HOSTS=`$SWIFTVMBOOT_DIR/bin/gp-instance-describe $SWIFTVM_INSTANCE|sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g"|awk '{print $3}'`
+
+ # Start worker script
+ for MACHINE in $WORKER_HOSTS
+ do
+ # Enable ssh tunneling if needed
+ if [ "$SSH_TUNNELING" == "yes" ]; then
+ ssh -q -o StrictHostKeyChecking=no -R *:$PORT:localhost:$PORT $WORKER_USERNAME@$MACHINE sleep 999 &
+ echo $! >> $PID_FILE
+ fi
+
+ # Copy and start worker script
+ scp -q -o StrictHostKeyChecking=no $SWIFT_BIN/$WORKER $WORKER_USERNAME@$MACHINE:$WORKER_LOCATION > /dev/null 2>&1
+ echo "Starting worker on $MACHINE"
+ ssh -q -o StrictHostKeyChecking=no $WORKER_USERNAME@$MACHINE "$WORKER_LOCATION/$WORKER $EXECUTION_URL $MACHINE $LOG_DIR" &
+ echo $! >> $PID_FILE
+ done
+}
+
# Start SSH workers
start-workers-ssh()
{
@@ -256,6 +303,9 @@
futuregrid)
start-workers-futuregrid $LOCAL_PORT
;;
+ ec2)
+ start-workers-ec2 $LOCAL_PORT
+ ;;
*)
crash "Unknown WORKER_MODE. Please modify coaster-service.conf"
;;
Modified: branches/release-0.93/bin/stop-coaster-service
===================================================================
--- branches/release-0.93/bin/stop-coaster-service 2011-12-02 13:54:44 UTC (rev 5328)
+++ branches/release-0.93/bin/stop-coaster-service 2011-12-02 16:03:54 UTC (rev 5329)
@@ -39,9 +39,8 @@
done
rm $PID_FILE > /dev/null 2>&1
fi
-echo Done
-if [ $WORKER_MODE == "futuregrid" ] && [ -f "$SWIFTVM_INSTANCES" ]; then
+if [ "$WORKER_MODE" == "futuregrid" ] && [ -f "$SWIFTVM_INSTANCES" ]; then
for INSTANCE in `cat $SWIFTVM_INSTANCES`
do
$SWIFTVMBOOT_DIR/ve/bin/cloudinitd terminate $INSTANCE
@@ -49,5 +48,13 @@
rm $SWIFTVM_INSTANCES > /dev/null 2>&1
fi
+if [ "$WORKER_MODE" == "ec2" ] && [ -f "$SWIFTVM_INSTANCES" ]; then
+ for INSTANCE in `cat $SWIFTVM_INSTANCES`
+ do
+ echo Stopping ec2 instance $INSTANCE...
+ $SWIFTVMBOOT_DIR/bin/gp-instance-stop $INSTANCE | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g"
+ done
+ rm $SWIFTVM_INSTANCES > /dev/null 2>&1
+fi
popd > /dev/null 2>&1
More information about the Swift-commit
mailing list