[Swift-commit] r6059 - in trunk/src/org/griphyn/vdl: karajan karajan/lib mapping
hategan at ci.uchicago.edu
hategan at ci.uchicago.edu
Sun Nov 18 04:50:47 CST 2012
Author: hategan
Date: 2012-11-18 04:50:43 -0600 (Sun, 18 Nov 2012)
New Revision: 6059
Modified:
trunk/src/org/griphyn/vdl/karajan/VDL2ExecutionContext.java
trunk/src/org/griphyn/vdl/karajan/lib/New.java
trunk/src/org/griphyn/vdl/karajan/lib/SetFieldValue.java
trunk/src/org/griphyn/vdl/mapping/RootArrayDataNode.java
trunk/src/org/griphyn/vdl/mapping/RootDataNode.java
Log:
added duplicate mapping checker
Modified: trunk/src/org/griphyn/vdl/karajan/VDL2ExecutionContext.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/VDL2ExecutionContext.java 2012-11-18 08:48:48 UTC (rev 6058)
+++ trunk/src/org/griphyn/vdl/karajan/VDL2ExecutionContext.java 2012-11-18 10:50:43 UTC (rev 6059)
@@ -29,12 +29,14 @@
import org.globus.cog.karajan.workflow.ExecutionContext;
import org.globus.cog.karajan.workflow.ExecutionException;
import org.griphyn.vdl.karajan.functions.ProcessBulkErrors;
+import org.griphyn.vdl.mapping.DuplicateMappingChecker;
public class VDL2ExecutionContext extends ExecutionContext {
public static final Logger logger = Logger.getLogger(VDL2ExecutionContext.class);
public static final String RUN_ID = "vdl:runid";
public static final String SCRIPT_NAME = "vdl:scriptname";
+ public static final String DM_CHECKER = "vdl:dpmchecker";
private String runID;
private final String scriptName;
@@ -98,6 +100,7 @@
super.setGlobals(stack);
stack.setGlobal(RUN_ID, runID);
stack.setGlobal(SCRIPT_NAME, scriptName);
+ stack.setGlobal(DM_CHECKER, new DuplicateMappingChecker());
}
public String getRunID() {
Modified: trunk/src/org/griphyn/vdl/karajan/lib/New.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/lib/New.java 2012-11-18 08:48:48 UTC (rev 6058)
+++ trunk/src/org/griphyn/vdl/karajan/lib/New.java 2012-11-18 10:50:43 UTC (rev 6059)
@@ -29,8 +29,10 @@
import org.globus.cog.karajan.stack.VariableStack;
import org.globus.cog.karajan.util.TypeUtil;
import org.globus.cog.karajan.workflow.ExecutionException;
+import org.griphyn.vdl.karajan.VDL2ExecutionContext;
import org.griphyn.vdl.mapping.AbstractDataNode;
import org.griphyn.vdl.mapping.DSHandle;
+import org.griphyn.vdl.mapping.DuplicateMappingChecker;
import org.griphyn.vdl.mapping.ExternalDataNode;
import org.griphyn.vdl.mapping.MappingParam;
import org.griphyn.vdl.mapping.MappingParamSet;
@@ -120,7 +122,8 @@
}
else if (type.isArray()) {
// dealing with array variable
- handle = new RootArrayDataNode(type);
+ handle = new RootArrayDataNode(type,
+ (DuplicateMappingChecker) stack.getGlobal(VDL2ExecutionContext.DM_CHECKER));
if (value != null) {
if (value instanceof RootArrayDataNode) {
if (tracer.isEnabled()) {
@@ -169,7 +172,8 @@
handle = (DSHandle) value;
}
else {
- handle = new RootDataNode(type);
+ handle = new RootDataNode(type,
+ (DuplicateMappingChecker) stack.getGlobal(VDL2ExecutionContext.DM_CHECKER));
handle.init(mps);
if (value != null) {
if (tracer.isEnabled()) {
Modified: trunk/src/org/griphyn/vdl/karajan/lib/SetFieldValue.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/lib/SetFieldValue.java 2012-11-18 08:48:48 UTC (rev 6058)
+++ trunk/src/org/griphyn/vdl/karajan/lib/SetFieldValue.java 2012-11-18 10:50:43 UTC (rev 6059)
@@ -28,13 +28,9 @@
import org.globus.cog.karajan.arguments.Arg;
import org.globus.cog.karajan.stack.VariableNotFoundException;
import org.globus.cog.karajan.stack.VariableStack;
-import org.globus.cog.karajan.util.ThreadingContext;
import org.globus.cog.karajan.workflow.ExecutionException;
-import org.globus.cog.karajan.workflow.futures.Future;
import org.globus.cog.karajan.workflow.futures.FutureFault;
import org.globus.cog.karajan.workflow.futures.FutureNotYetAvailable;
-import org.griphyn.vdl.karajan.DSHandleFutureWrapper;
-import org.griphyn.vdl.karajan.FutureWrapper;
import org.griphyn.vdl.karajan.Pair;
import org.griphyn.vdl.karajan.PairIterator;
import org.griphyn.vdl.karajan.WaitingThreadsMonitor;
Modified: trunk/src/org/griphyn/vdl/mapping/RootArrayDataNode.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/RootArrayDataNode.java 2012-11-18 08:48:48 UTC (rev 6058)
+++ trunk/src/org/griphyn/vdl/mapping/RootArrayDataNode.java 2012-11-18 10:50:43 UTC (rev 6059)
@@ -34,6 +34,7 @@
private Mapper mapper;
private MappingParamSet params;
private AbstractDataNode waitingMapperParam;
+ private DuplicateMappingChecker dmc;
private static final Tracer tracer = Tracer.getTracer("VARIABLE");
@@ -42,6 +43,11 @@
*/
public RootArrayDataNode(Type type) {
super(Field.Factory.createField(null, type), null, null);
+ }
+
+ public RootArrayDataNode(Type type, DuplicateMappingChecker dmc) {
+ this(type);
+ this.dmc = dmc;
}
public void init(MappingParamSet params) {
@@ -90,7 +96,7 @@
private void checkInputs() {
try {
- RootDataNode.checkInputs(params, mapper, this);
+ RootDataNode.checkInputs(params, mapper, this, dmc);
}
catch (DependentException e) {
setValue(new MappingDependentException(this, e));
Modified: trunk/src/org/griphyn/vdl/mapping/RootDataNode.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/RootDataNode.java 2012-11-18 08:48:48 UTC (rev 6058)
+++ trunk/src/org/griphyn/vdl/mapping/RootDataNode.java 2012-11-18 10:50:43 UTC (rev 6059)
@@ -38,13 +38,19 @@
private Mapper mapper;
private MappingParamSet params;
private AbstractDataNode waitingMapperParam;
+ private DuplicateMappingChecker dmc;
private static final Tracer tracer = Tracer.getTracer("VARIABLE");
- public RootDataNode(Type type) {
+ public RootDataNode(Type type, DuplicateMappingChecker dmc) {
super(Field.Factory.createField(null, type));
+ this.dmc = dmc;
}
+ public RootDataNode(Type type) {
+ this(type, null);
+ }
+
public RootDataNode(Type type, Object value) {
this(type);
initialized();
@@ -99,7 +105,7 @@
private void checkInputs() {
try {
- checkInputs(params, mapper, this);
+ checkInputs(params, mapper, this, dmc);
}
catch (DependentException e) {
setValue(new MappingDependentException(this, e));
@@ -113,10 +119,11 @@
}
- static protected void checkInputs(MappingParamSet params, Mapper mapper, AbstractDataNode root) {
+ static protected void checkInputs(MappingParamSet params, Mapper mapper, AbstractDataNode root,
+ DuplicateMappingChecker dmc) {
String input = (String) params.get(MappingParam.SWIFT_INPUT);
if (input != null && Boolean.valueOf(input.trim()).booleanValue()) {
- addExisting(mapper, root);
+ addExisting(mapper, root, dmc);
checkConsistency(root);
}
else if (mapper.isStatic()) {
@@ -131,10 +138,12 @@
logger.debug("mapper: " + mapper);
}
for (Path p : mapper.existing()) {
+ PhysicalFormat f = mapper.map(p);
try {
// Try to get the path in order to check that the
// path is valid - we'll get an exception if not
- root.getField(p);
+ DSHandle h = root.getField(p);
+ dmc.addWrite(f, h);
if (tracer.isEnabled()) {
tracer.trace(root.getThread(), root.getDeclarationLine(),
root.getDisplayableName() + " MAPPING " + p + ", " + mapper.map(p));
@@ -154,12 +163,14 @@
}
}
- private static void addExisting(Mapper mapper, AbstractDataNode root) {
+ private static void addExisting(Mapper mapper, AbstractDataNode root, DuplicateMappingChecker dmc) {
boolean any = false;
for (Path p : mapper.existing()) {
+ PhysicalFormat f = mapper.map(p);
try {
DSHandle field = root.getField(p);
field.closeShallow();
+ dmc.addRead(f, field);
if (tracer.isEnabled()) {
tracer.trace(root.getThread(), root.getDeclarationLine(),
root.getDisplayableName() + " MAPPING " + p + ", " + mapper.map(p));
More information about the Swift-commit
mailing list