[Swift-commit] r3277 - trunk/libexec

noreply at svn.ci.uchicago.edu noreply at svn.ci.uchicago.edu
Sat Apr 10 14:16:57 CDT 2010


Author: wozniak
Date: 2010-04-10 14:16:56 -0500 (Sat, 10 Apr 2010)
New Revision: 3277

Modified:
   trunk/libexec/_swiftwrap
   trunk/libexec/cdm_broadcast.sh
   trunk/libexec/vdl-int.k
Log:
Corrections to CDM BROADCAST for BG/P.


Modified: trunk/libexec/_swiftwrap
===================================================================
--- trunk/libexec/_swiftwrap	2010-04-09 02:44:05 UTC (rev 3276)
+++ trunk/libexec/_swiftwrap	2010-04-10 19:16:56 UTC (rev 3277)
@@ -177,9 +177,9 @@
  			log "CDM[LOCAL]: Copying $DIRECT_DIR/$FILE to $JOBDIR/$FILE"
  			if [ $MODE == "INPUT" ]; then 
  				[ -f "$DIRECT_DIR/$FILE" ]
- 				checkError 254 "CDM[DIRECT]: $REMOTE_DIR/$FILE does not exist!"
+ 				checkError 254 "CDM[LOCAL]: $REMOTE_DIR/$FILE does not exist!"
  				$TOOL $FLAGS $REMOTE_DIR/$FILE $JOBDIR/$FILE
- 				checkError 254 "CDM[DIRECT]: Tool failed!"
+ 				checkError 254 "CDM[LOCAL]: Tool failed!"
  			elif [ $MODE == "OUTPUT" ]; then 
  				log "CDM[LOCAL]..."
  			else 
@@ -188,14 +188,15 @@
  			;;
 		BROADCAST)
 			BROADCAST_DIR=${ARGS[0]}
-			log "CDM[BROADCAST]: Linking $JOBDIR/$FILE to $BROADCAST_DIR/$FILE"
+			
 			if [ $MODE == "INPUT" ]; then 
+				log "CDM[BROADCAST]: Linking $JOBDIR/$FILE to $BROADCAST_DIR/$FILE"
 				[ -f "$BROADCAST_DIR/$FILE" ]
 				checkError 254 "CDM[BROADCAST]: $BROADCAST_DIR/$FILE does not exist!"
 				ln -s $BROADCAST_DIR/$FILE $JOBDIR/$FILE
 				checkError 254 "CDM[BROADCAST]: Linking to $BROADCAST_DIR/$FILE failed!"
 			else 
-				fail 254 "Cannot BROADCAST an output file!"
+				echo "CDM[BROADCAST]: Skipping output file: ${FILE}"
 			fi
 			;;
 		GATHER)
@@ -214,7 +215,9 @@
 	fi
 
  	CDM_POLICY=$( cdm_lookup $L $CDM_FILE )
- 	cdm_local_output_perform $L $CDM_POLICY
+	if [[ $CDM_POLICY == "LOCAL" ]]; then 
+		cdm_local_output_perform $L $CDM_POLICY
+	fi
 }
 
 cdm_local_output_perform()
@@ -448,7 +451,8 @@
 GATHER_OUTPUT=()
 for L in $OUTF ; do
 	CDM_POLICY=$( cdm_lookup $L $CDM_FILE )
-	if [ $CDM_POLICY != "DEFAULT" ]; then
+	if [[ $CDM_POLICY != "DEFAULT" && 
+              $CDM_POLICY != "BROADCAST"* ]]; then
 		log "CDM_POLICY: $L -> $CDM_POLICY" 
     	        eval cdm_action $DIR "OUTPUT" $L $CDM_POLICY
 		SKIPPED_OUTPUT=( $SKIPPED_OUTPUT $L )

Modified: trunk/libexec/cdm_broadcast.sh
===================================================================
--- trunk/libexec/cdm_broadcast.sh	2010-04-09 02:44:05 UTC (rev 3276)
+++ trunk/libexec/cdm_broadcast.sh	2010-04-10 19:16:56 UTC (rev 3277)
@@ -2,13 +2,53 @@
 
 SWIFT_HOME=$( dirname $( dirname $0 ) )
 LOG=${SWIFT_HOME}/etc/cdm_broadcast.log
+
+bgp_broadcast()
 {
+  DIR=$1
+  FILE=$2
+  DEST=$3
+  if [[ ! -f ips.list ]] 
+    then
+    BLOCKS=$( qstat -u ${USER} | grep ${USER} | awk '{ print $6 }' )
+    IPS=$( listip ${BLOCKS} )
+    for IP in ${IPS}
+     do
+     echo ${IP}
+    done >> ip.list
+  else
+    while read T
+     do 
+     BLOCKS="$BLOCKS $T" 
+    done < ip.list
+  fi
+  for IP in ${BLOCKS}
+   do
+   ssh ${IP} /bin.rd/f2cn ${DIR}/${FILE} ${DEST}/${FILE}
+  done
+}
+
+local_broadcast()
+{
+  DIR=$1
+  FILE=$2
+  DEST=$3
+  cp -v ${FILE} ${DEST}/${FILE}
+}
+  
+{
+  declare -p PWD
     set -x
 
     FILE=$1
     DIR=$2
     DEST=$3
-    
-    cp -v ${DIR}/${FILE} ${DEST}
 
+    if [[ $( uname -p ) == "ppc64" ]]
+      then
+      bgp_broadcast ${DIR} ${FILE} ${DEST}
+    else 
+      bgp_local ${DIR} ${FILE} ${DEST}
+    fi
+
 } >> ${LOG} 2>&1

Modified: trunk/libexec/vdl-int.k
===================================================================
--- trunk/libexec/vdl-int.k	2010-04-09 02:44:05 UTC (rev 3276)
+++ trunk/libexec/vdl-int.k	2010-04-10 19:16:56 UTC (rev 3277)
@@ -314,8 +314,8 @@
 				log(LOG:DEBUG, "FILE_STAGE_IN_BROADCAST file={srcfile} policy={policy}")
 				cdm:broadcast(srcfile=srcfile, srcdir=srcdir))
 			else(log(LOG:DEBUG, "FILE_STAGE_IN_SKIP file={srcfile} policy={policy}")))
-			log(LOG:DEBUG, "FILE_STAGE_IN_END file={srcfile} srchost={srchost} srcdir={srcdir} srcname={srcfile} ",
-                                               "desthost={desthost} destdir={destdir} provider={provider}")
+				log(LOG:DEBUG, "FILE_STAGE_IN_END file={srcfile} srchost={srchost} srcdir={srcdir} srcname={srcfile} ",
+                                              "desthost={desthost} destdir={destdir} provider={provider}")
 			)			
  	        )
 
@@ -338,10 +338,11 @@
 					//make sure we do have the directory on the client side
 					dir:make(ldir, host=dhost, provider=provider)
 					policy := cdm:query(query=file)
-					if (policy == "DEFAULT" then(
+					if (sys:or(policy == "DEFAULT", policy == "BROADCAST")
+						then(
 						restartOnError(".*", 2
-							task:transfer(srchost=host, srcfile=bname,
-								srcdir=rdir, destdir=ldir, desthost=dhost, destprovider=provider)))
+							task:transfer(srchost=host, srcfile=bname,srcdir=rdir, 
+								destdir=ldir, desthost=dhost, destprovider=provider)))
 					else(log(LOG:DEBUG, "FILE_STAGE_OUT_SKIP srcname={bname}"))
 					)
 					log(LOG:DEBUG, "FILE_STAGE_OUT_END srcname={bname} srcdir={rdir} srchost={host} ",




More information about the Swift-commit mailing list