[Swift-commit] r3850 - trunk/libexec

noreply at svn.ci.uchicago.edu noreply at svn.ci.uchicago.edu
Wed Jan 5 12:25:36 CST 2011


Author: wozniak
Date: 2011-01-05 12:25:36 -0600 (Wed, 05 Jan 2011)
New Revision: 3850

Modified:
   trunk/libexec/_swiftwrap.staging
Log:
New SWIFTWRAP_FAST variable to turn off logging and certain checks
Usage: add to sites.xml: <profile namespace="env" key="SWIFTWRAP_FAST">1</profile>


Modified: trunk/libexec/_swiftwrap.staging
===================================================================
--- trunk/libexec/_swiftwrap.staging	2011-01-05 17:34:55 UTC (rev 3849)
+++ trunk/libexec/_swiftwrap.staging	2011-01-05 18:25:36 UTC (rev 3850)
@@ -1,5 +1,20 @@
 # this script must be invoked inside of bash, not plain sh
 
+openinfo() {
+	exec 3<> $1
+	INFO=3
+}
+
+closeinfo() {
+	exec 3>&-
+}
+
+# Clobbered by SWIFTWRAP_FAST
+log() {
+	echo "$@" >& "$INFO"
+}
+
+# Clobbered by SWIFTWRAP_FAST
 infosection() {
 	echo >& "$INFO"
 	echo "_____________________________________________________________________________" >& "$INFO"
@@ -38,14 +53,11 @@
 	fi
 }
 
+# Clobbered by SWIFTWRAP_FAST
 logstate() {
 	echo "Progress " `date +"%Y-%m-%d %H:%M:%S.%N%z"` " $@" >& "$INFO"
 }
 
-log() {
-	echo "$@" >& "$INFO"
-}
-
 fail() {
 	EC=$1
 	shift
@@ -77,13 +89,32 @@
 	fi
 }
 
+# Clobbered by SWIFTWRAP_FAST
+checkMissing() {
+	MISSING=
+	for O in $OUTF ; do
+		if [ ! -f "$O" ]; then
+			if [ "$MISSING" == "" ]; then
+				MISSING=$O
+			else
+				MISSING="$MISSING, $O"
+			fi
+		fi
+	done
+	if [ "$MISSING" != "" ]; then
+		fail 254 "The following output files were not created by the application: $MISSING"
+	fi
+}
+
 checkparamfile() {
 	log "checking for paramfile"
 	if [ "$1" == "-p" ]; then
 		JOBDIR=$2
 		PARAMFILE=${WFDIR}/parameters/${JOBDIR}/param-${ID}
+		log "paramfile is: $PARAMFILE"
+	else
+		log "no paramfile: using command line arguments"
 	fi
-	log "paramfile is: $PARAMFILE"
 }
 
 getarg() {
@@ -107,15 +138,6 @@
 	fi
 }
 
-openinfo() {
-	exec 3<> $1
-	INFO=3
-}
-
-closeinfo() {
-	exec 3>&-
-}
-
 COMMANDLINE=$@
 
 # make the WFDIR absolute
@@ -125,13 +147,24 @@
 
 checkparamfile "$@"
 
+# # SWIFTWRAP_FAST: Turn things off for speed
+if [[ $SWIFTWRAP_FAST == "1" ]]; then
+	shopt -s expand_aliases
+	alias infosection=:
+	alias logstate=:
+	alias log=:
+	alias checkMissing=:
+fi
+
 if [ "X$INFODIR" == "X" ]; then
 	INFODIR="."
 fi
 
 logstate "LOG_START"
-infosection "Wrapper"
+infosection "Wrapper (_swiftwrap.staging)"
 
+log $COMMANDLINE
+
 getarg "-e" "$@"
 EXEC=$VALUE
 shift $SHIFTCOUNT
@@ -253,7 +286,6 @@
 
 logstate "EXECUTE"
 
-#ls >>$WRAPPERLOG
 if [ ! -f "$EXEC" ]; then
 	fail 254 "The executable $EXEC does not exist"
 fi
@@ -290,19 +322,7 @@
 logstate "EXECUTE_DONE"
 log "Job ran successfully"
 
-MISSING=
-for O in $OUTF ; do
-	if [ ! -f "$O" ]; then
-		if [ "$MISSING" == "" ]; then
-			MISSING=$O
-		else
-			MISSING="$MISSING, $O"
-		fi
-	fi
-done
-if [ "$MISSING" != "" ]; then
-	fail 254 "The following output files were not created by the application: $MISSING"
-fi
+checkMissing
 
 logstate "END"
 




More information about the Swift-commit mailing list