[Swift-commit] r7816 - SwiftApps/swift-galaxy/swift
ketan at ci.uchicago.edu
ketan at ci.uchicago.edu
Mon May 5 20:18:00 CDT 2014
Author: ketan
Date: 2014-05-05 20:18:00 -0500 (Mon, 05 May 2014)
New Revision: 7816
Modified:
SwiftApps/swift-galaxy/swift/swiftforeach.sh
Log:
document the unified code
Modified: SwiftApps/swift-galaxy/swift/swiftforeach.sh
===================================================================
--- SwiftApps/swift-galaxy/swift/swiftforeach.sh 2014-05-06 01:08:05 UTC (rev 7815)
+++ SwiftApps/swift-galaxy/swift/swiftforeach.sh 2014-05-06 01:18:00 UTC (rev 7816)
@@ -2,14 +2,19 @@
# originally list
+#set workdir
wdir=$(mktemp -d /tmp/swift-gal.XXXX)
+#determine loop mode: over a list or a range
range_or_list=$1
shift
+#determine invocation: Swift /K or /T
k_or_t=$1
shift
+#build commandline arguments
+
sites=$1
shift
swiftargs=$1
@@ -42,20 +47,11 @@
stringargs=$1
shift
+touch None # Create a "None" file in case user does not specify any stdin file
-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
+if [ "$k_or_t" = "swiftK" ]
+then # invoke /K
-
-function k()
-{
-
#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')'];';
@@ -135,27 +131,10 @@
$site $interpreter $interpreter
EOF
- 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()
-{
+else # Invoke T
#workout the array only if user adds args else make it blank
if [ "${stringargs}" ] ; then
@@ -217,22 +196,24 @@
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=$?
+
+fi
+
+
+$(for i in $(find $outloc -type f); do echo "$(basename $i) $i"; done)
- $(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)
+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
+if [ "$EXITCODE" -ne "0" ]; then
+ cat $logfile >&2
+fi
+exit $EXITCODE
-}
More information about the Swift-commit
mailing list