[Swift-commit] r3268 - in trunk: libexec src/org/globus/swift/data/policy
noreply at svn.ci.uchicago.edu
noreply at svn.ci.uchicago.edu
Thu Mar 25 11:58:16 CDT 2010
Author: wozniak
Date: 2010-03-25 11:58:15 -0500 (Thu, 25 Mar 2010)
New Revision: 3268
Added:
trunk/src/org/globus/swift/data/policy/Local.java
Modified:
trunk/libexec/_swiftwrap
trunk/src/org/globus/swift/data/policy/Policy.java
Log:
Draft of CDM LOCAL method.
Modified: trunk/libexec/_swiftwrap
===================================================================
--- trunk/libexec/_swiftwrap 2010-03-25 00:07:30 UTC (rev 3267)
+++ trunk/libexec/_swiftwrap 2010-03-25 16:58:15 UTC (rev 3268)
@@ -127,6 +127,7 @@
return 1
}
+# Output:
cdm_lookup() {
FILE=$1
CDM_FILE=$2
@@ -151,7 +152,7 @@
case $POLICY in
DIRECT)
DIRECT_DIR=${ARGS[0]}
- log "CDM[DIRECT]: Linking $JOBDIR/$FILE to $DIRECT_DIR/$FILE"
+ log "CDM[DIRECT]: Linking to $DIRECT_DIR/$FILE via $JOBDIR/$FILE"
if [ $MODE == "INPUT" ]; then
[ -f "$DIRECT_DIR/$FILE" ]
checkError 254 "CDM[DIRECT]: $DIRECT_DIR/$FILE does not exist!"
@@ -168,6 +169,22 @@
fail 254 "Unknown MODE: $MODE"
fi
;;
+ LOCAL)
+ TOOL=${ARGS[0]}
+ REMOTE_DIR=${ARGS[1]}
+ FLAGS=${ARGS[3]}
+ 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!"
+ $TOOL $FLAGS $REMOTE_DIR/$FILE $JOBDIR/$FILE
+ checkError 254 "CDM[DIRECT]: Tool failed!"
+ elif [ $MODE == "OUTPUT" ]; then
+ log "CDM[LOCAL]..."
+ else
+ fail 254 "Unknown MODE: $MODE"
+ fi
+ ;;
BROADCAST)
BROADCAST_DIR=${ARGS[0]}
log "CDM[BROADCAST]: Linking $JOBDIR/$FILE to $BROADCAST_DIR/$FILE"
@@ -187,6 +204,31 @@
esac
}
+cdm_local_output()
+{
+ L=$1
+
+ if [[ $CDM_FILE == "" ]]; then
+ return
+ fi
+
+ CDM_POLICY=$( cdm_lookup $L $CDM_FILE )
+ cdm_local_output_perform $L $CDM_POLICY
+}
+
+cdm_local_output_perform()
+{
+ L=$1
+ TOOL=$2
+ REMOTE_DIR=$3
+ FLAGS=$3
+ log "Copying $REMOTE_DIR/$FILE to $JOBDIR/$FILE"
+ mkdir -p $REMOTE_DIR
+ checkError 254 "CDM[LOCAL]: mkdir -p $REMOTE_DIR failed!"
+ $TOOL $FLAGS $JOBDIR/$FILE $REMOTE_DIR/$FILE
+ checkError 254 "CDM[LOCAL]: Tool failed!"
+}
+
cdm_gather()
{
GATHER_OUTPUT=${*}
@@ -202,6 +244,8 @@
COMMANDLINE=$@
+echo $0 $COMMANDLINE >> /tmp/swiftwrap.out
+
# get the parent directory of the directory containing _swiftwrap, to use
# as the run directory
# this assumes that _swiftwrap is being executed from the top level of
@@ -410,6 +454,8 @@
fi
if [ $CDM_POLICY == "GATHER" ]; then
GATHER_OUTPUT=( $GATHER_OUTPUT $L )
+ elif [ $CDM_POLICY == "LOCAL" ]; then
+ CDM_LOCAL_OUTPUT=( $CDM_LOCAL_OUTPUT $L )
fi
done
@@ -492,6 +538,7 @@
fi
done
+cdm_local_output $CDM_LOCAL_OUTPUT
cdm_gather $GATHER_OUTPUT
logstate "RM_JOBDIR"
Added: trunk/src/org/globus/swift/data/policy/Local.java
===================================================================
--- trunk/src/org/globus/swift/data/policy/Local.java (rev 0)
+++ trunk/src/org/globus/swift/data/policy/Local.java 2010-03-25 16:58:15 UTC (rev 3268)
@@ -0,0 +1,14 @@
+package org.globus.swift.data.policy;
+
+import java.util.List;
+
+public class Local extends Policy {
+
+ public String toString() {
+ return "PULL";
+ }
+
+ @Override
+ public void settings(List<String> tokens) {
+ }
+}
Modified: trunk/src/org/globus/swift/data/policy/Policy.java
===================================================================
--- trunk/src/org/globus/swift/data/policy/Policy.java 2010-03-25 00:07:30 UTC (rev 3267)
+++ trunk/src/org/globus/swift/data/policy/Policy.java 2010-03-25 16:58:15 UTC (rev 3268)
@@ -17,6 +17,8 @@
return new Default();
else if (token.compareToIgnoreCase("direct") == 0)
return new Direct();
+ else if (token.compareToIgnoreCase("local") == 0)
+ return new Local();
else if (token.compareToIgnoreCase("broadcast") == 0)
return new Broadcast();
else if (token.compareToIgnoreCase("gather") == 0)
More information about the Swift-commit
mailing list