[Swift-commit] r6025 - in trunk/src/org/griphyn/vdl: karajan/lib karajan/lib/swiftscript mapping
hategan at ci.uchicago.edu
hategan at ci.uchicago.edu
Sat Nov 10 14:23:24 CST 2012
Author: hategan
Date: 2012-11-10 14:23:23 -0600 (Sat, 10 Nov 2012)
New Revision: 6025
Modified:
trunk/src/org/griphyn/vdl/karajan/lib/Stagein.java
trunk/src/org/griphyn/vdl/karajan/lib/Tracer.java
trunk/src/org/griphyn/vdl/karajan/lib/swiftscript/ReadData.java
trunk/src/org/griphyn/vdl/karajan/lib/swiftscript/ReadStructured.java
trunk/src/org/griphyn/vdl/mapping/RootArrayDataNode.java
trunk/src/org/griphyn/vdl/mapping/RootDataNode.java
Log:
rename main thread to "main" instead of an empty string when tracing; formalized messages according to bug867
Modified: trunk/src/org/griphyn/vdl/karajan/lib/Stagein.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/lib/Stagein.java 2012-11-10 05:56:59 UTC (rev 6024)
+++ trunk/src/org/griphyn/vdl/karajan/lib/Stagein.java 2012-11-10 20:23:23 UTC (rev 6025)
@@ -76,9 +76,6 @@
for (Path p : fp) {
AbstractDataNode n = (AbstractDataNode) var.getField(p);
n.waitFor();
- if (tracer.isEnabled()) {
- tracer.trace(stack, procName + " available " + Tracer.getVarName(n));
- }
}
}
catch (DependentException e) {
@@ -90,7 +87,7 @@
}
catch (FutureFault f) {
if (tracer.isEnabled()) {
- tracer.trace(stack, procName + " wait " + Tracer.getFutureName(f.getFuture()));
+ tracer.trace(stack, procName + " WAIT " + Tracer.getFutureName(f.getFuture()));
}
throw f;
}
@@ -115,7 +112,7 @@
var.waitFor();
}
catch (FutureFault f) {
- tracer.trace(stack, procName + " waiting for " + Tracer.getFutureName(f.getFuture()));
+ tracer.trace(stack, procName + " WAIT " + Tracer.getFutureName(f.getFuture()));
throw f;
}
}
Modified: trunk/src/org/griphyn/vdl/karajan/lib/Tracer.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/lib/Tracer.java 2012-11-10 05:56:59 UTC (rev 6024)
+++ trunk/src/org/griphyn/vdl/karajan/lib/Tracer.java 2012-11-10 20:23:23 UTC (rev 6025)
@@ -134,11 +134,11 @@
}
public void trace(VariableStack stack, Object msg) throws VariableNotFoundException {
- trace(ThreadingContext.get(stack).toString(), msg);
+ trace(threadName(stack), msg);
}
public void trace(String thread, Object msg) {
- String str = source + ", thread " + thread + ", " + msg;
+ String str = source + ", thread " + threadName(thread) + ", " + msg;
logger.info(str);
}
@@ -146,7 +146,7 @@
if (line == null) {
return;
}
- String str = name + ", line " + line + ", thread " + thread + ", "+ msg;
+ String str = name + ", line " + line + ", thread " + threadName(thread) + ", "+ msg;
logger.info(str);
}
@@ -154,14 +154,27 @@
if (line == null) {
return;
}
- String str = source + ", line " + line + ", thread " + thread + ", " + msg;
+ String str = source + ", line " + line + ", thread " + threadName(thread) + ", " + msg;
logger.info(str);
}
public void trace(String thread) {
- logger.info(source + ", thread " + thread);
+ logger.info(source + ", thread " + threadName(thread));
}
+ private String threadName(String thread) {
+ if (thread.isEmpty()) {
+ return "main";
+ }
+ else {
+ return thread;
+ }
+ }
+
+ private String threadName(VariableStack stack) throws VariableNotFoundException {
+ return threadName(ThreadingContext.get(stack).toString());
+ }
+
private static Tracer disabledTracer, enabledTracer;
public static Tracer getTracer(FlowNode fe) {
@@ -245,8 +258,8 @@
}
public static Object unwrapHandle(Object o) {
- if (o instanceof DSHandle) {
- DSHandle h = (DSHandle) o;
+ if (o instanceof AbstractDataNode) {
+ AbstractDataNode h = (AbstractDataNode) o;
if (h.isClosed()) {
if (h.getType().isPrimitive()) {
if (Types.STRING.equals(h.getType())) {
@@ -260,8 +273,7 @@
return getVarName(h);
}
else {
- Mapper m = h.getMapper();
- return "<" + m.map(h.getPathFromRoot()) + ">";
+ return fileName(h);
}
}
else {
@@ -274,17 +286,12 @@
}
public static Object fileName(AbstractDataNode n) {
- if (Types.STRING.equals(n.getType())) {
- return unwrapHandle(n);
+ Mapper m = n.getActualMapper();
+ if (m == null) {
+ return "?" + getVarName(n);
}
else {
- Mapper m = n.getActualMapper();
- if (m == null) {
- return "?" + getVarName(n);
- }
- else {
- return "<" + m.map(n.getPathFromRoot()) + ">";
- }
+ return "<" + m.map(n.getPathFromRoot()) + ">";
}
}
}
Modified: trunk/src/org/griphyn/vdl/karajan/lib/swiftscript/ReadData.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/lib/swiftscript/ReadData.java 2012-11-10 05:56:59 UTC (rev 6024)
+++ trunk/src/org/griphyn/vdl/karajan/lib/swiftscript/ReadData.java 2012-11-10 20:23:23 UTC (rev 6025)
@@ -50,7 +50,7 @@
public static final Arg SRC = new Arg.Positional("src");
public static boolean warning;
- public static Tracer tracer;
+ public Tracer tracer;
static {
setArguments(ReadData.class, new Arg[] { DEST, SRC });
@@ -59,14 +59,14 @@
@Override
protected void initializeStatic() {
super.initializeStatic();
- tracer = Tracer.getTracer(this);
+ tracer = Tracer.getTracer(this, "SWIFTCALL");
}
protected Object function(VariableStack stack) throws ExecutionException {
DSHandle dest = (DSHandle) DEST.getValue(stack);
AbstractDataNode src = (AbstractDataNode) SRC.getValue(stack);
if (tracer.isEnabled()) {
- tracer.trace(stack, Tracer.fileName(src));
+ tracer.trace(stack, "readData(" + Tracer.unwrapHandle(src) + ")");
}
src.waitFor();
if (src.getType().equals(Types.STRING)) {
Modified: trunk/src/org/griphyn/vdl/karajan/lib/swiftscript/ReadStructured.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/lib/swiftscript/ReadStructured.java 2012-11-10 05:56:59 UTC (rev 6024)
+++ trunk/src/org/griphyn/vdl/karajan/lib/swiftscript/ReadStructured.java 2012-11-10 20:23:23 UTC (rev 6025)
@@ -29,11 +29,11 @@
import org.globus.cog.karajan.arguments.Arg;
import org.globus.cog.karajan.stack.VariableStack;
import org.globus.cog.karajan.workflow.ExecutionException;
+import org.griphyn.vdl.karajan.lib.Tracer;
import org.griphyn.vdl.karajan.lib.VDLFunction;
import org.griphyn.vdl.mapping.AbsFile;
import org.griphyn.vdl.mapping.AbstractDataNode;
import org.griphyn.vdl.mapping.DSHandle;
-import org.griphyn.vdl.mapping.HandleOpenException;
import org.griphyn.vdl.mapping.Path;
import org.griphyn.vdl.mapping.PhysicalFormat;
import org.griphyn.vdl.type.Types;
@@ -48,10 +48,21 @@
static {
setArguments(ReadStructured.class, new Arg[] { DEST, SRC });
}
+
+ public Tracer tracer;
+
+ @Override
+ protected void initializeStatic() {
+ super.initializeStatic();
+ tracer = Tracer.getTracer(this, "SWIFTCALL");
+ }
protected Object function(VariableStack stack) throws ExecutionException {
DSHandle dest = (DSHandle) DEST.getValue(stack);
AbstractDataNode src = (AbstractDataNode) SRC.getValue(stack);
+ if (tracer.isEnabled()) {
+ tracer.trace(stack, "readData2(" + Tracer.unwrapHandle(src) + ")");
+ }
src.waitFor();
if (src.getType().equals(Types.STRING)) {
readData(dest, (String) src.getValue());
Modified: trunk/src/org/griphyn/vdl/mapping/RootArrayDataNode.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/RootArrayDataNode.java 2012-11-10 05:56:59 UTC (rev 6024)
+++ trunk/src/org/griphyn/vdl/mapping/RootArrayDataNode.java 2012-11-10 20:23:23 UTC (rev 6025)
@@ -63,7 +63,7 @@
if (waitingMapperParam != null) {
waitingMapperParam.getFutureWrapper().addModificationAction(this, null);
if (tracer.isEnabled()) {
- tracer.trace(getThread(), getDeclarationLine(), getDisplayableName() + " wait "
+ tracer.trace(getThread(), getDeclarationLine(), getDisplayableName() + " WAIT "
+ Tracer.getVarName(waitingMapperParam));
}
return;
@@ -98,11 +98,7 @@
}
}
- public void futureModified(Future f, VariableStack stack) {
- if (tracer.isEnabled()) {
- tracer.trace(getThread(), getDeclarationLine(), getDisplayableName() + " available "
- + Tracer.getFutureName(f));
- }
+ public void futureModified(Future f, VariableStack stack) {
innerInit();
}
@@ -150,7 +146,7 @@
initialized = true;
waitingMapperParam = null;
if (tracer.isEnabled()) {
- tracer.trace(getThread(), getDeclarationLine(), getDisplayableName() + " initialized");
+ tracer.trace(getThread(), getDeclarationLine(), getDisplayableName() + " INITIALIZED");
}
}
}
Modified: trunk/src/org/griphyn/vdl/mapping/RootDataNode.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/RootDataNode.java 2012-11-10 05:56:59 UTC (rev 6024)
+++ trunk/src/org/griphyn/vdl/mapping/RootDataNode.java 2012-11-10 20:23:23 UTC (rev 6025)
@@ -67,7 +67,7 @@
if (waitingMapperParam != null) {
waitingMapperParam.getFutureWrapper().addModificationAction(this, null);
if (tracer.isEnabled()) {
- tracer.trace(getThread(), getDeclarationLine(), getDisplayableName() + " wait "
+ tracer.trace(getThread(), getDeclarationLine(), getDisplayableName() + " WAIT "
+ Tracer.getVarName(waitingMapperParam));
}
return;
@@ -109,10 +109,6 @@
}
public void futureModified(Future f, VariableStack stack) {
- if (tracer.isEnabled()) {
- tracer.trace(getThread(), getDeclarationLine(), getDisplayableName() + " available "
- + Tracer.getFutureName(f));
- }
innerInit();
}
@@ -251,7 +247,7 @@
initialized = true;
waitingMapperParam = null;
if (tracer.isEnabled()) {
- tracer.trace(getThread(), getDeclarationLine(), getDisplayableName() + " initialized");
+ tracer.trace(getThread(), getDeclarationLine(), getDisplayableName() + " INITIALIZED");
}
}
}
More information about the Swift-commit
mailing list