[Swift-commit] r4528 - in trunk: . bin etc etc/sites etc/sites/OLD

davidk at ci.uchicago.edu davidk at ci.uchicago.edu
Wed May 25 14:57:51 CDT 2011


Author: davidk
Date: 2011-05-25 14:57:51 -0500 (Wed, 25 May 2011)
New Revision: 4528

Added:
   trunk/bin/start-coaster-service
   trunk/bin/stop-coaster-service
   trunk/etc/coaster-service.conf
   trunk/etc/sites/OLD/
   trunk/etc/sites/OLD/cnari-abe/
   trunk/etc/sites/OLD/cnari-queenbee/
   trunk/etc/sites/OLD/cnari-ranger/
   trunk/etc/sites/OLD/local-pbs-coasters/
   trunk/etc/sites/OLD/pads-local-pbs-coasters/
   trunk/etc/sites/OLD/pads-remote-pbs-coasters-ssh/
   trunk/etc/sites/OLD/teraport-local-pbs-coasters/
   trunk/etc/sites/OLD/teraport-remote-pbs-coasters-ssh/
   trunk/etc/sites/coaster-service.conf
   trunk/etc/sites/persistent-coasters
Removed:
   trunk/etc/sites/cnari-abe/
   trunk/etc/sites/cnari-queenbee/
   trunk/etc/sites/cnari-ranger/
   trunk/etc/sites/local-pbs-coasters/
   trunk/etc/sites/pads-local-pbs-coasters/
   trunk/etc/sites/pads-remote-pbs-coasters-ssh/
   trunk/etc/sites/teraport-local-pbs-coasters/
   trunk/etc/sites/teraport-remote-pbs-coasters-ssh/
Modified:
   trunk/bin/gensites
   trunk/build.xml
Log:
Initial release of start-coaster-service and stop-coaster-service scripts
The start-coaster configuration script is etc/coaster-service.conf
Cleaned up the sites directory. The older swiftconfig site templates are moved into the OLD directory (I don't think anyone is actually using these - probably safe to delete in the future)
There should now only gensite templates in sites/


Modified: trunk/bin/gensites
===================================================================
--- trunk/bin/gensites	2011-05-25 19:55:12 UTC (rev 4527)
+++ trunk/bin/gensites	2011-05-25 19:57:51 UTC (rev 4528)
@@ -172,6 +172,9 @@
       "#site $TEMPLATE slots="*|'#site slots='*)
          SLOTS=`get_value $line`
          ;;
+      "#site $TEMPLATE execution_url="*|'#site slots='*)
+        EXECUTION_URL=`get_value $line`
+        ;;
    esac
 done < $PROPERTIES_FILE
 
@@ -201,6 +204,7 @@
   echo "s/_N_MAX_/${N_MAX}/"
   echo "s/_SLOTS_/${SLOTS}/"
   echo "s/_MAXTIME_/${MAXTIME}/"
+  echo "s/_EXECUTION_URL_/${EXECUTION_URL}/"
   echo "s at _SERVICE_COASTERS_@${SERVICE_COASTERS:-NO_URL_GIVEN}@"
   echo "s at _SERVICE_PORT_@${SERVICE_PORT:-NO_PORT_GIVEN}@"
 } > $SEDFILE

Added: trunk/bin/start-coaster-service
===================================================================
--- trunk/bin/start-coaster-service	                        (rev 0)
+++ trunk/bin/start-coaster-service	2011-05-25 19:57:51 UTC (rev 4528)
@@ -0,0 +1,159 @@
+#!/bin/bash
+
+# crash: Report a problem and exit
+crash()
+{
+   MSG=$1
+   echo ${MSG} >&2
+   exit 1
+}
+
+# Start SSH workers
+start-workers-ssh()
+{ 
+   PORT=$1
+   EXECUTION_URL=http://$IPADDR:$PORT
+   if [ -z "$PORT" ]; then
+      crash "start-workers-ssh: Port number not specified, giving up"
+   fi
+   for MACHINE in $WORKER_HOSTS
+   do
+      scp $SWIFT_BIN/$WORKER $MACHINE:$WORKER_WORK > /dev/null 2>&1
+      echo Starting worker on $MACHINE
+      ssh $MACHINE $WORKER_WORK/$WORKER $EXECUTION_URL $MACHINE $LOG_DIR &
+      echo $! >> $PID_FILE
+   done
+   return 0
+}
+
+# Start local workers
+start-workers-local() 
+{
+ echo foo
+}
+
+# Start cobalt workers
+start-workers-cobalt()
+{
+  echo foo
+}
+
+PID_FILE=".coaster-service-pids"
+RUN_DIR=`pwd`
+pushd $(dirname $(readlink -f $0)) > /dev/null 2>&1
+
+# Import settings
+CONFIG_FILE="../etc/coaster-service.conf"
+if [ -f "$CONFIG_FILE" ]; then
+   source "$CONFIG_FILE"
+else
+   crash "Cannot find coaster-service.conf!"
+fi
+
+# 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}' )
+   else
+      crash "Unable to determine IP address of system. Please add to coaster-service.conf"
+   fi
+fi
+
+# Find swift
+if [ ! -x "$SWIFT" ]; then
+   SWIFT=`which swift`
+   if [ ! -x "$SWIFT" ]; then
+      crash "Unable to find swift! Please either add to your $PATH or specify the path in coaster-service.conf"
+   fi
+fi
+
+SWIFT_BIN=`dirname $SWIFT`
+WORKER=worker.pl
+
+# Verify worker script is there
+if [ ! -x "$SWIFT_BIN/$WORKER" ]; then
+   crash "Error: Unable to find worker at $SWIFT_BIN/$WORKER!"
+fi
+
+# Try to create $LOG_DIR if needed, relative to $RUN_DIR
+if [ ! -d "$RUN_DIR/$LOG_DIR" ]; then
+   mkdir -p "$RUN_DIR/$LOG_DIR" > /dev/null 2>&1
+   if [ ! -d "$RUN_DIR/$LOG_DIR" ]; then
+      crash "Unable to make directory $RUN_DIR/$LOG_DIR!"
+   fi
+fi
+
+# Set paths to log files
+SWIFT_LOG="$RUN_DIR/$LOG_DIR"/swift.out
+COASTER_LOG="$RUN_DIR/$LOG_DIR"/coaster.log
+
+# Verify we can find coaster service
+if [ ! -x "$SWIFT_BIN/coaster-service" ]; then
+   crash "Unable to find $SWIFT_BIN/coaster-service!"
+fi
+
+# Create files for storing port info, if needed
+if [ -z "$LOCAL_PORT" ]; then
+   LOCAL_PORT_FILE=`mktemp`
+fi
+
+if [ -z "$SERVICE_PORT" ]; then
+   SERVICE_PORT_FILE=`mktemp`
+fi
+
+# Check values in configuration file to determine how we should start coaster-service
+echo Starting coaster-service
+if [ -z "$SERVICE_PORT" ] && [ -z "$LOCAL_PORT" ]; then
+   $SWIFT_BIN/coaster-service -nosec -portfile $SERVICE_PORT_FILE -localportfile $LOCAL_PORT_FILE -passive > $COASTER_LOG 2>&1 &
+elif [ -n "$SERVICE_PORT" ] && [ -z "$LOCAL_PORT" ]; then
+   $SWIFT_BIN/coaster-service -nosec -port $SERVICE_PORT -localportfile $LOCAL_PORT_FILE -passive > $COASTER_LOG 2>&1 &
+elif [ -z "$SERVICE_PORT" ] && [ -n "$LOCAL_PORT" ]; then
+   $SWIFT_BIN/coaster-service -nosec -portfile $SERVICE_PORT_FILE --localport $LOCAL_PORT -passive > $COASTER_LOG 2>&1 &
+elif [ -n  "$SERVICE_PORT" ] && [ -n "$LOCAL_PORT" ]; then
+   $SWIFT_BIN/coaster-service -nosec -port $SERVICE_PORT -localport $LOCAL_PORT -passive > $COASTER_LOG 2>&1 &
+else 
+   crash "Unknown SERVICE_PORT type specified!"
+fi
+
+echo $! > $PID_FILE
+sleep 5
+
+# Determine SERVICE_PORT
+if [ -z "$SERVICE_PORT" ]; then
+   if [ ! -f "$SERVICE_PORT_FILE" ]; then
+      crash "Unable to determine SERVICE_PORT!"
+   fi
+   SERVICE_PORT=`cat $SERVICE_PORT_FILE`
+   rm $SERVICE_PORT_FILE
+fi
+
+# Determine LOCAL_PORT
+if [ -z "$LOCAL_PORT" ]; then
+   if [ ! -f "$LOCAL_PORT_FILE" ]; then
+      crash "Unable to determine LOCAL_PORT!"
+   fi
+   LOCAL_PORT=`cat $LOCAL_PORT_FILE`
+   rm $LOCAL_PORT_FILE
+fi
+
+echo Service port: $SERVICE_PORT
+echo Local port: $LOCAL_PORT
+
+# Start workers
+case $WORKER_MODE in
+   ssh)
+      start-workers-ssh $LOCAL_PORT
+      ;;
+   local)
+      start-workers-local $LOCAL_PORT
+      ;;
+   cobalt)
+      start-workers-cobalt $LOCAL_PORT
+      ;;
+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 
+


Property changes on: trunk/bin/start-coaster-service
___________________________________________________________________
Added: svn:executable
   + *

Added: trunk/bin/stop-coaster-service
===================================================================
--- trunk/bin/stop-coaster-service	                        (rev 0)
+++ trunk/bin/stop-coaster-service	2011-05-25 19:57:51 UTC (rev 4528)
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+pushd $(dirname $(readlink -f $0)) > /dev/null 2>&1
+
+PID_FILE=".coaster-service-pids"
+
+echo Ending coaster processes..
+if [ -f "$PID_FILE" ]; then
+   for pid in `cat $PID_FILE`
+   do
+      #echo "$pid"
+      for i in `ps -ef| awk '$3 == '$pid' { print $2 }'`
+      do
+         #echo "$i"
+         kill $i > /dev/null 2>&1
+      done
+      kill $pid > /dev/null 2>&1
+   done
+   rm $PID_FILE > /dev/null 2>&1
+fi
+echo Done
+
+popd > /dev/null 2>&1


Property changes on: trunk/bin/stop-coaster-service
___________________________________________________________________
Added: svn:executable
   + *

Modified: trunk/build.xml
===================================================================
--- trunk/build.xml	2011-05-25 19:55:12 UTC (rev 4527)
+++ trunk/build.xml	2011-05-25 19:57:51 UTC (rev 4528)
@@ -88,6 +88,8 @@
 		<chmod perm="+x" file="${dist.dir}/bin/swiftrun"/>
                 <chmod perm="+x" file="${dist.dir}/bin/gensites"/>
                 <chmod perm="+x" file="${dist.dir}/bin/chxml"/>
+                <chmod perm="+x" file="${dist.dir}/bin/start-coaster-service"/>
+                <chmod perm="+x" file="${dist.dir}/bin/stop-coaster-service"/>
 		<chmod perm="+x" file="${dist.dir}/libexec/log-processing/active-state-transitions"/>
 		<chmod perm="+x" file="${dist.dir}/libexec/log-processing/add-runid-as-prefix"/>
 		<chmod perm="+x" file="${dist.dir}/libexec/log-processing/affine-transform"/>

Added: trunk/etc/coaster-service.conf
===================================================================
--- trunk/etc/coaster-service.conf	                        (rev 0)
+++ trunk/etc/coaster-service.conf	2011-05-25 19:57:51 UTC (rev 4528)
@@ -0,0 +1,33 @@
+# Keep all interesting settings in one place
+# User should modify this to fit environment
+
+# Location of SWIFT. If empty, PATH is referenced
+export SWIFT=
+
+# Where to place/launch worker.pl on the remote machine for sites.xml
+export WORKER_WORK=/home/${USER}/work
+
+# How to launch workers: local, ssh, or cobalt
+export WORKER_MODE=ssh
+
+# Worker logging setting passed to worker.pl for sites.xml
+export WORKER_LOGGING=INFO
+
+# Worker host names for ssh
+export WORKERS_HOSTS="host1 host2 host3"
+
+# 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
+export LOCAL_PORT=
+export SERVICE_PORT=
+
+# start-coaster-service tries to automatically detect IP address. Specify here if auto detection is not working correctly
+export IPADDR=
+
+# Below are various settings to give information about how to create sites.xml
+export work=$HOME/work
+export queue=prod-devel
+export maxtime=20
+export nodes=64

Added: trunk/etc/sites/coaster-service.conf
===================================================================
--- trunk/etc/sites/coaster-service.conf	                        (rev 0)
+++ trunk/etc/sites/coaster-service.conf	2011-05-25 19:57:51 UTC (rev 4528)
@@ -0,0 +1,31 @@
+# Keep all interesting settings in one place
+# User should modify this to fit environment
+
+# Location of SWIFT. If empty, PATH is referenced
+export SWIFT=
+
+# Where to place/launch worker.pl on the remote machine for sites.xml
+export WORKER_WORK=/home/${USER}/work
+
+# How to launch workers- local or ssh
+export WORKER_MODE=ssh
+
+# Worker logging setting passed to worker.pl for sites.xml
+export WORKER_LOGGING=INFO
+
+# Worker host names for ssh
+export WORKERS_HOSTS="crush thwomp stomp crush crank steamroller grind churn trounce thrash vanquish octagon octopus"
+
+# 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
+export LOCAL_PORT=
+export SERVICE_PORT=
+
+# Below are various settings to give information about how to create sites.xml
+# These must remain as comments in order for gensites to recognize them
+#site work=$HOME/work
+#site queue=prod-devel
+#site maxtime=20
+#site nodes=64

Added: trunk/etc/sites/persistent-coasters
===================================================================
--- trunk/etc/sites/persistent-coasters	                        (rev 0)
+++ trunk/etc/sites/persistent-coasters	2011-05-25 19:57:51 UTC (rev 4528)
@@ -0,0 +1,13 @@
+<config>
+  <pool handle="persistent-coasters">
+    <execution provider="coaster-persistent"
+               url="_EXECUTION_URL_"
+               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 namespace="karajan" key="initialScore">10000</profile>
+    <filesystem provider="local" url="none" />
+    <workdirectory>_WORK_</workdirectory>
+  </pool>
+</config>




More information about the Swift-commit mailing list