[Swift-commit] r5411 - in branches/release-0.93: bin etc/sites

davidk at ci.uchicago.edu davidk at ci.uchicago.edu
Tue Dec 13 11:42:01 CST 2011


Author: davidk
Date: 2011-12-13 11:42:00 -0600 (Tue, 13 Dec 2011)
New Revision: 5411

Modified:
   branches/release-0.93/bin/gensites
   branches/release-0.93/bin/start-coaster-service
   branches/release-0.93/etc/sites/persistent-coasters
Log:
Use ec2 command line tools directly as an option in start-coaster-service
EC2 via globus provision still available via the gp worker


Modified: branches/release-0.93/bin/gensites
===================================================================
--- branches/release-0.93/bin/gensites	2011-12-12 18:18:06 UTC (rev 5410)
+++ branches/release-0.93/bin/gensites	2011-12-13 17:42:00 UTC (rev 5411)
@@ -187,6 +187,12 @@
          "#site $TEMPLATE internalhostname="*|'#site internalhostname='*)
             INTERNALHOSTNAME=`get_value $line`
             ;;
+         "#site $TEMPLATE jobs_per_node="*|'#site jobs_per_node='*)
+            JOBS_PER_NODE=`get_value $line`
+            ;;
+         "#site $TEMPLATE job_throttle="*|'#site job_throttle='*)
+            JOB_THROTTLE=`get_value $line`
+            ;;
          '#app'*)
             if [ `echo $line | wc -w` == 2 ]; then
                for HOST in $HOSTS
@@ -215,7 +221,7 @@
 fi
 
 # Verify that the variables by the template are defined
-for TOKEN in NODES HOST WORK PROJECT QUEUE N_GRAN N_MAX SLOTS INTERNALHOSTNAME MAXTIME EXECUTION_URL
+for TOKEN in NODES HOST WORK PROJECT QUEUE N_GRAN N_MAX SLOTS INTERNALHOSTNAME MAXTIME EXECUTION_URL JOBS_PER_NODE JOB_THROTTLE
 do
    # Test for HOST/GLOBUS_HOSTNAME - the only values which don't match
    if [ "$TOKEN" == "HOST" ]; then
@@ -245,6 +251,8 @@
   echo "s at _EXECUTION_URL_@${EXECUTION_URL}@"
   echo "s at _SERVICE_COASTERS_@${SERVICE_COASTERS:-NO_URL_GIVEN}@"
   echo "s at _SERVICE_PORT_@${SERVICE_PORT:-NO_PORT_GIVEN}@"
+  echo "s at _WORKERS_PER_NODE_@${WORKERS_PER_NODE}@"
+  echo "s at _JOB_THROTTLE_@${JOB_THROTTLE}@"
 } > $SEDFILE
 
 

Modified: branches/release-0.93/bin/start-coaster-service
===================================================================
--- branches/release-0.93/bin/start-coaster-service	2011-12-12 18:18:06 UTC (rev 5410)
+++ branches/release-0.93/bin/start-coaster-service	2011-12-13 17:42:00 UTC (rev 5411)
@@ -48,8 +48,8 @@
    done
 }
 
-# EC2 workers
-start-workers-ec2()
+# Globus Provision workers
+start-workers-gp()
 {
    PORT=$1
    EXECUTION_URL=http://localhost:$PORT
@@ -80,6 +80,9 @@
    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
+   if [ -f "$HOME/.swift/.machines" ]; then
+      rm $HOME/.swift/.machines
+   fi
    for MACHINE in $WORKER_HOSTS
    do
       # Create a list of machines for other applications, if needed
@@ -99,6 +102,67 @@
    done
 }
 
+# EC2 workers
+start-workers-ec2()
+{
+   PORT=$1
+   EXECUTION_URL=http://localhost:$PORT
+
+   if [ ! -d "$SWIFTVMBOOT_DIR" ] || [ ! -x "$SWIFTVMBOOT_DIR/bin/ec2-run-instances" ]; then
+      crash "SWIFTVMBOOT_DIR incorrectly defined in coaster-service.conf"
+   fi
+
+   export EC2_HOME="$SWIFTVMBOOT_DIR" 
+   export EC2_PRIVATE_KEY="$EC2_KEYFILE"
+   export EC2_CERT="$EC2_CERTFILE"
+
+   echo Creating instance..
+   $SWIFTVMBOOT_DIR/bin/ec2-run-instances "$EC2_AMI" -t "$EC2_INSTANCE_TYPE" -n "$EC2_NODES" -k "$EC2_KEYPAIR"
+   SWIFTVM_INSTANCES=$( $SWIFTVMBOOT_DIR/bin/ec2-describe-instances | grep INSTANCE | grep -v terminated |awk '{print $2}' )
+   echo $SWIFTVM_INSTANCES >> $HOME/.swift/.swiftvm_instance
+   echo Waiting for nodes to boot..
+
+   while /bin/true
+   do
+      SWIFTVM_INSTANCES_AS_STRING=$( echo $SWIFTVM_INSTANCES | tr "\\n" " ")
+      STATUS_LIST=$( ec2-describe-instances $SWIFTVM_INSTANCES_AS_STRING | grep INSTANCE | grep -v terminated | awk '{print $6}' |sort -u )
+      if [ "$STATUS_LIST" == "running" ]; then
+         break
+      fi
+      sleep 5
+   done
+
+   # There is some delay between when the machines are 'running', and when system utilities like sshd are started
+   sleep 30
+
+   WORKER_HOSTS=$( ec2-describe-instances $SWIFTVM_INSTANCES_AS_STRING | grep INSTANCE | grep -v terminated | awk '{print $4}' )
+
+   # Start worker script
+   rm $HOME/.swift/.machines
+   for MACHINE in $WORKER_HOSTS
+   do
+
+      # Create a list of machines for other applications, if needed
+      echo $MACHINE >> $HOME/.swift/.machines
+
+      # Enable ssh tunneling if needed
+      if [ "$SSH_TUNNELING" == "yes" ]; then
+         ssh -i $EC2_KEYFILE -q -o StrictHostKeyChecking=no -R *:$PORT:localhost:$PORT $WORKER_USERNAME@$MACHINE sleep 999 &
+         echo $! >> $PID_FILE
+      fi
+
+      # Copy and start worker script
+      scp -i $EC2_KEYFILE -q -o StrictHostKeyChecking=no $SWIFT_BIN/$WORKER $WORKER_USERNAME@$MACHINE:$WORKER_LOCATION > /dev/null 2>&1
+      echo "Starting worker on $MACHINE"
+      ssh -i $EC2_KEYFILE -q -o StrictHostKeyChecking=no $WORKER_USERNAME@$MACHINE "$WORKER_LOCATION/$WORKER $EXECUTION_URL $MACHINE $LOG_DIR" &
+      echo $! >> $PID_FILE
+
+      # Copy SSH key for easier access
+      cat $HOME/.ssh/*.pub | ssh -i $EC2_KEYFILE $WORKER_USERNAME@$MACHINE 'umask 077; cat >> $HOME/.ssh/authorized_keys'
+   done
+}
+
+
 # Start SSH workers
 start-workers-ssh()
 {
@@ -308,6 +372,9 @@
    futuregrid)
       start-workers-futuregrid $LOCAL_PORT
       ;;
+   gp)
+      start-workers-gp $LOCAL_PORT
+      ;;
    ec2)
       start-workers-ec2 $LOCAL_PORT
       ;;

Modified: branches/release-0.93/etc/sites/persistent-coasters
===================================================================
--- branches/release-0.93/etc/sites/persistent-coasters	2011-12-12 18:18:06 UTC (rev 5410)
+++ branches/release-0.93/etc/sites/persistent-coasters	2011-12-13 17:42:00 UTC (rev 5411)
@@ -5,7 +5,7 @@
                jobmanager="local:local"/>
     <profile namespace="globus" key="workerManager">passive</profile>
     <profile namespace="globus" key="workersPerNode">4</profile>
-    <profile key="jobThrottle" namespace="karajan">.03</profile>
+    <profile key="jobThrottle" namespace="karajan">_JOB_THROTTLE_</profile>
     <profile namespace="karajan" key="initialScore">10000</profile>
     <filesystem provider="local" url="none" />
     <workdirectory>_WORK_</workdirectory>




More information about the Swift-commit mailing list