[Swift-commit] r2735 - in trunk/src/org/griphyn/vdl/karajan/lib: . swiftscript

noreply at svn.ci.uchicago.edu noreply at svn.ci.uchicago.edu
Mon Mar 23 12:36:38 CDT 2009


Author: benc
Date: 2009-03-23 12:36:37 -0500 (Mon, 23 Mar 2009)
New Revision: 2735

Modified:
   trunk/src/org/griphyn/vdl/karajan/lib/SwiftArg.java
   trunk/src/org/griphyn/vdl/karajan/lib/VDLFunction.java
   trunk/src/org/griphyn/vdl/karajan/lib/swiftscript/Misc.java
Log:
Change how trace() deals with non-primitive datasets:

* Array handling:
Previous to this, trace would show the Java object representation of a (Future)PairIterator for arrays, which is fairly useless for a user. This commit makes trace show more about the array, and only emit the trace when the array is closed.

* Other datasets:
Trace will wait for those datasets to be closed, and emit their default
string representation (including the variable name and path used in
SwiftScript)

Modified: trunk/src/org/griphyn/vdl/karajan/lib/SwiftArg.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/lib/SwiftArg.java	2009-03-22 21:58:27 UTC (rev 2734)
+++ trunk/src/org/griphyn/vdl/karajan/lib/SwiftArg.java	2009-03-23 17:36:37 UTC (rev 2735)
@@ -168,6 +168,16 @@
 			return ret;
 		}
 
+		public DSHandle[] asDSHandleArray(VariableStack stack) throws ExecutionException {
+			VariableArguments args = get(stack);
+			DSHandle[] ret = new DSHandle[args.size()];
+			for (int i = 0; i < ret.length; i++) {
+				ret[i] = (DSHandle) args.get(i);
+			}
+			return ret;
+		}
+
+
 		public List asList(VariableStack stack) throws ExecutionException {
 			VariableArguments args = get(stack);
 			List ret = new ArrayList();

Modified: trunk/src/org/griphyn/vdl/karajan/lib/VDLFunction.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/lib/VDLFunction.java	2009-03-22 21:58:27 UTC (rev 2734)
+++ trunk/src/org/griphyn/vdl/karajan/lib/VDLFunction.java	2009-03-23 17:36:37 UTC (rev 2735)
@@ -454,12 +454,17 @@
 		}
 	}
 
-	protected void waitFor(VariableStack stack, DSHandle handle) throws ExecutionException {
+	/** Returns the DSHandle that it is passed, but ensuring that it
+	    is closed. If the handle is not closed, then execution will
+	    be deferred/retried until it is.
+	*/
+	static public DSHandle waitFor(VariableStack stack, DSHandle handle) throws ExecutionException {
 		synchronized(handle.getRoot()) {
 			if (!handle.isClosed()) {
 				throw new FutureNotYetAvailable(addFutureListener(stack, handle));
 			}
 		}
+		return handle;
 	}
 
 	protected static void closeShallow(VariableStack stack, DSHandle handle) throws ExecutionException {

Modified: trunk/src/org/griphyn/vdl/karajan/lib/swiftscript/Misc.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/lib/swiftscript/Misc.java	2009-03-22 21:58:27 UTC (rev 2734)
+++ trunk/src/org/griphyn/vdl/karajan/lib/swiftscript/Misc.java	2009-03-23 17:36:37 UTC (rev 2735)
@@ -10,6 +10,7 @@
 import org.globus.cog.karajan.workflow.ExecutionException;
 import org.globus.cog.karajan.workflow.nodes.functions.FunctionsCollection;
 import org.griphyn.vdl.karajan.lib.SwiftArg;
+import org.griphyn.vdl.karajan.lib.VDLFunction;
 import org.griphyn.vdl.mapping.DSHandle;
 import org.griphyn.vdl.mapping.InvalidPathException;
 import org.griphyn.vdl.mapping.Path;
@@ -18,6 +19,7 @@
 import org.griphyn.vdl.type.NoSuchTypeException;
 import org.griphyn.vdl.type.Types;
 
+
 public class Misc extends FunctionsCollection {
 
 	private static final Logger logger = Logger.getLogger(FunctionsCollection.class);
@@ -38,12 +40,16 @@
 	private static final Logger traceLogger = Logger.getLogger("org.globus.swift.trace");
 	public DSHandle swiftscript_trace(VariableStack stack) throws ExecutionException, NoSuchTypeException,
 			InvalidPathException {
-		Object[] args = SwiftArg.VARGS.asArray(stack);
+
+		DSHandle[] args = SwiftArg.VARGS.asDSHandleArray(stack);
+
 		StringBuffer buf = new StringBuffer();
 		buf.append("SwiftScript trace: ");
 		for (int i = 0; i < args.length; i++) {
+			DSHandle handle = args[i];
+			VDLFunction.waitFor(stack, handle);
 			if(i!=0) buf.append(", ");
-			buf.append(TypeUtil.toString(args[i]));
+			buf.append(args[i]);
 		}
 		traceLogger.warn(buf);
 		return null;




More information about the Swift-commit mailing list