[Swift-commit] r7571 - SwiftApps/swift-galaxy/swift

ketan at ci.uchicago.edu ketan at ci.uchicago.edu
Tue Feb 4 22:30:23 CST 2014


Author: ketan
Date: 2014-02-04 22:30:23 -0600 (Tue, 04 Feb 2014)
New Revision: 7571

Modified:
   SwiftApps/swift-galaxy/swift/buildsite.sh
   SwiftApps/swift-galaxy/swift/swiftforeachlist.sh
   SwiftApps/swift-galaxy/swift/swiftforeachrange.sh
Log:
put built code in tempdir to avoid collision

Modified: SwiftApps/swift-galaxy/swift/buildsite.sh
===================================================================
--- SwiftApps/swift-galaxy/swift/buildsite.sh	2014-02-05 00:05:09 UTC (rev 7570)
+++ SwiftApps/swift-galaxy/swift/buildsite.sh	2014-02-05 04:30:23 UTC (rev 7571)
@@ -8,14 +8,13 @@
 
 # defaults to localhost of none of the above provided
 
-echo $@ > /tmp/args.txt
 # numeric range
 site=$1
-
+wdir=$2
 # use "here" document for configs
 case "$site" in
 midway )
-cat << EOF > /tmp/sites.xml
+cat << EOF > $wdir/sites.xml
 <?xml version="1.0" encoding="UTF-8"?>
 <config xmlns="http://www.ci.uchicago.edu/swift/SwiftSites">
   <pool handle="midway">
@@ -39,7 +38,7 @@
 ;;
 
 uc3 )
-cat << EOF > /tmp/sites.xml
+cat << EOF > $wdir/sites.xml
 <?xml version="1.0" encoding="UTF-8"?>
 <config xmlns="http://www.ci.uchicago.edu/swift/SwiftSites">
   <pool handle="uc3">
@@ -66,7 +65,7 @@
 ;;
 
 stampede )
-cat << EOF > /tmp/sites.xml
+cat << EOF > $wdir/sites.xml
 <?xml version="1.0" encoding="UTF-8"?>
 <config xmlns="http://www.ci.uchicago.edu/swift/SwiftSites">
 <pool handle="stampede">
@@ -94,7 +93,7 @@
 ;;
 
 localhost )
-cat << EOF > /tmp/sites.xml
+cat << EOF > $wdir/sites.xml
 <?xml version="1.0" encoding="UTF-8"?>
 <config xmlns="http://www.ci.uchicago.edu/swift/SwiftSites">
 <pool handle="localhost">
@@ -112,7 +111,7 @@
 
 * )
 echo "defaulting to localhost"
-cat << EOF > /tmp/sites.xml
+cat << EOF > $wdir/sites.xml
 <?xml version="1.0" encoding="UTF-8"?>
 <config xmlns="http://www.ci.uchicago.edu/swift/SwiftSites">
 <pool handle="localhost">

Modified: SwiftApps/swift-galaxy/swift/swiftforeachlist.sh
===================================================================
--- SwiftApps/swift-galaxy/swift/swiftforeachlist.sh	2014-02-05 00:05:09 UTC (rev 7570)
+++ SwiftApps/swift-galaxy/swift/swiftforeachlist.sh	2014-02-05 04:30:23 UTC (rev 7571)
@@ -1,5 +1,7 @@
 #!/bin/bash
 
+wdir=$(mktemp -d /tmp/swift-gal.XXXX)
+
 # numeric range
 site=$1
 shift
@@ -31,7 +33,7 @@
 fi
 
 
-cat << EOF > /tmp/script.swift
+cat << EOF > $wdir/script.swift
 type file;
 
 app (file _out, file _err) anapp(file _exec, int _i, string _args[]){
@@ -52,11 +54,11 @@
 swift=$(which swift)
 
 BASEDIR=$(dirname $0)
-$BASEDIR/buildsite.sh $site
+$BASEDIR/buildsite.sh $site $wdir
 
 #build config
 if [ "$site" = "localhost" ] ; then
-cat << EOF > /tmp/cf
+cat << EOF > $wdir/cf
 use.provider.staging=false
 wrapperlog.always.transfer=true
 execution.retries=0
@@ -65,7 +67,7 @@
 lazy.errors=false
 EOF
 else
-cat << EOF > /tmp/cf
+cat << EOF > $wdir/cf
 use.provider.staging=true
 wrapperlog.always.transfer=true
 execution.retries=0
@@ -75,11 +77,11 @@
 EOF
 fi
 
-cat << EOF > /tmp/tc
+cat << EOF > $wdir/tc
 $site $interpreter $interpreter
 EOF
 
-$swift -sites.file /tmp/sites.xml -tc.file /tmp/tc -config /tmp/cf /tmp/script.swift 2>$logfile
+$swift -sites.file $wdir/sites.xml -tc.file $wdir/tc -config $wdir/cf $wdir/script.swift 2>$logfile
 EXITCODE=$?
 
 #`for i in \`find $HOME/swift-sandbox -type f\`; do echo "\`basename $i\` $i"; done`

Modified: SwiftApps/swift-galaxy/swift/swiftforeachrange.sh
===================================================================
--- SwiftApps/swift-galaxy/swift/swiftforeachrange.sh	2014-02-05 00:05:09 UTC (rev 7570)
+++ SwiftApps/swift-galaxy/swift/swiftforeachrange.sh	2014-02-05 04:30:23 UTC (rev 7571)
@@ -1,9 +1,6 @@
 #!/bin/bash
 
-#ToDo:
-#
-#1. Add a variable number of arguments such that user can add and remove them.
-#
+wdir=$(mktemp -d /tmp/swift-gal.XXXX)
 
 # numeric range
 site=$1
@@ -40,7 +37,7 @@
 fi
 
 #Build Swift source code
-cat << EOF > /tmp/script.swift
+cat << EOF > $wdir/script.swift
 type file;
 
 app (file _out, file _err) anapp(file _exec, int _i, string _args[]){
@@ -60,11 +57,11 @@
 
 #build site
 BASEDIR=$(dirname $0)
-$BASEDIR/buildsite.sh $site
+$BASEDIR/buildsite.sh $site $wdir
 
 #build config
 if [ "$site" = "localhost" ] ; then
-cat << EOF > /tmp/cf
+cat << EOF > $wdir/cf
 use.provider.staging=false
 wrapperlog.always.transfer=true
 execution.retries=0
@@ -73,7 +70,7 @@
 lazy.errors=false
 EOF
 else
-cat << EOF > /tmp/cf
+cat << EOF > $wdir/cf
 use.provider.staging=true
 wrapperlog.always.transfer=true
 execution.retries=0
@@ -84,11 +81,11 @@
 fi
 
 #build tc
-cat << EOF > /tmp/tc
+cat << EOF > $wdir/tc
 $site $interpreter $interpreter
 EOF
 
-$swift -sites.file /tmp/sites.xml -tc.file /tmp/tc -config /tmp/cf /tmp/script.swift 2>$logfile
+$swift -sites.file $wdir/sites.xml -tc.file $wdir/tc -config $wdir/cf $wdir/script.swift 2>$logfile
 EXITCODE=$?
 
 #`for i in \`find $HOME/swift-sandbox -type f\`; do echo "\`basename $i\` $i"; done`
@@ -98,7 +95,7 @@
 EOF
 
 #cleanup
-rm -rf /tmp/sites.xml /tmp/tc /tmp/cf /tmp/script.swift 
+#rm -rf /tmp/sites.xml /tmp/tc /tmp/cf /tmp/script.swift 
 
 if [ "$EXITCODE" -ne "0" ]; then
        cat $logfile >&2




More information about the Swift-commit mailing list