[Swift-commit] cog r4038
swift at ci.uchicago.edu
swift at ci.uchicago.edu
Thu Jul 31 15:10:03 CDT 2014
------------------------------------------------------------------------
r4038 | yadunand | 2014-07-31 15:07:35 -0500 (Thu, 31 Jul 2014) | 3 lines
Updates to ec2-provider
------------------------------------------------------------------------
Index: modules/provider-localscheduler/examples/ec2-cloud-provider/stsubmit.sh
===================================================================
--- modules/provider-localscheduler/examples/ec2-cloud-provider/stsubmit.sh (revision 0)
+++ modules/provider-localscheduler/examples/ec2-cloud-provider/stsubmit.sh (revision 4038)
@@ -0,0 +1,124 @@
+#!/bin/bash
+
+rm -f /tmp/stsubmit
+EXECUTABLE=
+DIR=
+ARGS=
+STDOUTLOC=
+STDOUTPATH=
+STDERRLOC=
+STDERRPATH=
+STDINLOC=
+STDINPATH=
+STDIN=
+STDOUT=
+STDERR=
+
+LOG=/home/yadu/src/swift-trunk/cog/modules/provider-localscheduler/examples/ec2-cloud-provider/log
+
+SUBMIT_SCRIPT=$(mktemp)
+touch $SUBMIT_SCRIPT
+
+#SUBMIT_SCRIPT=$(mktemp)
+
+while read LINE; do
+ echo $LINE >>/tmp/stsubmit
+ case $LINE in
+ executable=*)
+ EXECUTABLE=${LINE#executable=}
+ ;;
+ directory=*)
+ DIR=${LINE#directory=}
+ ;;
+ arg=*)
+ if [[ ${LINE#arg=} == *cscript*pl ]]
+ then
+ # Replacing temporary worker script with a specific remote worker script
+ ARGS="$ARGS /usr/local/bin/swift-trunk/bin/worker.pl"
+ else
+ ARGS="$ARGS ${LINE#arg=}"
+ fi
+ ;;
+ attr.*)
+ LINE2=${LINE#attr.}
+ if [[ $LINE2 == ec2* ]]
+ then
+ echo $LINE2 >> $SUBMIT_SCRIPT
+ fi
+ ;;
+ stdin.location=*)
+ STDINLOC=${LINE#stdin.location=}
+ ;;
+ stdin.path=*)
+ STDINPATH=${LINE#stdin.path=}
+ ;;
+ stdout.location=*)
+ STDOUTLOC=${LINE#stdout.location=}
+ ;;
+ stdout.path=*)
+ STDOUTPATH=${LINE#stdout.path=}
+ ;;
+ stderr.location=*)
+ STDERRLOC=${LINE#stderr.location=}
+ ;;
+ stderr.path=*)
+ STDERRPATH=${LINE#stderr.path=}
+ ;;
+ env.*)
+ LINE2=${LINE#env.}
+ # split on '='
+ ELS=(${LINE2//=/})
+ NAME=${ELS[0]}
+ VALUE=${ELS[1]}
+ export $NAME=$VALUE
+ ;;
+ *)
+ echo "Don't know how to interpret line: $LINE" >&2
+ exit 2
+ esac
+done < /dev/stdin
+
+if [ "$STDOUTLOC" == "tmp" ]; then
+ STDOUTPATH=$(mktemp)
+ echo "stdout.path=$STDOUTPATH"
+fi
+if [ "$STDOUTPATH" != "" ]; then
+ STDOUT="1> $STDOUTPATH"
+fi
+
+if [ "$STDERRLOC" == "tmp" ]; then
+ STDERRPATH=$(mktemp)
+ echo "stderr.path=$STDERRPATH"
+fi
+if [ "$STDERRPATH" != "" ]; then
+ STDERR="2> $STDERRPATH"
+fi
+
+if [ "$STDINLOC" != "" ]; then
+ STDIN="< $STDINLOC"
+fi
+
+CMD="$EXECUTABLE $ARGS $STDIN $STDOUT $STDERR"
+echo "CMD : $CMD" >> $LOG
+
+DIR=/tmp/
+
+cat<<EOF >> $SUBMIT_SCRIPT
+CMD_STRING="mkdir $DIR; cd $DIR; $CMD"
+EOF
+
+cat $SUBMIT_SCRIPT >> $LOG
+
+echo "$PWD" >> $LOG
+echo "python /home/yadu/src/swift-trunk/cog/modules/provider-localscheduler/examples/ec2-cloud-provider/cloud.py --submit $SUBMIT_SCRIPT" >> $LOG
+JOBINFO=$(python /home/yadu/src/swift-trunk/cog/modules/provider-localscheduler/examples/ec2-cloud-provider/cloud.py --submit $SUBMIT_SCRIPT)
+retcode="$?"
+echo $JOBINFO
+[[ "$retcode" != "0" ]] && exit retcode
+
+if [[ $JOBINFO == jobid\=* ]]
+then
+ cat $SUBMIT_SCRIPT > /tmp/${JOBINFO#jobid=}
+fi
+
+exit 0
Property changes on: modules/provider-localscheduler/examples/ec2-cloud-provider/stsubmit.sh
___________________________________________________________________
Added: svn:executable
+ *
Index: modules/provider-localscheduler/examples/ec2-cloud-provider/stcancel.sh
===================================================================
--- modules/provider-localscheduler/examples/ec2-cloud-provider/stcancel.sh (revision 0)
+++ modules/provider-localscheduler/examples/ec2-cloud-provider/stcancel.sh (revision 4038)
@@ -0,0 +1,37 @@
+#!/bin/bash
+
+LOG=/home/yadu/src/swift-trunk/cog/modules/provider-localscheduler/examples/ec2-cloud-provider/log
+LOGGING=1 # Either 1 or 0
+log()
+{
+ [[ "$LOGGING" == "1" ]] && echo $* >> $LOG
+}
+
+JOBID=$1
+CONF=/tmp/$JOBID
+EXITCODE=0
+
+log "Received cancel directive for $JOBID"
+
+# Check for the conf file for the job at /tmp/<jobid>
+if [ ! -f "$CONF" ]
+then
+ echo "ERROR: Could not find conf script at /tmp/$1" 1>&2
+ exit -1
+fi
+
+if [[ "$1" != "" ]]
+then
+ log "Cancelling $JOBID"
+ python /home/yadu/src/swift-trunk/cog/modules/provider-localscheduler/examples/ec2-cloud-provider/cloud.py --cancel $CONF --jobid $JOBID
+ EXITCODE=$?
+ if [[ "$EXITCODE" == "0" ]]
+ then
+ log "Done cancelling $JOBID"
+ rm $CONF
+ elif
+ log "Failed to cancel $JOBID: returned exitcode:$EXITCODE"
+ fi
+fi
+
+exit $EXITCODE
Property changes on: modules/provider-localscheduler/examples/ec2-cloud-provider/stcancel.sh
___________________________________________________________________
Added: svn:executable
+ *
Index: modules/provider-localscheduler/examples/ec2-cloud-provider/ststat.sh
===================================================================
--- modules/provider-localscheduler/examples/ec2-cloud-provider/ststat.sh (revision 0)
+++ modules/provider-localscheduler/examples/ec2-cloud-provider/ststat.sh (revision 4038)
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+LOG=/home/yadu/src/swift-trunk/cog/modules/provider-localscheduler/examples/ec2-cloud-provider/log
+LOGGING=1 # Either 1 or 0
+log()
+{
+ [[ "$LOGGING" == "1" ]] && echo $* >> $LOG
+}
+
+JOBID=$1
+CONF=/tmp/$JOBID
+
+# Check for the conf file for the job at /tmp/<jobid>
+if [ ! -f "$CONF" ]
+then
+ echo "ERROR: Could not find conf script at /tmp/$1" 1>&2
+ exit -1
+fi
+
+if [[ "$1" != "" ]]
+then
+ log "Stat'ing for $1 PWD: $PWD"
+ python /home/yadu/src/swift-trunk/cog/modules/provider-localscheduler/examples/ec2-cloud-provider/cloud.py --status $CONF --jobid $JOBID | tee -a $LOG
+fi
Property changes on: modules/provider-localscheduler/examples/ec2-cloud-provider/ststat.sh
___________________________________________________________________
Added: svn:executable
+ *
Index: modules/provider-localscheduler/examples/ec2-cloud-provider/provider-ec2-cloud.properties
===================================================================
--- modules/provider-localscheduler/examples/ec2-cloud-provider/provider-ec2-cloud.properties (revision 4037)
+++ modules/provider-localscheduler/examples/ec2-cloud-provider/provider-ec2-cloud.properties (working copy)
@@ -1,3 +0,0 @@
-submit.command=/path/to/stsubmit
-cancel.command=/path/to/stcancel
-poll.command=/path/to/ststat
\ No newline at end of file
Index: modules/provider-localscheduler/examples/ec2-cloud-provider/ststat
===================================================================
--- modules/provider-localscheduler/examples/ec2-cloud-provider/ststat (revision 4037)
+++ modules/provider-localscheduler/examples/ec2-cloud-provider/ststat (working copy)
@@ -1,24 +0,0 @@
-#!/bin/bash
-
-LOG=/home/yadu/src/swift-trunk/cog/modules/provider-localscheduler/examples/ec2-cloud-provider/log
-LOGGING=1 # Either 1 or 0
-log()
-{
- [[ "$LOGGING" == "1" ]] && echo $* >> $LOG
-}
-
-JOBID=$1
-CONF=/tmp/$JOBID
-
-# Check for the conf file for the job at /tmp/<jobid>
-if [ ! -f "$CONF" ]
-then
- echo "ERROR: Could not find conf script at /tmp/$1" 1>&2
- exit -1
-fi
-
-if [[ "$1" != "" ]]
-then
- log "Stat'ing for $1 PWD: $PWD"
- python /home/yadu/src/swift-trunk/cog/modules/provider-localscheduler/examples/ec2-cloud-provider/cloud.py --status $CONF --jobid $JOBID | tee -a $LOG
-fi
Index: modules/provider-localscheduler/examples/ec2-cloud-provider/stsubmit
===================================================================
--- modules/provider-localscheduler/examples/ec2-cloud-provider/stsubmit (revision 4037)
+++ modules/provider-localscheduler/examples/ec2-cloud-provider/stsubmit (working copy)
@@ -1,124 +0,0 @@
-#!/bin/bash
-
-rm -f /tmp/stsubmit
-EXECUTABLE=
-DIR=
-ARGS=
-STDOUTLOC=
-STDOUTPATH=
-STDERRLOC=
-STDERRPATH=
-STDINLOC=
-STDINPATH=
-STDIN=
-STDOUT=
-STDERR=
-
-LOG=/home/yadu/src/swift-trunk/cog/modules/provider-localscheduler/examples/ec2-cloud-provider/log
-
-SUBMIT_SCRIPT=$(mktemp)
-touch $SUBMIT_SCRIPT
-
-#SUBMIT_SCRIPT=$(mktemp)
-
-while read LINE; do
- echo $LINE >>/tmp/stsubmit
- case $LINE in
- executable=*)
- EXECUTABLE=${LINE#executable=}
- ;;
- directory=*)
- DIR=${LINE#directory=}
- ;;
- arg=*)
- if [[ ${LINE#arg=} == *cscript*pl ]]
- then
- # Replacing temporary worker script with a specific remote worker script
- ARGS="$ARGS /usr/local/bin/swift-trunk/bin/worker.pl"
- else
- ARGS="$ARGS ${LINE#arg=}"
- fi
- ;;
- attr.*)
- LINE2=${LINE#attr.}
- if [[ $LINE2 == ec2* ]]
- then
- echo $LINE2 >> $SUBMIT_SCRIPT
- fi
- ;;
- stdin.location=*)
- STDINLOC=${LINE#stdin.location=}
- ;;
- stdin.path=*)
- STDINPATH=${LINE#stdin.path=}
- ;;
- stdout.location=*)
- STDOUTLOC=${LINE#stdout.location=}
- ;;
- stdout.path=*)
- STDOUTPATH=${LINE#stdout.path=}
- ;;
- stderr.location=*)
- STDERRLOC=${LINE#stderr.location=}
- ;;
- stderr.path=*)
- STDERRPATH=${LINE#stderr.path=}
- ;;
- env.*)
- LINE2=${LINE#env.}
- # split on '='
- ELS=(${LINE2//=/})
- NAME=${ELS[0]}
- VALUE=${ELS[1]}
- export $NAME=$VALUE
- ;;
- *)
- echo "Don't know how to interpret line: $LINE" >&2
- exit 2
- esac
-done < /dev/stdin
-
-if [ "$STDOUTLOC" == "tmp" ]; then
- STDOUTPATH=$(mktemp)
- echo "stdout.path=$STDOUTPATH"
-fi
-if [ "$STDOUTPATH" != "" ]; then
- STDOUT="1> $STDOUTPATH"
-fi
-
-if [ "$STDERRLOC" == "tmp" ]; then
- STDERRPATH=$(mktemp)
- echo "stderr.path=$STDERRPATH"
-fi
-if [ "$STDERRPATH" != "" ]; then
- STDERR="2> $STDERRPATH"
-fi
-
-if [ "$STDINLOC" != "" ]; then
- STDIN="< $STDINLOC"
-fi
-
-CMD="$EXECUTABLE $ARGS $STDIN $STDOUT $STDERR"
-echo "CMD : $CMD" >> $LOG
-
-DIR=/tmp/
-
-cat<<EOF >> $SUBMIT_SCRIPT
-CMD_STRING="mkdir $DIR; cd $DIR; $CMD"
-EOF
-
-cat $SUBMIT_SCRIPT >> $LOG
-
-echo "$PWD" >> $LOG
-echo "python /home/yadu/src/swift-trunk/cog/modules/provider-localscheduler/examples/ec2-cloud-provider/cloud.py --submit $SUBMIT_SCRIPT" >> $LOG
-JOBINFO=$(python /home/yadu/src/swift-trunk/cog/modules/provider-localscheduler/examples/ec2-cloud-provider/cloud.py --submit $SUBMIT_SCRIPT)
-retcode="$?"
-echo $JOBINFO
-[[ "$retcode" != "0" ]] && exit retcode
-
-if [[ $JOBINFO == jobid\=* ]]
-then
- cat $SUBMIT_SCRIPT > /tmp/${JOBINFO#jobid=}
-fi
-
-exit 0
Index: modules/provider-localscheduler/examples/ec2-cloud-provider/stcancel
===================================================================
--- modules/provider-localscheduler/examples/ec2-cloud-provider/stcancel (revision 4037)
+++ modules/provider-localscheduler/examples/ec2-cloud-provider/stcancel (working copy)
@@ -1,33 +0,0 @@
-#!/bin/bash
-
-LOG=/home/yadu/src/swift-trunk/cog/modules/provider-localscheduler/examples/ec2-cloud-provider/log
-LOGGING=1 # Either 1 or 0
-log()
-{
- [[ "$LOGGING" == "1" ]] && echo $* >> $LOG
-}
-
-JOBID=$1
-CONF=/tmp/$JOBID
-EXITCODE=0
-
-# Check for the conf file for the job at /tmp/<jobid>
-if [ ! -f "$CONF" ]
-then
- echo "ERROR: Could not find conf script at /tmp/$1" 1>&2
- exit -1
-fi
-
-if [[ "$1" != "" ]]
-then
- log "Cancelling $JOBID"
- python /home/yadu/src/swift-trunk/cog/modules/provider-localscheduler/examples/ec2-cloud-provider/cloud.py --cancel $CONF --jobid $JOBID
- EXITCODE=$?
- if [[ "$EXITCODE" == "0" ]]
- then
- log "Done cancelling $JOBID"
- rm $CONF
- fi
-fi
-
-exit $EXITCODE
More information about the Swift-commit
mailing list