[Swift-commit] r3957 - usertools/persistent-coasters

noreply at svn.ci.uchicago.edu noreply at svn.ci.uchicago.edu
Wed Jan 12 11:18:31 CST 2011


Author: wozniak
Date: 2011-01-12 11:18:30 -0600 (Wed, 12 Jan 2011)
New Revision: 3957

Added:
   usertools/persistent-coasters/passivate.swift
   usertools/persistent-coasters/run.zsh
   usertools/persistent-coasters/settings.sh
   usertools/persistent-coasters/setup.sh
   usertools/persistent-coasters/sites.passivate-template.xml
   usertools/persistent-coasters/sites.persistent.xml
   usertools/persistent-coasters/swift.properties
   usertools/persistent-coasters/tc.data
   usertools/persistent-coasters/workers-cobalt.zsh
   usertools/persistent-coasters/workers-local.zsh
   usertools/persistent-coasters/workers-ssh.zsh
Log:
Import persistent coasters scripts from cdm/scripts/cpc


Added: usertools/persistent-coasters/passivate.swift
===================================================================
--- usertools/persistent-coasters/passivate.swift	                        (rev 0)
+++ usertools/persistent-coasters/passivate.swift	2011-01-12 17:18:30 UTC (rev 3957)
@@ -0,0 +1,17 @@
+type file;
+
+app passivate ()
+{
+  sh "-c" "echo dummy swift job;";
+}
+
+app (file h) hostname ()
+{
+  hostname stdout=@h;
+}
+
+file h<"hostname.txt">;
+
+passivate();
+
+h = hostname();

Added: usertools/persistent-coasters/run.zsh
===================================================================
--- usertools/persistent-coasters/run.zsh	                        (rev 0)
+++ usertools/persistent-coasters/run.zsh	2011-01-12 17:18:30 UTC (rev 3957)
@@ -0,0 +1,126 @@
+#!/bin/zsh
+
+set -x
+
+APP=$( cd $( dirname $0 ) ; /bin/pwd )
+TOOLS=${APP}/../tools
+source ${TOOLS}/helpers.zsh
+[[ $? != 0 ]] && print "Could not load helpers.zsh!" && exit 1
+
+[[ ${SWIFT} == "" ]] && SWIFT=$( which swift )
+SWIFT_BIN=$( dirname ${SWIFT} )
+COASTER_RESOURCES=${SWIFT_BIN}/../../../../provider-coaster/resources
+WORKER=${COASTER_RESOURCES}/worker.pl
+
+export SERVICE_PORT=10985
+
+LOGDIR=logs
+mkdir -p ${LOGDIR}
+exitcode
+
+SWIFT_OUT=${LOGDIR}/swift.out
+
+local OUT=$1
+
+# source workers-local.zsh
+source workers-ssh.zsh
+
+# Obtain the URL to which Swift should connect
+get_service_coasters()
+{
+  local OUT=$1
+  local LINE=()
+  COUNT=0
+  for COUNT in {1..3}
+   do
+   LINE=( $( grep --text "Started coaster service:" ${OUT} ) )
+   if [[ ${#LINE} == 0 ]] then
+     sleep 3
+   else
+     break
+   fi
+  done
+  [[ ${#LINE} == 0 ]] && return 1
+
+  CONTACT=${LINE[-1]}
+  print ${CONTACT}
+  return 0
+}
+
+# Obtain the URL to which the workers should connect
+get_service_local()
+{
+  local OUT=$1
+  local LINE=()
+  COUNT=0
+  for COUNT in {1..4}
+  do
+   LINE=( $( grep "Passive queue processor" ${OUT} ) )
+   if [[ ${#LINE} == 0 ]] then
+     sleep 4
+   else
+     break
+   fi
+   if grep "Error" ${OUT} >& /dev/null
+     then
+     print "coaster-service error!" >&2
+     cat ${OUT} >&2
+     return 1
+   fi
+  done
+  [[ ${#LINE} == 0 ]] && return 1
+
+  CONTACT=${LINE[-1]}
+  print ${CONTACT}
+  return 0
+}
+
+SIGNALS="EXIT INT QUIT"
+cleanup_trap()
+{
+  print "cleanup_trap()..."
+  eval trap - ${SIGNALS}
+  [[ ${COASTER_SERVICE_PID} != "" ]] && kill ${COASTER_SERVICE_PID}
+  [[ ${STARTWORKERS_PID}    != "" ]] && kill ${START_WORKERS_PID}
+}
+# eval trap cleanup_trap ${SIGNALS}
+
+SERVICE_LOG=${LOGDIR}/coaster-service.log
+coaster-service -nosec -p ${SERVICE_PORT} >& ${SERVICE_LOG} &
+COASTER_SERVICE_PID=${!}
+
+sleep 1
+
+SERVICE_COASTERS=$( get_service_coasters ${SERVICE_LOG} )
+exitcode "Could not get coasters service!"
+export SERVICE_COASTERS
+
+source setup.sh
+exitcode "setup.sh failed!"
+
+sleep 1
+
+{ ${SWIFT} -config swift.properties \
+           -sites.file sites.passivate.xml \
+           -tc.file tc.passivate.data \
+           passivate.swift < /dev/null >& ${SWIFT_OUT}
+  exitcode "Swift failed!"
+  print "Swift finished."
+} &
+
+sleep 1
+
+pwd
+SERVICE_LOCAL=$( get_service_local ${SWIFT_OUT} )
+exitcode "get_service_local failed!"
+export SERVICE_LOCAL
+
+sleep 1
+
+print "Starting workers..."
+start_workers ${SERVICE_LOCAL} &
+START_WORKERS_PID=${!}
+
+sleep 1
+
+exit 0


Property changes on: usertools/persistent-coasters/run.zsh
___________________________________________________________________
Name: svn:executable
   + *

Added: usertools/persistent-coasters/settings.sh
===================================================================
--- usertools/persistent-coasters/settings.sh	                        (rev 0)
+++ usertools/persistent-coasters/settings.sh	2011-01-12 17:18:30 UTC (rev 3957)
@@ -0,0 +1,7 @@
+
+WORK=${HOME}/work
+
+NODES=64
+
+QUEUE=prod-devel
+MAXTIME=$(( 20 ))

Added: usertools/persistent-coasters/setup.sh
===================================================================
--- usertools/persistent-coasters/setup.sh	                        (rev 0)
+++ usertools/persistent-coasters/setup.sh	2011-01-12 17:18:30 UTC (rev 3957)
@@ -0,0 +1,12 @@
+
+source ${TOOLS}/coasters-setup.sh
+source ./settings.sh
+
+export WORK
+${TOOLS}/gensites.sh ${WORK} sites.passivate-template.xml \
+                             sites.passivate.xml
+[[ $? != 0 ]] && bail "sites problem (passivate)" && return
+${TOOLS}/gensites.sh ${WORK} sites.persistent.xml sites.xml
+[[ $? != 0 ]] && bail "sites problem (persistent)" && return
+
+return 0


Property changes on: usertools/persistent-coasters/setup.sh
___________________________________________________________________
Name: svn:executable
   + *

Added: usertools/persistent-coasters/sites.passivate-template.xml
===================================================================
--- usertools/persistent-coasters/sites.passivate-template.xml	                        (rev 0)
+++ usertools/persistent-coasters/sites.passivate-template.xml	2011-01-12 17:18:30 UTC (rev 3957)
@@ -0,0 +1,13 @@
+<config>
+  <pool handle="passivate">
+    <execution provider="coaster-persistent"
+               url="_SERVICE_COASTERS_"
+               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>

Added: usertools/persistent-coasters/sites.persistent.xml
===================================================================
--- usertools/persistent-coasters/sites.persistent.xml	                        (rev 0)
+++ usertools/persistent-coasters/sites.persistent.xml	2011-01-12 17:18:30 UTC (rev 3957)
@@ -0,0 +1,33 @@
+
+<config>
+  <pool handle="cpc">
+    <execution provider="coaster-persistent"
+               url="SERVICE_LOCAL"
+               jobmanager=""/>
+    <profile namespace="globus" key="workerManager">passive</profile>
+    <profile namespace="globus" key="workersPerNode">4</profile>
+    <profile key="jobThrottle" namespace="karajan">3.00</profile>
+    <profile namespace="karajan" key="initialScore">10000</profile>
+    <filesystem provider="local" url="none" />
+    <workdirectory>_WORK_</workdirectory>
+  </pool>
+</config>
+
+<!--
+
+Paste from pecos
+
+> >  <pool handle="coasters_alcfbgp">
+> >    <execution provider="coaster-persistent"
+> >    url="http://localhost:1985" jobmanager=""/>
+> >    <profile namespace="globus" key="workerManager">passive</profile>
+> >
+> >    <profile namespace="globus" key="workersPerNode">4</profile>
+> >    <profile key="jobThrottle" namespace="karajan">3.00</profile>
+> >    <profile namespace="karajan" key="initialScore">10000</profile>
+> >
+> >    <filesystem provider="local" url="none" />
+> >    <workdirectory>/home/wilde/swiftwork</workdirectory>
+> >    <scratch>/tmp/wilde/swiftwork</scratch>
+> >  </pool>
+-->

Added: usertools/persistent-coasters/swift.properties
===================================================================
--- usertools/persistent-coasters/swift.properties	                        (rev 0)
+++ usertools/persistent-coasters/swift.properties	2011-01-12 17:18:30 UTC (rev 3957)
@@ -0,0 +1,7 @@
+wrapperlog.always.transfer=true
+sitedir.keep=true
+execution.retries=0
+lazy.errors=false
+status.mode=provider
+use.provider.staging=true
+provider.staging.pin.swiftfiles=false

Added: usertools/persistent-coasters/tc.data
===================================================================
--- usertools/persistent-coasters/tc.data	                        (rev 0)
+++ usertools/persistent-coasters/tc.data	2011-01-12 17:18:30 UTC (rev 3957)
@@ -0,0 +1 @@
+cpc sh /bin/sh null null null

Added: usertools/persistent-coasters/workers-cobalt.zsh
===================================================================
--- usertools/persistent-coasters/workers-cobalt.zsh	                        (rev 0)
+++ usertools/persistent-coasters/workers-cobalt.zsh	2011-01-12 17:18:30 UTC (rev 3957)
@@ -0,0 +1,23 @@
+
+# Source this to get start_workers() for cobalt
+
+start_workers()
+{
+  local URI=$1
+  local TIMESTAMP=$(date "+%Y.%m%d.%H%M%S")
+  local -Z 5 R=${RANDOM}
+  ID="${TIMESTAMP}.${R}"
+
+  cqsub -q ${QUEUE}   \
+        -k zeptoos    \
+        -t ${MAXTIME} \ # minutes
+        -n ${NODES}   \
+        --cwd ${LOGDIR} \
+        -E ${LOGDIR}/cobalt.${$}.stderr \
+        -o ${LOGDIR}/cobalt.${$}.stdout \
+        -e "WORKER_LOGGING_LEVEL=DEBUG:ZOID_ENABLE_NAT=true" \
+        ${WORKER} ${URI} ${ID} ${LOGDIR}
+
+  START_WORKERS_PID=
+  return 0
+}

Added: usertools/persistent-coasters/workers-local.zsh
===================================================================
--- usertools/persistent-coasters/workers-local.zsh	                        (rev 0)
+++ usertools/persistent-coasters/workers-local.zsh	2011-01-12 17:18:30 UTC (rev 3957)
@@ -0,0 +1,15 @@
+
+# Source this to get start_workers() for local
+# Just starts a local worker.pl process
+
+start_workers()
+{
+  local URI=$1
+
+  ${WORKER} ${URI} LOCAL ${LOGDIR} &
+
+  # TODO: manage these PIDs
+  # START_WORKERS_PID=
+
+  return 0
+}

Added: usertools/persistent-coasters/workers-ssh.zsh
===================================================================
--- usertools/persistent-coasters/workers-ssh.zsh	                        (rev 0)
+++ usertools/persistent-coasters/workers-ssh.zsh	2011-01-12 17:18:30 UTC (rev 3957)
@@ -0,0 +1,23 @@
+
+# Source this to get start_workers() for ssh
+# hostnames must be in environment variable WORKER_HOSTS
+
+start_workers()
+{
+  local URI=$1
+
+  local TIMESTAMP=$(date "+%Y.%m%d.%H%M%S")
+  local -Z 5 R=${RANDOM}
+  ID="${TIMESTAMP}.${R}"
+
+  for MACHINE in ${WORKER_HOSTS}
+  do
+    pwd
+    ssh ${MACHINE} ${WORKER} ${URI} ${MACHINE} ${LOGDIR} &
+  done
+
+  # TODO: manage these PIDs
+  # START_WORKERS_PID=
+
+  return 0
+}




More information about the Swift-commit mailing list