[Swift-commit] r7815 - SwiftApps/swift-galaxy/swift
ketan at ci.uchicago.edu
ketan at ci.uchicago.edu
Mon May 5 20:08:05 CDT 2014
Author: ketan
Date: 2014-05-05 20:08:05 -0500 (Mon, 05 May 2014)
New Revision: 7815
Removed:
SwiftApps/swift-galaxy/swift/swiftforeachlist.sh
Log:
clean up
Deleted: SwiftApps/swift-galaxy/swift/swiftforeachlist.sh
===================================================================
--- SwiftApps/swift-galaxy/swift/swiftforeachlist.sh 2014-05-06 01:07:20 UTC (rev 7814)
+++ SwiftApps/swift-galaxy/swift/swiftforeachlist.sh 2014-05-06 01:08:05 UTC (rev 7815)
@@ -1,242 +0,0 @@
-#!/bin/bash
-
-wdir=$(mktemp -d /tmp/swift-gal.XXXX)
-
-k_or_t=$1
-shift
-
-if [ "$k_or_t" = "swiftK" ] ; then
- #invoke the k.sh
- k "${@}"
-else
- #invoke the t.sh
- t "${@}"
- echo "stc + turbine; not implemented yet" > /tmp/swiftT.txt
-fi
-
-
-function k()
-{
- sites=$1 # comma separated list of sites
- shift
- swiftargs=$1
- shift
- interpreter=$1
- shift
- executable=$1
- shift
- stdin=$1
- shift
- listfile=$1
- shift
- outloc=$1
- shift
- logfile=$1
- shift
- outlistfile=$1
- shift
- stringargs=$1
- shift
-
- #workout the array only if user adds args else make it blank
- if [ "${stringargs}" ] ; then
- stringarrayexpr='string stringargs[]=['$(echo $stringargs | sed -e 's/ *$//g' -e 's/[^ ][^ ]*/"&"/g' -e 's/ /,/g')'];';
- else
- stringarrayexpr='string stringargs[];'
- fi
-
- #workout standard input file
- if [ "${stdin}" ] ; then
- stdinfilexpr='file stdinfile<'\"${stdin}\"'>;'
- else
- stdinfilexpr='file stdinfile<'\"/dev/null\"'>;'
- fi
-
- fileargs=()
- while [ $# -gt 0 ] ; do
- fileargs+=("\"$1\"")
- shift
- done
-
- #workout the array only if user adds args else make it blank
- if [ ${#fileargs[@]} -gt 0 ] ; then
- tmp=$(printf -- '%s,' "${fileargs[@]}")
- filearrayexpr='file fileargs[] <fixed_array_mapper; files="'$(echo $tmp | sed -e 's/,$//' -e 's/\"//g')'">;';
- else
- filearrayexpr='file fileargs[];'
- fi
-
- cat << EOF > $wdir/script.swift
-
- /*
- *
- * Swift source script is generated automatically via the Swift-Galaxy
- * integration tool. Be careful before making any changes to it directly as
- * it might be tied with other configuration and paramter values.
- *
- */
-
- type file;
-
- app (file _out, file _err) anapp(file _exec, int _i, string _stringargs[], file _fileargs[], file _stdin){
- $interpreter @_exec _i _stringargs @_fileargs stdin=@_stdin stdout=@_out stderr=@_err;
- }
- $stringarrayexpr
- $filearrayexpr
- $stdinfilexpr
-
- file exec<"$executable">;
- file listfile<"$listfile">;
- string list[] = readData(listfile);
- foreach l, i in list{
- file out <single_file_mapper; file=@strcat("$outloc", "/", l, ".", i, ".out")>;
- file err <single_file_mapper; file=@strcat("$outloc", "/", l, ".", i, ".err")>;
- (out,err) = anapp(exec, i, stringargs, fileargs, stdinfile);
- }
-EOF
-
- swift=$(which swift)
-
- BASEDIR=$(dirname $0)
- $BASEDIR/buildsite.sh $sites $wdir
-
- #build config
- cat << EOF > $wdir/cf
- use.provider.staging=true
- wrapperlog.always.transfer=true
- execution.retries=0
- provider.staging.pin.swiftfiles=false
- sitedir.keep=true
- lazy.errors=false
- EOF
-
- #build tc
- IFS=',' read -ra S <<< "$sites"
- for site in "${S[@]}" ; do
- cat << EOF >> $wdir/tc
- $site $interpreter $interpreter
-EOF
- done
-
- touch None # Create a "None" file in case user does not specify any stdin file
- $swift -sites.file $wdir/sites.xml -tc.file $wdir/tc -config $wdir/cf $wdir/script.swift "${swiftargs}" 2>$logfile
- EXITCODE=$?
-
- `for i in \`find $outloc -type f\`; do echo "\`basename $i\` $i"; done`
-
- cat << EOF > $outlistfile
- `for i in $(find $outloc -type f -iname "*.out"); do echo "$i"; done`
-EOF
-
- if [ "$EXITCODE" -ne "0" ]; then
- cat $logfile >&2
- fi
- exit $EXITCODE
-
- #dum ditty dum ditty dum dum dum
-}
-
-
-function t()
-{
-
- sites=$1 # comma separated list of sites
- shift
- swiftargs=$1
- shift
- interpreter=$1
- shift
- executable=$1
- shift
- stdin=$1
- shift
- listfile=$1
- shift
- outloc=$1
- shift
- logfile=$1
- shift
- outlistfile=$1
- shift
- stringargs=$1
- shift
-
- #workout the array only if user adds args else make it blank
- if [ "${stringargs}" ] ; then
- stringarrayexpr='string stringargs[]=['$(echo $stringargs | sed -e 's/ *$//g' -e 's/[^ ][^ ]*/"&"/g' -e 's/ /,/g')'];';
- else
- stringarrayexpr='string stringargs[];'
- fi
-
- #workout standard input file
- if [ "${stdin}" ] ; then
- stdinfilexpr='file stdinfile<'\"${stdin}\"'>;'
- else
- stdinfilexpr='file stdinfile<'\"/dev/null\"'>;'
- fi
-
- fileargs=()
- while [ $# -gt 0 ] ; do
- fileargs+=("\"$1\"")
- shift
- done
-
- #workout the array only if user adds args else make it blank
- if [ ${#fileargs[@]} -gt 0 ] ; then
- tmp=$(printf -- '%s,' "${fileargs[@]}")
- filearrayexpr='file fileargs[] <fixed_array_mapper; files="'$(echo $tmp | sed -e 's/,$//' -e 's/\"//g')'">;';
- else
- filearrayexpr='file fileargs[];'
- fi
-
- cat << EOF > $wdir/script.swift
-
- /*
- *
- * Swift source script is generated automatically via the Swift-Galaxy
- * integration tool. Be careful before making any changes to it directly as
- * it might be tied with other configuration and paramter values.
- *
- */
-
- import files;
-
- app (file _out, file _err) anapp(file _exec, int _i, string _stringargs[], file _fileargs[], file _stdin){
- $interpreter _exec _i _stringargs _fileargs @stdin=_stdin @stdout=_out @stderr=_err;
- }
-
- $stringarrayexpr
- $filearrayexpr
- $stdinfilexpr
-
- file exec<"$executable">;
- file listfile<"$listfile">;
- string list[] = split(read(input_file(listfile)),"\n");
- foreach l, i in list{
- file out <sprintf("$outloc/%s.%i.out", l, i)>;
- file err <sprintf("$outloc/%s.%i.err", l, i)>;
- (out,err) = anapp(exec, i, stringargs, fileargs, stdinfile);
- }
-EOF
-
- stc=$(which stc)
- turbine=$(which turbine)
- touch None # Create a "None" file in case user does not specify any stdin file
- $stc -j `which java` $wdir/script.swift "${swiftargs}" 2>$logfile
-
- $turbine -n 3 $wdir/script.tcl
-
- EXITCODE=$?
-
- $(for i in $(find $outloc -type f); do echo "$(basename $i) $i"; done)
-
- cat << EOF > $outlistfile
- $(for i in $(find $outloc -type f -iname "*.out"); do echo "$i"; done)
-EOF
-
- if [ "$EXITCODE" -ne "0" ]; then
- cat $logfile >&2
- fi
- exit $EXITCODE
-
-}
More information about the Swift-commit
mailing list