[Swift-commit] r2372 - in trunk: src/org/griphyn/vdl/karajan/lib/swiftscript tests/misc

noreply at svn.ci.uchicago.edu noreply at svn.ci.uchicago.edu
Sun Dec 14 15:14:17 CST 2008


Author: benc
Date: 2008-12-14 15:14:16 -0600 (Sun, 14 Dec 2008)
New Revision: 2372

Added:
   trunk/tests/misc/extract-int-delayed-slowint.sh
   trunk/tests/misc/extract-int-delayed.sh
   trunk/tests/misc/extract-int-delayed.swift
Modified:
   trunk/src/org/griphyn/vdl/karajan/lib/swiftscript/ExtractInt.java
   trunk/tests/misc/run
Log:
make @extractint work with files that are constructed during a run - previously @extractint did not properly defer its execution when passed an unclosed file

Modified: trunk/src/org/griphyn/vdl/karajan/lib/swiftscript/ExtractInt.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/lib/swiftscript/ExtractInt.java	2008-12-14 20:04:53 UTC (rev 2371)
+++ trunk/src/org/griphyn/vdl/karajan/lib/swiftscript/ExtractInt.java	2008-12-14 21:14:16 UTC (rev 2372)
@@ -8,12 +8,14 @@
 import org.globus.cog.karajan.arguments.Arg;
 import org.globus.cog.karajan.stack.VariableStack;
 import org.globus.cog.karajan.workflow.ExecutionException;
+import org.globus.cog.karajan.workflow.futures.FutureNotYetAvailable;
 import org.griphyn.vdl.karajan.lib.VDLFunction;
 import org.griphyn.vdl.mapping.DSHandle;
 import org.griphyn.vdl.mapping.HandleOpenException;
 import org.griphyn.vdl.mapping.RootDataNode;
 import org.griphyn.vdl.type.Types;
 
+
 public class ExtractInt extends VDLFunction {
 	static {
 		setArguments(ExtractInt.class, new Arg[] { PA_VAR });
@@ -24,6 +26,9 @@
 		try {
 			handle = (DSHandle) PA_VAR.getValue(stack);
 			synchronized(handle.getRoot()) {
+				if (!handle.isClosed()) {
+					throw new FutureNotYetAvailable(addFutureListener(stack, handle));
+				}
 				String fn = argList(filename(handle), true);
 				Reader freader = new FileReader(fn);
 				BufferedReader breader = new BufferedReader(freader);

Added: trunk/tests/misc/extract-int-delayed-slowint.sh
===================================================================
--- trunk/tests/misc/extract-int-delayed-slowint.sh	                        (rev 0)
+++ trunk/tests/misc/extract-int-delayed-slowint.sh	2008-12-14 21:14:16 UTC (rev 2372)
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+# helper for extractint test - output something suitable for
+# extractint, but after substantial delay
+
+sleep 10s
+echo 121


Property changes on: trunk/tests/misc/extract-int-delayed-slowint.sh
___________________________________________________________________
Name: svn:executable
   + *

Added: trunk/tests/misc/extract-int-delayed.sh
===================================================================
--- trunk/tests/misc/extract-int-delayed.sh	                        (rev 0)
+++ trunk/tests/misc/extract-int-delayed.sh	2008-12-14 21:14:16 UTC (rev 2372)
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+# generate an integer in a file, where that file is generated by a slow
+# executing procedure invocation
+
+# this is intended to test how well extractint works with
+
+# TODO should also make tests for readData and readData2
+
+rm -f *.kml
+
+echo "localhost 	slowint 		$(pwd)/extract-int-delayed-slowint.sh	INSTALLED	INTEL32::LINUX	null" > ./extract-int-delayed-tc.data
+
+swift -tc.file ./extract-int-delayed-tc.data extract-int-delayed.swift


Property changes on: trunk/tests/misc/extract-int-delayed.sh
___________________________________________________________________
Name: svn:executable
   + *

Added: trunk/tests/misc/extract-int-delayed.swift
===================================================================
--- trunk/tests/misc/extract-int-delayed.swift	                        (rev 0)
+++ trunk/tests/misc/extract-int-delayed.swift	2008-12-14 21:14:16 UTC (rev 2372)
@@ -0,0 +1,23 @@
+
+type file;
+
+app (file intermediate) p() {
+  slowint stdout=@intermediate;
+}
+
+file f = p();
+
+
+// TODO need two cases (at least) - one with assignment in declaration
+// and one with assignment decoupled from declaration
+
+// the decoupled case gets further along that the single-statement
+// case, at time of writing.
+
+// int i = @extractint(f);
+
+int i;
+i = @extractint(f);
+
+trace(i);
+

Modified: trunk/tests/misc/run
===================================================================
--- trunk/tests/misc/run	2008-12-14 20:04:53 UTC (rev 2371)
+++ trunk/tests/misc/run	2008-12-14 21:14:16 UTC (rev 2372)
@@ -1,7 +1,7 @@
 #!/bin/sh
 for a in clusters no-retries dryrun typecheck path-prefix restart restart2 restart3 restart4 restart5 restart-iterate workernode-local \
 ordering-extern-notlazy restart-extern ordering-extern \
-external-mapper-args \
+external-mapper-args extract-int-delayed \
 ; do
  ./${a}.sh
  R=$?




More information about the Swift-commit mailing list