[Swift-commit] r6254 - in branches/faster/src/org/griphyn/vdl: karajan/lib mapping/file

hategan at ci.uchicago.edu hategan at ci.uchicago.edu
Fri Feb 8 23:30:50 CST 2013


Author: hategan
Date: 2013-02-08 23:30:50 -0600 (Fri, 08 Feb 2013)
New Revision: 6254

Modified:
   branches/faster/src/org/griphyn/vdl/karajan/lib/CreateArray.java
   branches/faster/src/org/griphyn/vdl/karajan/lib/Execute.java
   branches/faster/src/org/griphyn/vdl/karajan/lib/GetField.java
   branches/faster/src/org/griphyn/vdl/karajan/lib/GetFieldSubscript.java
   branches/faster/src/org/griphyn/vdl/karajan/lib/IsDone.java
   branches/faster/src/org/griphyn/vdl/karajan/lib/IsLogged.java
   branches/faster/src/org/griphyn/vdl/mapping/file/CSVMapper.java
Log:
misc fixes

Modified: branches/faster/src/org/griphyn/vdl/karajan/lib/CreateArray.java
===================================================================
--- branches/faster/src/org/griphyn/vdl/karajan/lib/CreateArray.java	2013-02-09 05:30:12 UTC (rev 6253)
+++ branches/faster/src/org/griphyn/vdl/karajan/lib/CreateArray.java	2013-02-09 05:30:50 UTC (rev 6254)
@@ -43,7 +43,7 @@
 
 	@Override
     protected Signature getSignature() {
-        return new Signature(params("value"));
+        return new Signature(params("value", optional("_traceline", null)));
     }
 
     public Object function(Stack stack) {

Modified: branches/faster/src/org/griphyn/vdl/karajan/lib/Execute.java
===================================================================
--- branches/faster/src/org/griphyn/vdl/karajan/lib/Execute.java	2013-02-09 05:30:12 UTC (rev 6253)
+++ branches/faster/src/org/griphyn/vdl/karajan/lib/Execute.java	2013-02-09 05:30:50 UTC (rev 6254)
@@ -26,7 +26,6 @@
 import k.rt.Context;
 import k.rt.ExecutionException;
 import k.rt.Stack;
-import k.thr.LWThread;
 
 import org.apache.log4j.Logger;
 import org.globus.cog.abstraction.impl.common.StatusEvent;

Modified: branches/faster/src/org/griphyn/vdl/karajan/lib/GetField.java
===================================================================
--- branches/faster/src/org/griphyn/vdl/karajan/lib/GetField.java	2013-02-09 05:30:12 UTC (rev 6253)
+++ branches/faster/src/org/griphyn/vdl/karajan/lib/GetField.java	2013-02-09 05:30:50 UTC (rev 6254)
@@ -38,7 +38,7 @@
 	
 	@Override
     protected Signature getSignature() {
-        return new Signature(params("var", optional("path", Path.EMPTY_PATH)));
+        return new Signature(params("var", "path"));
     }
 
 	@Override

Modified: branches/faster/src/org/griphyn/vdl/karajan/lib/GetFieldSubscript.java
===================================================================
--- branches/faster/src/org/griphyn/vdl/karajan/lib/GetFieldSubscript.java	2013-02-09 05:30:12 UTC (rev 6253)
+++ branches/faster/src/org/griphyn/vdl/karajan/lib/GetFieldSubscript.java	2013-02-09 05:30:50 UTC (rev 6254)
@@ -24,14 +24,16 @@
 
 import org.globus.cog.karajan.analyzer.ArgRef;
 import org.globus.cog.karajan.analyzer.Signature;
+import org.griphyn.vdl.mapping.AbstractDataNode;
 import org.griphyn.vdl.mapping.DSHandle;
 import org.griphyn.vdl.mapping.HandleOpenException;
 import org.griphyn.vdl.mapping.InvalidPathException;
+import org.griphyn.vdl.mapping.OOBYield;
 import org.griphyn.vdl.mapping.Path;
 
 public class GetFieldSubscript extends SwiftFunction {
     private ArgRef<DSHandle> var;
-    private ArgRef<Object> subscript;
+    private ArgRef<AbstractDataNode> subscript;
 
 	@Override
     protected Signature getSignature() {
@@ -42,9 +44,11 @@
 	public Object function(Stack stack) {
 		DSHandle var = this.var.getValue(stack);
 
-		Object index = this.subscript.getValue(stack);
+		AbstractDataNode indexh = this.subscript.getValue(stack);
 
 		try {
+		    indexh.waitFor();
+		    Object index = indexh.getValue();
 			Path path;
 			if ("*".equals(index)) {
 			    path = Path.CHILDREN;
@@ -60,6 +64,9 @@
 				return fields;
 			}
 		}
+		catch (OOBYield y) {
+		    throw y.wrapped(this);
+		}
 		catch (InvalidPathException e) {
 			throw new ExecutionException(this, e);
 		}

Modified: branches/faster/src/org/griphyn/vdl/karajan/lib/IsDone.java
===================================================================
--- branches/faster/src/org/griphyn/vdl/karajan/lib/IsDone.java	2013-02-09 05:30:12 UTC (rev 6253)
+++ branches/faster/src/org/griphyn/vdl/karajan/lib/IsDone.java	2013-02-09 05:30:50 UTC (rev 6254)
@@ -22,32 +22,39 @@
 
 import java.util.List;
 
+import k.rt.Context;
 import k.rt.Stack;
 
 import org.globus.cog.karajan.analyzer.ArgRef;
-import org.globus.cog.karajan.analyzer.ChannelRef;
+import org.globus.cog.karajan.analyzer.Scope;
 import org.globus.cog.karajan.analyzer.Signature;
-import org.globus.cog.karajan.compiled.nodes.restartLog.LogChannelOperator;
+import org.globus.cog.karajan.analyzer.VarRef;
 import org.griphyn.vdl.mapping.DSHandle;
 import org.griphyn.vdl.mapping.Path;
 
 public class IsDone extends SwiftFunction {
     private ArgRef<Iterable<List<Object>>> stageout;
     
-    private ChannelRef<String> cr_restartLog;
+    private VarRef<Context> context;
 
     @Override
     protected Signature getSignature() {
-        return new Signature(params("stageout"), returns(channel("...", 1), channel("restartLog")));
+        return new Signature(params("stageout"), returns(channel("...", 1)));
     }
     
     @Override
+    protected void addLocals(Scope scope) {
+        context = scope.getVarRef("#context");
+        super.addLocals(scope);
+    }
+    
+    @Override
     public Object function(Stack stack) {
         Iterable<List<Object>> files = stageout.getValue(stack);
         for (List<Object> pv : files) {
             Path p = (Path) pv.get(0);
             DSHandle handle = (DSHandle) pv.get(1);
-            if (!IsLogged.isLogged((LogChannelOperator) cr_restartLog.get(stack), handle, p)) {
+            if (!IsLogged.isLogged(context.getValue(stack), handle, p)) {
                 return Boolean.FALSE;
             }
         }

Modified: branches/faster/src/org/griphyn/vdl/karajan/lib/IsLogged.java
===================================================================
--- branches/faster/src/org/griphyn/vdl/karajan/lib/IsLogged.java	2013-02-09 05:30:12 UTC (rev 6253)
+++ branches/faster/src/org/griphyn/vdl/karajan/lib/IsLogged.java	2013-02-09 05:30:50 UTC (rev 6254)
@@ -23,14 +23,16 @@
 import java.util.List;
 import java.util.Map;
 
+import k.rt.Context;
 import k.rt.ExecutionException;
 import k.rt.Stack;
 
 import org.globus.cog.karajan.analyzer.ArgRef;
-import org.globus.cog.karajan.analyzer.ChannelRef;
+import org.globus.cog.karajan.analyzer.Scope;
 import org.globus.cog.karajan.analyzer.Signature;
-import org.globus.cog.karajan.compiled.nodes.restartLog.LogChannelOperator;
+import org.globus.cog.karajan.analyzer.VarRef;
 import org.globus.cog.karajan.compiled.nodes.restartLog.LogEntry;
+import org.globus.cog.karajan.compiled.nodes.restartLog.RestartLog;
 import org.globus.cog.karajan.util.TypeUtil;
 import org.griphyn.vdl.mapping.DSHandle;
 import org.griphyn.vdl.mapping.MappingParam;
@@ -40,12 +42,18 @@
 	private ArgRef<DSHandle> var;
 	private ArgRef<Object> path;
 	
-	private ChannelRef<String> cr_restartLog;
+	private VarRef<Context> context;
 	
 	@Override
     protected Signature getSignature() {
-        return new Signature(params("var", "path"), returns(channel("restartLog")));
+        return new Signature(params("var", "path"));
     }
+	
+	@Override
+    protected void addLocals(Scope scope) {
+        context = scope.getVarRef("#context");
+        super.addLocals(scope);
+    }
 
 	@Override
     public Object function(Stack stack) {	
@@ -58,11 +66,12 @@
 		else {
 			path = Path.parse(TypeUtil.toString(p));
 		}
-		return Boolean.valueOf(isLogged((LogChannelOperator) cr_restartLog.get(stack), var, path));
+		return Boolean.valueOf(isLogged(context.getValue(stack), var, path));
 	}
 	
-	public static boolean isLogged(LogChannelOperator log, DSHandle var, Path path) throws ExecutionException {
-		Map<LogEntry, Object> logData = log.getLogData();
+	public static boolean isLogged(Context ctx, DSHandle var, Path path) throws ExecutionException {
+		@SuppressWarnings("unchecked")
+        Map<LogEntry, Object> logData = (Map<LogEntry, Object>) ctx.getAttribute(RestartLog.LOG_DATA);
 	    path = var.getPathFromRoot().append(path);
         LogEntry entry = LogEntry.build(var.getRoot().getParam(MappingParam.SWIFT_RESTARTID) + "." + path.stringForm());
         boolean found = false;

Modified: branches/faster/src/org/griphyn/vdl/mapping/file/CSVMapper.java
===================================================================
--- branches/faster/src/org/griphyn/vdl/mapping/file/CSVMapper.java	2013-02-09 05:30:12 UTC (rev 6253)
+++ branches/faster/src/org/griphyn/vdl/mapping/file/CSVMapper.java	2013-02-09 05:30:50 UTC (rev 6254)
@@ -80,7 +80,13 @@
 			throw new InvalidMappingParameterException("CSV mapper must have a file parameter.");
 		}
 		if (!PARAM_HDELIMITER.isPresent(this)) {
-		    params.set(PARAM_HDELIMITER, PARAM_DELIMITER.getRawValue(this));
+		    Object raw = PARAM_DELIMITER.getRawValue(this);
+		    if (raw != null) {
+		        params.set(PARAM_HDELIMITER, PARAM_DELIMITER.getRawValue(this));
+		    }
+		    else {
+		        params.set(PARAM_HDELIMITER, PARAM_DELIMITER.getValue(this));
+		    }
 		}
 		delim = PARAM_DELIMITER.getStringValue(this);
         hdelim = PARAM_HDELIMITER.getStringValue(this);




More information about the Swift-commit mailing list