[Swift-commit] r3471 - trunk/src/org/griphyn/vdl/karajan/lib

noreply at svn.ci.uchicago.edu noreply at svn.ci.uchicago.edu
Fri Jul 23 23:37:51 CDT 2010


Author: hategan
Date: 2010-07-23 23:37:51 -0500 (Fri, 23 Jul 2010)
New Revision: 3471

Added:
   trunk/src/org/griphyn/vdl/karajan/lib/DoRestartLog.java
Modified:
   trunk/src/org/griphyn/vdl/karajan/lib/LogVar.java
Log:
and another one...

Added: trunk/src/org/griphyn/vdl/karajan/lib/DoRestartLog.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/lib/DoRestartLog.java	                        (rev 0)
+++ trunk/src/org/griphyn/vdl/karajan/lib/DoRestartLog.java	2010-07-24 04:37:51 UTC (rev 3471)
@@ -0,0 +1,48 @@
+//----------------------------------------------------------------------
+//This code is developed as part of the Java CoG Kit project
+//The terms of the license can be found at http://www.cogkit.org/license
+//This message may not be removed or altered.
+//----------------------------------------------------------------------
+
+/*
+ * Created on Jul 18, 2010
+ */
+package org.griphyn.vdl.karajan.lib;
+
+import java.util.List;
+
+import org.globus.cog.karajan.arguments.Arg;
+import org.globus.cog.karajan.arguments.ArgUtil;
+import org.globus.cog.karajan.arguments.VariableArguments;
+import org.globus.cog.karajan.stack.VariableStack;
+import org.globus.cog.karajan.util.TypeUtil;
+import org.globus.cog.karajan.workflow.ExecutionException;
+import org.globus.cog.karajan.workflow.nodes.AbstractSequentialWithArguments;
+import org.griphyn.vdl.mapping.DSHandle;
+import org.griphyn.vdl.mapping.Path;
+
+public class DoRestartLog extends AbstractSequentialWithArguments {
+    public static final Arg RESTARTOUTS = new Arg.Positional("restartouts");
+
+    static {
+        setArguments(DoRestartLog.class, new Arg[] { RESTARTOUTS });
+    }
+
+    @Override
+    protected void post(VariableStack stack) throws ExecutionException {
+        List files = TypeUtil.toList(RESTARTOUTS.getValue(stack));
+        VariableArguments ret = ArgUtil.getVariableReturn(stack);
+        try {
+            for (Object f : files) {
+                List pv = TypeUtil.toList(f);
+                Path p = Path.parse(TypeUtil.toString(pv.get(0)));
+                DSHandle handle = (DSHandle) pv.get(1);
+                LogVar.logVar(stack, handle, p);
+            }
+        }
+        catch (Exception e) {
+            throw new ExecutionException(e);
+        }
+        super.post(stack);
+    }
+}

Modified: trunk/src/org/griphyn/vdl/karajan/lib/LogVar.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/lib/LogVar.java	2010-07-24 04:31:46 UTC (rev 3470)
+++ trunk/src/org/griphyn/vdl/karajan/lib/LogVar.java	2010-07-24 04:37:51 UTC (rev 3471)
@@ -4,6 +4,7 @@
 package org.griphyn.vdl.karajan.lib;
 
 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.TypeUtil;
 import org.globus.cog.karajan.workflow.ExecutionException;
@@ -27,15 +28,19 @@
         else {
             path = Path.parse(TypeUtil.toString(p));
         }
-		path = var.getPathFromRoot().append(path);
-		String annotation;
-		if(var.getMapper() != null) {
-			annotation = "" + var.getMapper().map(path);
-		} else {
-			annotation = "unmapped";
-		}
-		RestartLog.LOG_CHANNEL.ret(stack, var.getRoot().getParam("swift#restartid")
-				+ "." + path.stringForm() + "!" + annotation);
+        logVar(stack, var, path);
 		return null;
 	}
+	
+	public static void logVar(VariableStack stack, DSHandle var, Path path) throws VariableNotFoundException {
+	    path = var.getPathFromRoot().append(path);
+        String annotation;
+        if(var.getMapper() != null) {
+            annotation = "" + var.getMapper().map(path);
+        } else {
+            annotation = "unmapped";
+        }
+        RestartLog.LOG_CHANNEL.ret(stack, var.getRoot().getParam("swift#restartid")
+                + "." + path.stringForm() + "!" + annotation);
+	}
 }




More information about the Swift-commit mailing list