[Swift-commit] r4570 - in trunk: bin etc

davidk at ci.uchicago.edu davidk at ci.uchicago.edu
Mon Jun 6 13:26:29 CDT 2011


Author: davidk
Date: 2011-06-06 13:26:29 -0500 (Mon, 06 Jun 2011)
New Revision: 4570

Modified:
   trunk/bin/start-coaster-service
   trunk/bin/stop-coaster-service
   trunk/etc/coaster-service.conf
Log:
Modifications to coaster scripts to test with futuregrid


Modified: trunk/bin/start-coaster-service
===================================================================
--- trunk/bin/start-coaster-service	2011-06-06 17:24:42 UTC (rev 4569)
+++ trunk/bin/start-coaster-service	2011-06-06 18:26:29 UTC (rev 4570)
@@ -8,6 +8,46 @@
    exit 1
 }
 
+# Start futuregrid workers
+start-workers-futuregrid()
+{
+   PORT=$1
+   EXECUTION_URL=http://localhost:$PORT
+
+   if [ ! -d "$SWIFTVMBOOT_DIR" ] || [ ! -x "$SWIFTVMBOOT_DIR/bin/bootit.sh" ]; then
+      crash "SWIFTVMBOOT_DIR incorrectly defined in coaster-service.conf"
+   fi
+
+   echo Starting virtual machines.. please wait
+   #$SWIFTVMBOOT_DIR/bin/bootit.sh
+   SWIFTVMBOOT_OUTPUT=$SWIFTVMBOOT_DIR/output.json
+
+   if [ ! -f "$SWIFTVMBOOT_OUTPUT" ]; then
+      crash "Error: Swift VM output file $SWIFTVMBOOT_OUTPUT does not exist!"
+   fi
+
+   SWIFTVM_INSTANCES=`grep instance_id $SWIFTVMBOOT_OUTPUT |awk '{print $2}'|sed 's/\"//g;s/,//g;s/null//g'`
+   echo $SWIFTVM_INSTANCES > .swiftvm_instances
+
+   WORKER_HOSTS=`grep hostname $SWIFTVMBOOT_OUTPUT |awk '{print $2}'|sed 's/\"//g;s/,//g;s/null//g'`
+
+   # Start worker script
+   for MACHINE in $WORKER_HOSTS
+   do
+      # Enable ssh tunneling if needed
+      if [ $SSH_TUNNELING == "yes" ]; then
+         ssh -R *:$PORT:localhost:$PORT $WORKER_USERNAME@$MACHINE sleep 999 &
+         echo $! >> $PID_FILE
+      fi
+
+      # Copy and start worker script
+      scp $SWIFT_BIN/$WORKER $WORKER_USERNAME@$MACHINE:$WORKER_WORK > /dev/null 2>&1
+      echo "Starting worker on $MACHINE"
+      ssh $WORKER_USERNAME@$MACHINE $WORKER_WORK/$WORKER $EXECUTION_URL $MACHINE $LOG_DIR &
+      echo $! >> $PID_FILE 
+   done
+}
+
 # Start SSH workers
 start-workers-ssh()
 { 
@@ -44,6 +84,9 @@
 start-workers-cobalt()
 {
   PORT=$1
+  if [ -z "$PORT" ]; then
+      crash "start-workers-cobalt: Port number not specified, giving up"
+  fi
   EXECUTION_URL=http://$IPADDR:$PORT
   local TIMESTAMP=$(date "+%Y.%m%d.%H%M%S")
   local -Z 5 R=${RANDOM}
@@ -77,7 +120,7 @@
 # Determine information needed about this machine
 if [ -z "$IPADDR" ]; then
    if [ -x "/sbin/ifconfig" ]; then
-      IPADDR=$( /sbin/ifconfig | grep inet | head -1 | cut -d ':' -f 2 | awk '{print $1}' )
+      IPADDR=$( /sbin/ifconfig | grep 'inet addr' | grep -v 127.0.0.1 | cut -d ':' -f 2 | awk '{print $1}' |head -1)
    else
       crash "Unable to determine IP address of system. Please add to coaster-service.conf"
    fi
@@ -174,9 +217,27 @@
    cobalt)
       start-workers-cobalt $LOCAL_PORT
       ;;
+   futuregrid)
+      start-workers-futuregrid $LOCAL_PORT
+      ;;
+   *) 
+      crash "Unknown WORKER_MODE. Please modify coaster-service.conf"
+      ;;
 esac
 
 # Generate sites.xml
 export EXECUTION_URL="http://$IPADDR:$SERVICE_PORT"
 echo Generating sites.xml..
 gensites persistent-coasters -p $CONFIG_FILE > $RUN_DIR/sites.xml 
+
+# Generate config file
+if [ $SHARED_FILESYSTEM == "no" ]; then
+cat > $RUN_DIR/cf << EOF
+use.provider.staging=true
+wrapperlog.always.transfer=false
+execution.retries=0
+provider.staging.pin.swiftfiles=false
+EOF
+else
+   echo > $RUN_DIR/cf
+fi

Modified: trunk/bin/stop-coaster-service
===================================================================
--- trunk/bin/stop-coaster-service	2011-06-06 17:24:42 UTC (rev 4569)
+++ trunk/bin/stop-coaster-service	2011-06-06 18:26:29 UTC (rev 4570)
@@ -1,8 +1,26 @@
 #!/bin/bash
 
+# Files relative to location of this script
+PID_FILE=".coaster-service-pids"
+SWIFTVM_INSTANCES=".swiftvm_instances"
+CONFIG_FILE="../etc/coaster-service.conf"
+
+# crash: Report a problem and exit
+crash()
+{
+   MSG=$1
+   echo ${MSG} >&2
+   exit 1
+}
+
 pushd $(dirname $(readlink -f $0)) > /dev/null 2>&1
 
-PID_FILE=".coaster-service-pids"
+# Read config file to determine worker mode
+if [ -f "$CONFIG_FILE" ]; then
+   source "$CONFIG_FILE"
+else
+   crash "Cannot find coaster-service.conf!"
+fi
 
 echo Ending coaster processes..
 if [ -f "$PID_FILE" ]; then
@@ -20,4 +38,13 @@
 fi
 echo Done
 
+if [ $WORKER_MODE == "futuregrid" ] && [ -f "$SWIFTVM_INSTANCES" ]; then
+   for INSTANCE in `cat $SWIFTVM_INSTANCES`
+   do
+      $SWIFTVMBOOT_DIR/ve/bin/cloudinitd terminate $INSTANCE
+   done
+   rm $SWIFTVM_INSTANCES > /dev/null 2>&1
+fi
+
+
 popd > /dev/null 2>&1

Modified: trunk/etc/coaster-service.conf
===================================================================
--- trunk/etc/coaster-service.conf	2011-06-06 17:24:42 UTC (rev 4569)
+++ trunk/etc/coaster-service.conf	2011-06-06 18:26:29 UTC (rev 4570)
@@ -1,33 +1,45 @@
 # Keep all interesting settings in one place
 # User should modify this to fit environment
 
-# Location of SWIFT. If empty, PATH is referenced
+# Location of SWIFT. If empty, PATH is searched
 export SWIFT=
 
-# Where to place/launch worker.pl on the remote machine for sites.xml
-export WORKER_WORK=/home/${USER}/work
+# Where to copy worker.pl on the remote machine for sites.xml
+export WORKER_WORK=$HOME/swiftwork
 
-# How to launch workers: local, ssh, or cobalt
+# How to launch workers: local, ssh, cobalt, or futuregrid
 export WORKER_MODE=ssh
 
 # Worker logging setting passed to worker.pl for sites.xml
 export WORKER_LOGGING=INFO
 
-# Worker host names for ssh
+# SSH hosts to start workers on (ssh mode only)
 export WORKER_HOSTS="host1 host2 host3"
 
+# Do all the worker nodes you're using have a shared filesystem? (yes/no)
+export SHARED_FILESYSTEM=no
+
+# Username to use on worker nodes
+export WORKER_USERNAME=$USER
+
+# Enable SSH tunneling? (yes/no)
+export SSH_TUNNELING=no
+
 # Directory to keep log files, relative to working directory when launching start-coaster-service
 export LOG_DIR=logs
 
-# Manually define ports. If not specified, ports will be automatically generated
+# Manually define ports. If not specified, an available port will be used
 export LOCAL_PORT=
 export SERVICE_PORT=
 
-# start-coaster-service tries to automatically detect IP address. Specify here if auto detection is not working correctly
+# start-coaster-service tries to automatically detect the IP address of this system. Specify here if you have multiple network interfaces
 export IPADDR=
 
-# Below are various settings to give information about how to create sites.xml
-export WORK=$HOME/work
+# Location of the swift-vm-boot scripts
+export SWIFTVMBOOT_DIR=$HOME/swift-vm-boot
+
+# Swift information for creating sites.xml
+export WORK=$HOME/swiftwork
 export QUEUE=prod-devel
 export MAXTIME=20
 export NODE=64




More information about the Swift-commit mailing list