[Swift-commit] r4487 - in trunk: libexec src/org/griphyn/vdl/karajan/lib
hategan at ci.uchicago.edu
hategan at ci.uchicago.edu
Tue May 17 17:48:46 CDT 2011
Author: hategan
Date: 2011-05-17 17:48:46 -0500 (Tue, 17 May 2011)
New Revision: 4487
Added:
trunk/src/org/griphyn/vdl/karajan/lib/UnwrapClosedList.java
Modified:
trunk/libexec/vdl-int-staging.k
trunk/libexec/vdl-int.k
trunk/libexec/vdl-lib.xml
Log:
explicitly use data values when passing info to layers unaware of swift data instead of relying on DataNode.toString() to magically return the value when data is closed
Modified: trunk/libexec/vdl-int-staging.k
===================================================================
--- trunk/libexec/vdl-int-staging.k 2011-05-17 22:04:55 UTC (rev 4486)
+++ trunk/libexec/vdl-int-staging.k 2011-05-17 22:48:46 UTC (rev 4487)
@@ -108,16 +108,16 @@
vdl:siteprofile(rhost, "swift:wrapperInterpreterOptions"),
wrapper,
"-e", vdl:executable(tr, rhost),
- "-out", stdout,
- "-err", stderr,
- "-i", maybe(stdin),
+ "-out", getFieldValue(stdout),
+ "-err", getFieldValue(stderr),
+ "-i", maybe(getFieldValue(stdin)),
"-d", flatten(unique(outFileDirs(stageout))),
"-if", flatten(infiles(stagein)),
"-of", flatten(outfiles(stageout)),
"-k",
"-cdmfile", cdmfile,
"-status", "provider"
- "-a", maybe(each(arguments))
+ "-a", maybe(unwrapClosedList(arguments))
)
directory = "{wfdir}-{jobdir}-{jobid}"
redirect = false
Modified: trunk/libexec/vdl-int.k
===================================================================
--- trunk/libexec/vdl-int.k 2011-05-17 22:04:55 UTC (rev 4486)
+++ trunk/libexec/vdl-int.k 2011-05-17 22:48:46 UTC (rev 4487)
@@ -435,17 +435,18 @@
sys:file:write(wrapfile,
"-scratch ", try(vdl:siteprofile(rhost, "scratch"), ""), nl(),
"-e ",vdl:executable(tr, rhost), nl(),
- "-out ",stdout,nl(),
- "-err ",stderr,nl(),
- "-i ",maybe(stdin),nl(),
- "-d ",flatten(each(fileDirs)),nl(),
- "-if ",flatten(infiles(stagein)),nl(),
- "-of ",flatten(outfiles(stageout)),nl(),
- "-k ",kickstart,nl(),
- "-cdmfile ",cdm:file(),nl(),
- "-status ",statusMode,nl())
- for(argiterator, arguments
- sys:file:write(wrapfile,append=true,"-a ",argiterator,nl())
+ "-out ", getFieldValue(stdout), nl(),
+ "-err ", getFieldValue(stderr), nl(),
+ "-i ", maybe(getFieldValue(stdin)), nl(),
+ "-d ", flatten(each(fileDirs)), nl(),
+ "-if ", flatten(infiles(stagein)), nl(),
+ "-of ", flatten(outfiles(stageout)), nl(),
+ "-k ", kickstart, nl(),
+ "-cdmfile ", cdm:file(), nl(),
+ "-status ", statusMode, nl(),
+ "-a ", each(unwrapClosedList(arguments)), nl())
+ for(a, unwrapClosedList(arguments)
+ sys:file:write(wrapfile, append = true, a, nl())
)
)
)
@@ -496,16 +497,16 @@
"-jobdir", jobdir,
"-scratch", try(vdl:siteprofile(rhost, "scratch"), "")
"-e", vdl:executable(tr, rhost),
- "-out", stdout,
- "-err", stderr,
- "-i", maybe(stdin),
+ "-out", getFieldValue(stdout),
+ "-err", getFieldValue(stderr),
+ "-i", maybe(getFieldValue(stdin)),
"-d", flatten(each(fileDirs)),
"-if", flatten(infiles(stagein)),
"-of", flatten(outfiles(stageout)),
"-k", kickstart,
"-cdmfile", cdm:file(),
"-status", statusMode,
- "-a", maybe(each(arguments))
+ "-a", maybe(unwrapClosedList(arguments))
)
directory=wfdir
redirect=false
Modified: trunk/libexec/vdl-lib.xml
===================================================================
--- trunk/libexec/vdl-lib.xml 2011-05-17 22:04:55 UTC (rev 4486)
+++ trunk/libexec/vdl-lib.xml 2011-05-17 22:48:46 UTC (rev 4487)
@@ -120,6 +120,7 @@
<export name="outFileDirs"><elementDef classname="org.griphyn.vdl.karajan.lib.OutFileDirs"/></export>
<export name="outFiles"><elementDef classname="org.griphyn.vdl.karajan.lib.OutFiles"/></export>
<export name="doRestartLog"><elementDef classname="org.griphyn.vdl.karajan.lib.DoRestartLog"/></export>
+ <export name="unwrapClosedList"><elementDef classname="org.griphyn.vdl.karajan.lib.UnwrapClosedList"/></export>
</namespace>
<namespace prefix="cdm">
Added: trunk/src/org/griphyn/vdl/karajan/lib/UnwrapClosedList.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/lib/UnwrapClosedList.java (rev 0)
+++ trunk/src/org/griphyn/vdl/karajan/lib/UnwrapClosedList.java 2011-05-17 22:48:46 UTC (rev 4487)
@@ -0,0 +1,43 @@
+/*
+ * Created on Dec 26, 2006
+ */
+package org.griphyn.vdl.karajan.lib;
+
+import java.util.List;
+
+import org.apache.log4j.Logger;
+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.mapping.DSHandle;
+import org.griphyn.vdl.mapping.HandleOpenException;
+import org.griphyn.vdl.mapping.InvalidPathException;
+import org.griphyn.vdl.mapping.Path;
+
+public class UnwrapClosedList extends VDLFunction {
+ public static final Logger logger = Logger.getLogger(UnwrapClosedList.class);
+
+ public static final Arg.Positional PA_LIST = new Arg.Positional("list");
+
+ static {
+ setArguments(UnwrapClosedList.class, new Arg[] { PA_LIST });
+ }
+
+ /**
+ * Takes a supplied variable and path, and returns the unique value at that
+ * path. Path can contain wildcards, in which case an array is returned.
+ */
+ public Object function(VariableStack stack) throws ExecutionException {
+ @SuppressWarnings("unchecked")
+ List<DSHandle> l = (List<DSHandle>) PA_LIST.getValue(stack);
+
+ Object[] r = new Object[l.size()];
+
+ for (int i = 0; i < r.length; i++) {
+ r[i] = l.get(i).getValue();
+ }
+
+ return r;
+ }
+}
More information about the Swift-commit
mailing list