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

hategan at ci.uchicago.edu hategan at ci.uchicago.edu
Sun Nov 18 01:41:40 CST 2012


Author: hategan
Date: 2012-11-18 01:41:37 -0600 (Sun, 18 Nov 2012)
New Revision: 6056

Modified:
   trunk/src/org/griphyn/vdl/karajan/VDL2ExecutionContext.java
Log:
dump a karajan level stack trace to the logs in the event of failure to help figure out where in, say, vdl-int the problem has occurred

Modified: trunk/src/org/griphyn/vdl/karajan/VDL2ExecutionContext.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/VDL2ExecutionContext.java	2012-11-18 07:40:16 UTC (rev 6055)
+++ trunk/src/org/griphyn/vdl/karajan/VDL2ExecutionContext.java	2012-11-18 07:41:37 UTC (rev 6056)
@@ -23,6 +23,7 @@
 import java.util.List;
 
 import org.apache.log4j.Logger;
+import org.globus.cog.karajan.stack.Trace;
 import org.globus.cog.karajan.stack.VariableStack;
 import org.globus.cog.karajan.workflow.ElementTree;
 import org.globus.cog.karajan.workflow.ExecutionContext;
@@ -45,7 +46,7 @@
 
 	protected void printFailure(ExecutionException e) {
 		if (logger.isDebugEnabled()) {
-			logger.debug(e.getMessage(), e);
+		    logger.debug("Karajan level error: " + getKarajanTrace(e));		
 		}
 		String msg = e.getMessage();
 		if (!"Execution completed with errors".equals(msg)) {
@@ -74,7 +75,26 @@
 		}
 	}
 
-	protected void setGlobals(VariableStack stack) {
+	private String getKarajanTrace(ExecutionException e) {
+	    StringBuilder sb = new StringBuilder();
+	    while (e != null) {
+	        sb.append(e.getMessage());
+	        if (e.getStack() != null) {
+	            sb.append(" at\n");
+	            sb.append(Trace.get(e.getStack()));
+	        }
+	        if (e.getCause() instanceof ExecutionException) {
+	            e = (ExecutionException) e.getCause();
+	            sb.append("\ncaused by: ");
+	        }
+	        else {
+	            e = null;
+	        }
+	    }
+        return sb.toString();
+    }
+
+    protected void setGlobals(VariableStack stack) {
 		super.setGlobals(stack);
 		stack.setGlobal(RUN_ID, runID);
 		stack.setGlobal(SCRIPT_NAME, scriptName);




More information about the Swift-commit mailing list